Very first arduino project help.

So i purchased my arduino uno about two weeks ago, and since then the only significant thing i’ve done with it is make an L.E.D. be able to turn on/off and change it’s brightness. I really want to get going with it, and have decided my first project to be a bike turning light signal/brake light system. So i figured to start my project i’d get some help from people who are already very familiar with the arduino and electronics in general. Since it is my first project, i want to do as much of it as i can on my own, but was hoping you guys could “guide” me in the right direction and give me a hint or two on figuring out how to layout this whole idea.

I’ll start off by saying i already know a good amount about electronics (what voltage is, current, watts, ohms law, different components etc. etc.), but i don’t know much about the arduino sketch program. I bought the starters book, but that really hasn’t helped me out. My idea was to make it so when i hit a momentary switch (for the right or left side of the bike turn signal) the signal will start to blink. It will keep blinking until i turn my wheel, which will have exposed wires positioned that they simply “brush” against each other when i’m turning. As i’m turning it will still be blinking but when i return the wheel back to going straight the wires will brush again and the second time will mean that the turn is done and the blinking will stop. In total three exposed wires; one that is moving (ground) to make contact with either the right or left wire, and the two other wires that corresponds to either turn signal. I also want to make it so when i pull on either of the brakes, a new set of red lights below the signals would light up. Five L.E.D.s would make up each signal, forming an arrow like this: < > , and right below would the the red brake L.E.D.s in this layout - - .

So now that you know the basic idea of what i’m going for, any suggestions on how to get started with the code/wiring things up? And if you need any further information i’d be happy to reply asap.

First I suggest using standard switches & LEDs to work on the code before you try to make it work with your setup. Start with very basic code and build up. Also look at example code, however if you are just starting programming start with the simple examples. The more complicated the function and the larger the sketch, the more difficult it will be to follow.

Wire the switch with a pullup resistor and the switch to ground so the voltage at the input pin is high (5V or 3.3V) when the switch is open and low (0V) when the switch is closed. If you run out of digital outputs for the LEDs you can use analog pins for the switches, but it is a little simpler to use digital pins configured as inputs.

You can drive LEDs directly from the digital pins (configured as outputs) with about 1K Ohm current limiting resistors. This will allow you to work out the code, then you can make the final hardware on the bike.

If there are specific questions about how to do certain things, please ask. In general, look at the lowest level functions you will need (read a swich, turn on an LED, control the on time and off time etc) and work on them individually before trying to make the whole project work together.

Good luck, Steve Turner

Perhaps only one 'switch' is needed on the wheel; a switch detecting if the wheel is in the 'straight' position. If I am following your intent correctly, it is not necessary to have a 'switch' to detect when you are turning since the momentary switch you depressed says 'I am turning'. You only need to have something (the 'straight' switch and code) to say 'I am done turning'. The code could be written so that the flashers (either left or right) continue to flash until the 'straight' switch is activated. - Scotty

The code could be written so that the flashers (either left or right) continue to flash until the 'straight' switch is activated.

Well, first deactivated then activated.

You should be signalling before starting the turn, to the straight switch should be closed when you start signalling. At some point after than, you begin the turn, so the straight switch is opened. At some later point, you end the turn by straightening out the wheel(?) and the straight switch is closed again. It is at this point that you want to stop the blinking.

You'll need to consider what happens if you change your mind about turning, or accidentally hit the turn signal switch. You don't want to blink the light for the next 67 miles, or have to make an unnecessary turn just to get the damned blinker to stop.