I got from brother in law stationary bike. It is old but in excellent condition. I ride it for a quite a while and I'm using watch with heart rate monitor because bike does not have one. Heart rate monitor in watch has many advantages, but it lacks a few features I wanted it to be available during cycling.
First of all, I wanted such parameters to be constantly visible on the screen:
- Heart Rate
- Current % of maximum Heart Rate
- Total number of burned calories
- The amount of time spent in each of the three zones (fat burn, fitness, performance)
The design have to be simple. Very simple. With the smallest possible number of elements. For the central unit I chose immortal Arduino. The transmitter module is a BM-CS5SR (I bought it when I was buying ezChronos watch), while the receiver is a BM-MM5 (both available here http://www.bm-innovations.com priced at EUR 49 and 29 respectively). BM-MM5 receiver is available in two versions, SPI and UART. I chose the UART option.
Circuit diagram is very simple. Is limited to a few elements. ATmega328 (where I have uploaded the Arduino bootloader), the receiver module BM-MM5, three buttons (UP, DOWN, ENTER / ACK), plus a few elements to allow the receiver to talk to the microcontroller (3.3V voltage regulator, two transistors to convert the voltage levels of the RX and TX line and a bunch of resistors and capacitors [all resistors are 10k, capacitors 0.1uF and polcap is 10uF]).
The program is not finished yet (and probably has many errors) - but I decided to publish it anyway, if someone was thinking of building his own HR monitor will have the basis for its modification.
90% of the code is screen menu. The rest are functions to receive pulse, calculate the displayed values and driving the display itself.
Enclosure is made from Plexiglas. Unfortunately I do not have near by the workshop which would be able to laser cut the plexi to size I wanted, so I took a hand saw and I did what I could.
As it came out - judge yourself.
Transmitter 49 EUR
Receiver 29 EUR
ATmega328 3 EUR
LCD display 5 EUR
rest of the elements ca. 3 EUR
Eagle files + source code for Arduino
Friday, July 6, 2012
Projects which makes Arduino "blink" RGB LED's are thousands in the Web.
So the idea is not fresh at all. It was born when I wanted to write an application for Android platform - for fun and to find out if this is difficult.
The main assumption of the project that I set:
- Remotely controlled (via Bluetooth) lamp where I can change the color of the light (RGB LEDs)
- "Emergency" control of the lamp by 4 buttons (R-red G-green B-blue, M-mode)
The program was created in Eclipse IDE using Java. This is my first Android project so in fact I could not avoid mistakes. I hope there are not too many thought.
Since it was supposed to be a program just for me I wrote it for the Android version 4.0.3.
It also has hard-coded address of my bluetooth module, so if someone want to use it has to make changes in source code.
App for my phone in the first version had only three sliders for each color separately.
Then it were extended on "color picker", 10 favorite colors and the choice of time after which the lamp is off. In addition, I put two buttons to turn lamp on and off and activate the Rainbow mode.
The values of each color are saved at each change, so when you restart the application everything is as if it would never closed.
The exception here is the timer, which value I do not save.
This is the application (main screen and "color picker" color selection)
I had few Arduino's in my drawer so choice was kind of obvious. Easy and friendly approach to programming this platform, spokes for itself. For a start and prototype I've chosen to use prefboards - quick and easy solution. When everything was working fine I did better looking PCB's.
I started with one RGB LED. In the final version, I used 31 LEDs. They are connected in parallel. As the load current is quite big it could be difficult for Arduino to survive such, so each color separately, is driven by transistor (BD139).
I bought a bluetooth module which unfortunately works in 3.3V logic. I was forced to use voltage regulator and the MAX3232. Because there were not enough problems signal from BT module appears to be reversed. So I had to run it through inverter. (I used 7400 NAND gate just because I got few of these in my drawer).
Skeleton for mounting LEDs has been made from an empty softdrink bottles. I cut 3 rings in which I made holes for the LEDs. All soldered together so that it forms a rigid structure.
I bought Jonisk lamp from Ikea. It and is "almost" perfect. Almost, because the design (PCB and LEDs) is a bit too high. The light propagates not uniformly and you can see the darker ring on surface where lighting is slightly worse. Maybe I'll add later one more LED ring, to illuminate the darker area.
Adhesive tape visible on the pictures is just to block Arduino and BT module LEDs light.
I started Arduino code with Bluetooth support. When this was up and running I added additional features. As you can see code is very simple and there is nothing revealing. One thing which might be worrying is interrupts. The problem was Rainbow mode from which loop it was not easy to leave. I used interrupts, because I could not come up with anything more clever than that. So, each RS transmission or pressing "mode" button sets "rainbow" flag to zero.
List of components:
Arduino Nano - $ 16 or ATMega8 ($ 3)
BTM5 - Bluetooth module - $ 9
31 RGB LEDs - $ 15 (per 50 LEDs)
63 resistors to the LEDs (150 - 220R) - choose to desired LEDs current - $ 3
NAND gate 7400 working as inverter - $ 0.5
MAX3232 - TTL converter - 232 (running at 3.3V) - $ 0.5
3.3V regulator - $ 0.5
3x BD139 - $ 3
8x 100nF - $ 1
4x switches - $ 1
4x 10k resistors
2x jumper (to disconnect RX and TX line so Arduino can be programmed in the system)
5V/2A power adapter - $ 5
Jonisk Ikea lamp - $ 60
Combined Eagle schematic and PCB layout, Arduino code and Eclipse project