Bicycle rear warning sign activated by ultra sonic sensor

Similar projects worth following
A simple project suitable for beginners. An ultra sonic sensor detects the relative position of on-coming cars from the rear and lights up an array of 180 red LEDs to encourage the car driver to keep his distance and be considerate when over-taking.

If anybody wants to support any of our projects, check out our Amazon Wishlist here:

Patreon donations can be made here:

Since taking on a part-time job as a bicycle courier delivering parcels for Hermes Parcelnet, UK, I realised that rear facing lighting was really important to ensure safety on the road. I started using regular LED cycle lamps, which were pretty good, but decided to take this 10 steps further and build a massive illuminated sign. i started off by testing out a high spec Maxtronic ultra sonic sensor and found that multiple objects could be detected simultaneously in conjunction with a M4 processor. I used a couple of L293 motor driver chips to control the LEDs and a couple of large 5V re-chargeable lithium batteries wired in series for the power.

During the design phase, I was worried about a few things: 1. Would the lettering be properly visible with the number of LEDs used for each letter and 2. Would the L293 chips cope with the 180 LEDs used for the project. During testing of the device, the lettering was perfectly distinguishable and the L293 chips did not get at all hot, so all is good!

The 2 x L293 chips give 8 channels of power which enables different parts of the display to flash or be dimmed independently. It's important not to dazzle other road users in the dark so dimming the LEDs is very important. Conversely, in bright sunlight, high power is required for the sign to be visible. The LEDs are wired in groups of four in series from the 10V supply rather than two in series from a 5V supply to keep the current flowing through the system down and protect against over-heating.

Most of the components are SMD mounted on the board, but being of 1206 size were easily soldered by hand with very little problem. No stencil was required and solder paste was applied by hand.

Very rarely do my projects work perfectly first time, with the first PCB, but so far everything seems to be pretty good. Gerber files for the PCBs are available in the files section - just send them off to a company such as JCLPCB in China.

Send these Gerber files to your preferred PCB fab company. I recommend JLCPCB in China.

Zip Archive - 167.00 kB - 07/10/2021 at 20:10


  • 2 × L293E STMicroelectronics
  • 1 × MB7070-100 1863-1024-ND ULTRASONIC SENSOR XL-MAXSONAR-WR
  • 3 × Type A USB right angled PCB receptacle RS Stock No.909-7864
  • 1 × Slide potentiometer linear taper 10K 20% RS Stock No.737-7789

View all 15 components

  • Testing on the Road

    Capt. Flatus O'Flaherty ☠07/21/2021 at 12:30 0 comments

  • How does it work?

    Capt. Flatus O'Flaherty ☠07/12/2021 at 15:34 0 comments

    The Maxtronic sensor can detect multiple objects at the same time, as seen in the time line graph above. The peaks indicate the reflectivity and size of the object, so, for example, the peak shown in the middle of this graph could be either a small highly reflective metal object or a large absorbing object such as an animal. The screen-shot above is a representation of a cluttered room with multiple relective surfaces at different distances.
    Fear not, for the mighty M4 processor can capture enough of this data and process it fast enough to get meaningful interpretations of these graphs. Fortunately, there is no Fourier Transform necessary as the data is already on the time line and we dont have to capture all the data either, just one out of every four bits of data needs to be captured, with three data points being skipped. This makes processing the data faster and easier to display using the Arduino IDE plot data function.
    After the data is held in a large array, it is normalised by subtracting from some previously recorded calibration data, which removes the initial transmit spike and puts it all at zero on the Y axis.
    The peaks are each identified by using a simple maximum value with the width of the peak being the length on the X axis of the data around it. Each peak, or spike, is then given an average X axis value and this corresponds to the distance away from the sensor. At the end of processing we end up with a load of spikes, each denoted by an ascending number eg 0,1,2,3,4 .... , the max value of the peak, the width of the spike and the distance from the sensor.
    We can then select for spikes at a larger distance away from the sensor eg 8 m and filter out all the near-to-sensor data to prevent the LED display going off all the time and save the batteries.
    The LED display is split up into 8 parts and each is controlled by a separate channel in the L293 motor driver chips. Each part can be dimmed by changing to ratio between on and off with a simple delayMicroseconds command. The Arduino PWM library could also be used. When used in the dark, the display needs to be substantially dimmed so as not to dazzle car drivers coming up from behind. In the daytime, the dimming can be removed entirely and the LED display is nicely visible, even in bright sunlight. The LEDs themselves are fairly up-market, super bright specs and not the cheap every day LEDs we might otherwise use. There are even better LEDs than the ones I used, but they start to get pretty expensive and the ones I have selected were a good compromise between cost and brightness. The L293 chips basically act as current amplifiers and allow more than 50 LEDs to be controlled from each channel, which would otherwise destroy the Adafruit M4 Express board, releasing the 'Magick Smoke'. The L293s can also drive high intensity sound devices and produce quite a piercing tone at high frequency, which is useful for testing as otherwise we would never know if the LEDs were activated or not. A slider potentiometer is used to control the pulse width of the LED timer such that a longer ratio of digitalWrite HIGH to LOW gives a brighter display.

View all 2 project logs

Enjoy this project?



Bob Collins wrote 07/22/2021 at 15:34 point

Very well done!

I do have a concern. As both a bicyclist and a motorcyclist, I think the existence of a big red light on the back of a two-wheel vehicle could appear to a automobile driver that s/he was seeing a motorcycle. If the automobile driver made incorrect estimations of the the speed or maneuverability, it might be less safe for the bicyclist.

  Are you sure? yes | no

Alexander wrote 07/17/2021 at 14:13 point

This is super duper awesome! I might lift some of the code for this for a project I want to build for my uncle :)

EDIT: Just realized the source is not here, heh. Is it open source?

  Are you sure? yes | no

Mike Szczys wrote 07/16/2021 at 18:38 point

Spectacular placement of the LEDs on this one. Spacing and angles make the message incredibly clear!

  Are you sure? yes | no

Capt. Flatus O'Flaherty ☠ wrote 07/16/2021 at 18:50 point

Thanks for your comment Mike !

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates