loading
This instructable walks you through how to add a wireless remote control to your existing Monkey Light M232 bike lights. I love these lights - 42 rad patterns, loads of different colors, two brightness settings and low power consumption. But one thing seriously missing is wireless control - everytime you wanna turn these on/off or change the pattern/color, you must stop, search for a very small button to push, then start riding again - Really?!? The M232 completely installs on the wheel, so a wired switch would not work. I thought about using bluetooth controlled through a smartphone, but the prospect of clumsily handling and consequently dropping my iPhone led me to consider a basic remote control. And I have tons of 'em. Let the dropping begin!! Also, IR receivers are cheap: less than a buck at Solarbotics!
The general concept: TV remote sends IR signal to IR receiver, IR receiver sends data to Arduino, Arduino triggers a relay which is connected to the M232 power button, power button turns the lights on.
I used a solderless breadboard for initial circuit design. When I was satisfied it worked, I soldered all components onto a breadboard.

Materials needed:
Monkey Light M232 - http://www.monkeylectric.com/m232_bike_light/
any remote control - I used an Apple remote 'cuz it's small
9V battery w/ connector lead
small breadboard
7805 voltage regulator https://www.sparkfun.com/datasheets/Components/LM7805.pdf
Arduino - I used a Pro Mini https://solarbotics.com/product/50725/
IR receiver - I used a TSOP 4038 https://solarbotics.com/product/TSOP4038/
5V relay - I used an Omron M5SB-14 http://www.omron.com/ecb/products/pdf/en-g5sb.pdf
short wires


Tools needed:
soldering iron
utility knife
side cutters
needlenose pliers

Step 1: Arduino Pro Mini

I chose the Mini because it is, well: mini! As it does not have an onboard USB connection, it requires a USB to TTL converter  https://solarbotics.com/product/39240/  to connect to your computer. Select the appropriate board and com port for your Arduino. Make sure you have communication (download sample sketch 'Blink').

Step 2: Connecting the Relay

The coil voltage is what creates a short on the contact pins of the relay. Connect two wires from the Arduino to the coil on the relay: one from Arduino Ground to the relay coil; another from Arduino Pin 2 to the relay coil. The G5SB-14 is not polarity sensitive. Test the relay by sending HIGH and LOW to Pin 2 with these lines found in the sketch: digitalWrite(relayTrigger, HIGH); relay should click on. Then try digitalWrite(relayTrigger, LOW); relay should click off.

Step 3: Connecting the TSOP 4038

Mount the TSOP on the breadboard (see circuit diagram). Because the wheel will be spinning around, it does not matter which direction it is facing, but keep in mind the orientation: do not solder it face down, or block with another component - the 'eye' needs to 'see' the remote. And remember, most remotes will work, not just this one. This Apple remote is great cuz it's small, but beware of hipsters controlling your lights. Now test the remote - if the included sketch is running with the Arduino serial monitor open, you should see some gibberish when pressing buttons.

Step 4: Connecting the M232

The M232 is a PCB with components (LEDs, ICs, switches, etc) enclosed in a clear rubber membrane which makes it waterproof. This membrane needs to be cut away from the solder tabs which connect the power switch to the PCB. The membrane is on there really good, so be patient when you cut it - if you cut too deep you will injure the circuit board. These are surface-mount push-button switches, which are NO (normally open). We only need access to 2 tabs on the switch: either the left two or the right two. Solder a short wire to each of the exposed tabs. The other ends of the wires connect to the contacts of the relay on the breadboard (see relay datasheet in parts list). It doesn't matter which wire goes where; we are simply creating a short when the relay is activated. Test this - now when you send HIGH, then LOW to Pin 2, the M232 should respond. (You will notice the response when the LOW is sent, not the HIGH. This echoes pushing the button - the activation occurs when the button is released, not when it is pushed.)

Step 5: Connecting Power

This is not really a step, but I wanted you to avoid making the same mistake I did:
I attempted to use the existing battery pack from the M232 to power all this other gack - with three AA batteries it provided 4.5V - within the operating range for both the Arduino and the TSOP 4038. And it did work - well, it half-worked: it triggered the relay to turn the M232 on, but it wouldn't trigger the relay to turn it off; the relay would only make a faint 'click' - I figured this is due to the current draw of the M232 circuitry: ie when the lights are on, there is inadequate power to trigger the relay. So, I decided to throw a 9V battery with a voltage regulator into the mix. See circuit diagram.

Step 6: Breadboard Layout

I left enough space on the breadboard for the Arduino, as well as the relay. I also made provisions to add two more relays, because in the near future I hope to add wireless control for the 'Theme' and 'Color' buttons as well (they are controlled by the same style push buttons - I just need to add two more relays, soldered to the proper tabs on the M232 buttons)

Step 7: Fastening the Breadboard

The M232 is manufactured with provisions to accomodate different spoke spacing. I used one of these not-in-use slots and zip-tied my populated breadboard to it.

Step 8: Arduino Code

I referenced Ken Shirriff's IR code c/w library. http://www.righto.com/2009/08/multi-protocol-infrared-remote-library.html Copy the library from his page and put in your Arduino Libraries folder. I adapted the sketch to meet my requirements, but did not alter the library. If you do not use an Apple remote, you will have to find out what data is being sent from your remote, which is easily done with the code - open your serial monitor and learn your remote's data.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*Sketch to use a remote to wireless control MonkeyLight M232 bike lights. Credit to Ken Shirriff:
  http://www.righto.com/2009/08/multi-protocol-infrared-remote-library.html
*/
#include <IRremote.h>

int RECV_PIN = 9;                     //pin 9 receives raw data from TSOP 4038
int relayTrigger = 2;                 //pin 2 triggers the relay on or off
IRrecv irrecv(RECV_PIN);
decode_results results;
#define PLAY 2011242632               //pushing 'play' on remote gives me this value; it makes more sense when replaced with PLAY

//setup runs once, at start///////////////////////////////////////////////////
void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn();                //Start the receiver
  pinMode(relayTrigger, OUTPUT);      //set pin for output
  digitalWrite(relayTrigger, LOW);    //open relay contacts
}

//loop runs forever//////////////////////////////////////////////////////////
void loop()
{
  if (irrecv.decode(&results))
  {
    Serial.println(results.value);    //Open serial monitor, and view remote codes. I used the 'play' button on Apple remote = 2011242632
    irrecv.resume();                  //Receive the next value
  }
  if (results.value == PLAY)          //If Apple remote button 'play' is pushed, then:
  {
    digitalWrite(relayTrigger, HIGH); //trigger the relay. This will short the contacts of MonkeyLight 232 power switch
    delay(10);                        //wait for it...
    digitalWrite(relayTrigger, LOW);  //MonkeyLight 232 switch is triggered not by shorting contacts, but by opening them
    results.value = 0;                //if we don't replace PLAY (2011242632) in results.value, the relay will keep switching on and off
  }
}

/*
Using Apple Remote:
2011287688 +
2011279496 -
2011242632 play
2011238536 <<
2011291784 >>
2011250824 menu
*/

Step 9: Putting It on the Bike

Strap the M232 to the spokes as usual. If you strap to the appropriate spokes, with components 'inside' the wheel, you should have no problem. Make sure there are no components sticking out too far, you don't want a relay to snap off when it hits the bike frame, etc.
The AA battery pack of the M232 acts as a wheel balance to the circuit board. Since we are adding weight - mostly the 9V battery - play around to find the sweet spot to balance the wheel. Try to put as close to the hub as possible, or even on the hub.

Once you test it all, you are ready for some night riding!

Some final info:
The push-button switch will still function, with or without the add-ons. So when the 9V is dead, or you drop or lose the remote, you can still control the lights the old-fashioned way: by physically pushing the button.
Disconnect the 9V when not in use - either via a switch or physically remove from the circuit - or it will slowly drain.
And keep in mind the M232 will no longer be waterproof.

Happy riding!

About This Instructable

6,323views

16favorites

License:

More by TheDrewthSayer:Adding Wireless Control to Monkey Light M232 
Add instructable to: