12v RGB LED Strand Button configuratoin

So, I have no idea how to properly word out in a search what I am looking for however, I figured in a forum I could take the mockery of poor google searching and simply ask my question here. :slight_smile:

Ok, so to put this simply I need two states; Red and Green.
Application is for my motorcycle. My state requires that the lights be green when accelerating and red when braking.

I can easily wire up red to the breaking circuit (12v when brake is applied) however, this is illogical as I would have to treat the common ground for my red and the positive feed from the brake as my control.

What i'm hoping is to start small and figure this part out with your wonderful assistance. I want the green to be on so long as the bike is on (constant "12v" supply) There is no alternator as this is an electric bike so my lighting is on a 12v circuit away from my main battery pack for the bike (72v). When I pull the brake I need the green to turn off and the red to turn on.

eventually I will replace my blinker method with this as well (yellow) and when the blinker feed as a signal it will cause the left or right side to blink yellow instead of glow red or green.

any help would be GREATLY appreciated with this. thank you so much for your time!

(the led strip is a 12v 5050 rgb smd led strip

Roy D

currently i have the strip configured like so

only as a test I have a temporary push button (to simulate the brake). only, I don't know how to safely connect this push button to the 12v line in feed to treat it as a signal (one pin is connected pin 2 on arduino).

Simplest for the current requirements, would probably be a double throw switch.
Green connected to Normally closed, and Red connected to Normally open. Of course, no connection if key is not on!
When switch is pressed, Green goes out, and Red turns on.

Does that make sense?

not exactly no....

would this be done with a mosfet N transistor type?

also, this is just the learning bit of the arduino setup that I would like to use for future projects involving this.
(such as the turn signal control etc)

thank you for the prompt response btw!

I did not realize it was to learn arduino, sorry for my misunderstanding.
Then, how about a button(switch) on pin 6, when it is not activated, output to pin 7, which sends a HIGH to a n-channel Mosfet, that drives the green LEDs.
When button on pin 6 is activated, turn pin 7 LOW, and turn pin 8 HIGH, sending a HIGH to a n-channel Mosfet, that drives the Red LEDs.

Did that make sense?

is that safe with the 12v supply? (for the arduino)

i'm trying to see this all on the board. (still very new at driving the lighting). really it's been just the last couple hours. first little bit was figuring out how to power the lighting (that worked fine with some sketches it pulsated through the colors just fine). but button attempts all failed. :frowning: I think it has to do with "what pin goes where" and I'm not putting the pins in the right place. as well as the code to run it. :confused:

Yeah, w/o arduino I was able to get the red to kick on and off...but only single color.

after thinking about it...I could essentially build a car to usb adapter (most if not all designs take into account that the car has 11-13 or 10-15v available due to the alternator). and use that to down convert the 12v signal from the brake line from it's current 12v current to the 5 stable needed as a signal.

In that regard, how do I use a push button to replicate this while still telling the 12v led to power on and off upon press/depress of the button? (The layout of the circuit board and required resistors?)

I thought I went into depth in my post # 4.
Which part of post # 4 did you have questions about?

I mean this in no disrespect, but to an untrained person such as myself that was indeed not in depth. it simply left me with better guided questions. :slight_smile: I will succumb that it is still very helpful. but schematically speaking...not. My largest question is in regard to the push button. 4 pin...top left being 1 top right being 4...which pin would connect to where?

I believe the button pin 3 goes to ard pin 7. pin 1 goes to 5v and pin 2 goes to shared ground (shared with the 12v power supply too?) with a 10kohm resistor?

And even then, in the diagram I linked to earlier, is that an acceptable configuration for driving the LEDs?

thank you. :slight_smile:

I also mean this in no disrespect. Your wanting to learn about arduino, so rather than jumping into a complicated project, start out running the examples. One example "Button" may be especially helpful.

What do you have to work with, arduino, resistors, LEDs, switches, volt meter, mosfet, etc.

I am happy to give you guidance, but not to design and code your project.
Stick with it, and be patient, you will learn, and enjoy.

I did the 15 project kit that came with my setup. (only the photoresistor segment I was missing one of the gel covers. :frowning: so I couldn't do that one exactly). and as helpful as that portion is it doesn't deal with an outside source other than the motor, however, that is driven very differently from led setup. :frowning:

I have the mosfet (working with LED rgb color change effects loaded directly to the arduino). I have the 12v rgb LED strip (which supports 9-24v...just not 14v+ on white alone as that can melt the solder of the led connections unless attached to a heatsink). I have resistors, diodes, and even a nifty little voltmeter. :wink: standard electronics I have a general hang of. (I have a custom functioning electric motorcycle)...to which I didn't have to do any programming other than modifying the controller via very poor software for voltage regulations to the motor).

The arduino side of things is a bit new to me. I'm already comfortable in vbs, vb, and ps though and the coding is a bit easier with that background.
if then else statements are standard. :slight_smile:

just working with the board and what it senses and how to interact safely with it.

I have tried getting acknowledgement out of the button press...but for some reason it isn't working for me. even telling it to write something via serial still no go. :frowning:

Well great, you have a good bit of experience. Sounds like you just a have a stumbling block here.

Did you mention the button had more than two wires. That could be a question. You need to test it with your ohm meter, and see which wires short together when you press the button. I assume you just need to know if the button is pressed, or not.
What question/problem are you having now. Small steps.

BTW, I sold my gas powered motorcycle about 3 years ago. I sure would have liked to had an electric one, but I think I am getting to old (65) for such danger. Hope you enjoy yours!

I wrote a longer response...but for whatever reason my session needed to restart and it lost my message. :frowning: ok, well anyway...essentially it's a motor driving by a potentiometer (throttle). mine is 72v and controlled by a very basic (but very expensive) control board.
You don't have to go far. but they are fun! :slight_smile:

anyway, this is the push button that I am using.
http://arduino.cc/en/tutorial/button

I believe pin 1 (top left straddling the center of the board) which has the positive, is connected to the pin 3 constantly. upon pressing the button it connects the whole circuit to pin 2 which gives it the signal...I believe. :slight_smile:

indeed the problem is very small and I feel like an idiot because the first thing we did in the practice booklet was get a reaction from a push button (the one above). and now, for whatever reason, with how I have it wired, I am not getting a reaction. :frowning:

I believe pin 1 (top left straddling the center of the board) which has the positive, is connected to the pin 3 constantly. upon pressing the button it connects the whole circuit to pin 2 which gives it the signal...I believe. smiley

Sounds like you have not tested the button with an ohm meter. Those buttons with more than 2 pins can be tricky, and if not wired correctly, will cause problems. Test it to make sure.

ok....so, i'm grateful I ordered two arduino's (the nano v3.0 and the uno with the starter kit) I plugged the pins that were in the uno into the nano (2 to 2 5v to 5v and gnd to gnd on the nano)...pushed the button press with serial count output and it worked instantly. maybe there is something wrong with my arduino uno? or maybe my atmega chip on the uno? ugh...i'll have to do consistency checks on it...but at least I have THAT part figured out.

so, in your opinion (which is actually very helpful and highly valuable and if anything comes of it I'll be sure to remember in an appropriate gracious form). Would you suggest a "physical" switch between the red and the green? By use of mosfets (like the AND and the NOT gates similar to that of a solar yard light) or should I use the arduino for this? I want to learn more on the arduino anyway for build of a smaller controller.) I can use a car usb adapter to control the voltage output and keep it at the 5v 1-2 amp (really 1amp max would be all i would need i would assume to act as a signal).

thank you again for this. I felt like a moron not even being able to do button test. >_<

ok, so pin 2 connects to pin 4 on the atmega. top and bottom of the atmega (solder points) connect just fine. so maybe the atmega internal is bad? however, when connected via usb the 5v output pin only pushes out 4.5v. it sits at 4.8v from the power pints and 2.44v from the data pins of the usb (after connection is made to the arduino uno). however, that is what the mosfet and other components are for on the board...boost it and keep it at 5v. however, i don't think that is directly the problem. any suggestions on how to debug if the atmega is actually bad or not?

I'll play with the little guy for now instead since the big one isn't responding well. :frowning:

oh man! that was SO much faster after realizing my uno board was bad. >_< so freaking excited! I got the red and green to power switch in a few small lines of code, got everything else good and running smoothly, minus one small detail. the red, green, and blue lights are on simply when I supply voltage to the board. they aren't being keyed on. so i'm assuming something somewhere is giving them voltage from the main power supply. I'll have to trace that around. what do you think would cause these lights to still draw power without the signal call from the mosfets?
I'm using this diagram for powering the leds

pulling out the mosfet I see that the power still goes through...maybe I have a dirty ground somewhere? i dunno, i'll trace it out tomorrow. i'm just excited that i have the red and green doing what I want. ^^ ready to prep for christmas colors too! :slight_smile: lol ><

I have been out of pocket for a couple days, and have not been available to reply.
You think the uno is bad. Did you try some basic examples like blink?

Your led strip stays on without the control pins?
Mystery to me, maybe that strip is designed to do that. Not all strips are created equal. Or, maybe you have wired it wrong?

no, strip doesn't do that when it is connected to micro led controller (IR). only on my board. maybe I need a diode? or to move a resistor somewhere or something? without the mosfets it still lights up with only power. (it is very dim...but very noticeable still...plus,a draw is a draw that I don't need when supposed to be "off"

I did some very basic tests that required input for output. it's the input that is having a problem. so the button push test for instance. it should yield a serial print to the system...it does not.

but on the nano it does just fine. :frowning: maybe I need to change out the atmega chip?