Smarter Bicycle Helmet

4.0K2912

Intro: Smarter Bicycle Helmet

I started the »instructable« for my son's school project. The project was to sell something interesting and so, the idea came up to sell smarter bicycle helmet.

The bicycle helmet is equipped with turn signal lights, which are controlled by the gesture of cyclist’s head. Therefore the cycler does not need to let go off the bicycle handlebar to point to the direction he wants to go making the cyclist a bit safer.

Switching on turn signal is done by swinging head two times to wanted direction. Switching off the lights is done by swinging head down or another two times to the same direction as was done to switching on. The cyclist know if turn signal light is on by a buzzer which plays a tone – left light makes slightly different tone than the right one. The buzzer on start-up also tells the cyclist if something went wrong or if start-up procedure of connecting all sensors has finished successfully.

The helmet itself is not changed: the whole electronics is just an upgrade and is embed onto.

The composition

The main part of feature is Arduino MicroPro with Gyro sensor and turn signal lights composed from six 5mm LEDs. The electronics is powered with small 500mAh Lipo battery.

Gyro module connection uses I2C bus, therefore it needs connection to SDA and SCL port (pin 2 and 3 on Micro Pro). It also needs connection to first interrupt pin (pin 7 on Micro Pro).

Pin 10 and 16 is used for switching Leds and pin 14 for enabling/disabling buzzer. For testing purposes Bluetooth module is used. RX pin from BT module is connected to TX0 pin on MicroPro and TX pin on BT module is connected to RX0 pin on MicroPro. The helmet sends its state through Bluetooth to for example to mobile phone.

From time to time gyro module needs calibration. To start it a micro key switch is used. It is connected to pin 4 on MicroPro.

Although connection is easy, getting output too. Filtering Gyro output is not (even an example of using Gyro, which can be found on the playground arduino page says that). More of that can be seen in the source code.

Used libraries and tutorials

- Basic information MPU-6050 Accelerometer + Gyro from https://playground.arduino.cc/Main/MPU-6050

- MPU6050 tutarial by “Arduino script for MPU-6050 auto-calibration”: http://42bots.com/tutorials/arduino-script-for-mpu-6050-auto-calibration/

- MPU6050 tutorial and information from Arduino forum https://forum.arduino.cc/index.php?topic=514498.0

- I2Cdev and MPU6050 library by Luis Ródenas from https://github.com/jrowberg/i2cdevlib

- EEPROM Arduino library

Material used

- My cycle helmet

- Arduino MicroPro (www.dx.com for 5.99$)

- Gyro module MPU6050 (www.dx.com for 2.86$)

- Battery protection board (www.banggood.com for 2.49$)

- 500mAh battery ( www.aliexpress.com for 4.86$)

- twelve yellow 5mm diameter LEDs (6 for each side). Each Led pulls 20mA of current at 1.8V (Ebay for 0.14$ for all)

- 6 resistors 82 ohms

- 2 N-Channel MOS-FET for powering Leds (e-bay AO3400 A09T 5.7A/30V SOT23 N-Channel MOSFET)

- 1 P-Channel MOS-FET for powering BlueTooth module (Optional)

- 4 resistors 10kOhm (1 optional)

- 1 resistor 100 Ohm

- Buzzer 5v (E-bay for 0.2$)

- 2 micro key switch (1 optional)

- BlueTooth module (optional)

Led diodes

I didn’t complicate with Led support: I made it from plastic I got in my warehouse and glued Leds with hot glue to supported plate. The Led support should be made from carton paper too.

Two Leds and 82 Ohm 1/4W resistor are connected in serial together. For one side I connect three such serial connections in parallel together. The Leds’ wires are connected to these parallel Leds. I calculated proper schema in the Online Led calculator (http://led.linear1.org/led.wiz). Anyhow you can change the number and the type of Leds as suits you. I use MosFets which I have them at home. They can hold up to 5.7A of current at 30V. I think they resist enough current J.

Support circuit board

Support circuit board is used to connect all other stuff together. I took SMB version of resistors and MosFets to create as small circuit board as I can do by myself.

I bought a Photo coated pertinax. I printed the circuit with laser printer on transparent foil. After 10 minutes of lightning with VTF bulb (Philips HPL-N 125W E27) I developed the board with 7% NaOH solution with water and etched with solution of 17% of HCl (30% hydrochloric acid), 17% of H2O2 (30% hydrogen peroxide) and 66 % of water (I bought all chemicals in a local drugstore).

With hot glue I glued to the support circuit board also battery shield. It is placed to pre-made hole in circuit board for charging LiPo battery using micro USB cable.

I put Battery shield board and Arduino MicroPro into thermo shrink tube to prevent any unwanted connections. In Arduino board I cut out holes for connectors which were the simplest as should be.

I soldered connection wires directly to the board without pre-drilled holes.

At the top of support board I glue little on/off switch. Also, with hot glue.

The support board is screwed to the helmet by two plastic M3 screws to the holes created with thicker needle. These two holes are the only deformation on helmet.

Bluetooth

Bluetooth module is optional. It is used only for testing purposes. It sends Gyro data to Bluetooth receiver rather than to Serial window on PC. Some debugs are send too.

I use Android's Bluetooth Terminal HC-05 applet to read the helmet data.

Bluetooth module should be used for some other features (not implemented yet). In case to save helmet’s power the micro key switch is implemented into the connection board to switch off Bluetooth transmitter by one MOS-FET transistor.

The idea of other features is to send SMS with GPS coordinates to someone in case that cyclist falls from bicycle. The problem here (at least I see it) is that is hardly distinguish if cyclist is really falling. Such signals are very similar to some other situations therefore I was not implemented yet.

9 Comments

Hi can you teach me the base code for the head motion ?
I want to recreate your project, but I want to modify the led by using addressable leds. Thanks
Hi.
Thank you for your interest in my project!

Well it was far long ago when I made it. I try to explain as I remember so far.
I started with acceleration sensor but with that I had no direction information, so I uses gyro. I use only X and Y part of data without Z part, because is is not expected to cyclist go up and down ;-).

To start working with sensor I prepared a simple sketch which read gyro data and save them to SD card. Because that scatch just read and write data it was very fast so I got a huge amount data in a short period. Nothing usable.
Than I put some delays into (to simulate somekind of processor's another job) and find out satisfied data.
Next step was to filter out proper data. I put data into excel file (see attachment) to imagine the data what sensor give me. What you see in the diagram is direct data of moving head. The data in attached file was a little managed: I cut out the maximums and minimums, so above min/max threshold (the min/max threshold was artificially decided) is not important at all. I just need to know if it is over that threshold to use that information. Any value between min/max threshold I just ignore. So I need to find out just the order and direction of those "triggers" to know when the led state needs to be triggered.

At trigger point, the led is put into ON state. The rest (off and flashing) is taking care by led object itself. On every start of the loop the led checks for its state and decide itself what to do. The led state starts with led ON at remembered time. And than, the object know when needs to put led on/off to make flashing effect and eventually power off the led.

So, the main part of applet is this signal filtering. Any signal which is greater than 0 means that head was deviated in - well I do not remember any more (anyhow it is not so important), so let's say to the right. Lower than zero to the left. But remember, when you turn head back to the center from one swing of head you got opposite values than when you turn the head. That's the way the gyro is working. So you have to take care to know where the position of head is. I put some counters and semaphores for that. Also, to skip events when you let's say just want to look on the side I trigger led by two swings of head. So I count also that. Those two swings have to be done in some predefined time interval which I set artificially by testing. Any time interval greater than that just make a reset of leds triggering state.
I had the diagram (a second attachment) how triggering was set. I attached it, but, please make a check if it is still valid. Sorry, I'm not sure because it was passed three years from that time and I'm not sure any more if I implemented so. However, you can make it from the source code by yourself.

I hope I put some more information of my applet here.
Anyhow, don't hesitate to ask if you need more. But, please don't "torture" :-) me, I made a project more than three years ago!

Br,
Hi Andre I want to know if which part of the code executes if I nod ?Thanks

Hi Andre, I trying to create a similar project for nephew who is starting this journey with the Arduino boards, we have a question... how did you used the following variables "stateLR" ,"sigTime" and " intTime " because the are not listed in the code? also why did you use arduino micro pro instead of for instance nano?

thank you

Hello.

Sorry for slow reply.

As you saw in source code
the part where "stateLR" variable is used is commented out. I leave that part
of code in the ZIP to see my first implementation. So it is not used any more.

Both “intTime” and “sigTime”
variables are used to control how much time the helmet is moving – in other
words to get the movement speed. Too slow movements have longer movement times,
on the other side, too fast movements have too short movement time. I want to
filtered out movements which are not caused by intentionally helmet movements.

"intTime" is used
to remember when the whole gesture is started. For example, the time when you
start swinging the helmet to enable left direction. The whole gesture time (two
swings) needs to be done in MAXINTTIME_d.

“sigTime” is used to know in
which time one single signal is done. For example: one swing to the Left without
swinging back – so the time when helmet is moving from center to the left
position.

Nano or Micro Pro: I do not know. That time I already
have Micro Pro at home, so I just use it. I think you should use Arduino Nano
as well. Take care only for TX, RX, SDA and SCL pins. TX and RX are used for
Bluetooth, SDA and SCL for Gyro. Other pins are not so relevant.

Have a nice "arduino" :-)

Andreo, that was very helpfull thanks a lot... :)

Thank you for comments.

To market this stuff is another story. Too much bureaucracy, especially since the items are under GPL license...

You should be marketing this to one of the helmet manufacturers. I am really impressed with the movement based control.

Super clever to require more than one movement to turn on the signals. Well done!