Disclaimer: I know VERY little about the world of electronics. I’m trying to change that. In fact, many of you inspired me to purchase an Arduino starter kit so I could “learn by doing.” I’m on Arduino project #3 of 14. I’m an older guy who is enjoying the kit as I needed a new fits-in-an-RV hobby. I want to add two larger, easier-to-see tail/brake lights to the rear of my motorcycle. The existing tail/brake light is actually a group of LED’s. The motorcycle’s canbus changes the voltage it sends to the light based on its function. When acting as a tail light, the canbus directs 1.2 volts in to the light. When used as a brake light it boosts it to 12 volts. This project would be easy if I could just tap a few wires and bolt on some lights. However, the canbus is very sensitive to any increase in load. That means I must use a relay to get the job done. Easy enough UNTIL it comes to energizing the relay’s coil. The tail light comes on as soon as the key is turned to the “On” position. Again, tail light runs on 1.2 volts. As you can see from my diagram, http://tinypic.com/view.php?pic=2dhiglv&s=6 I have a problem with the voltage traveling through “Node 1” when I don’t want it to. That brings me to my question… Is there some type of electronic gizmo that will act as a switch based on voltage?(does that make sense?) I want the current flow to be zero when the input is lower than, say, 10 volts. I only want the relay’s coil to receive juice when it’s time for the brake lights to come on. What’s happening right now is that the relay buzzes as soon as I turn the key to the “on” position. No surprise…it has 1.2volts going through. Not enough to trigger the relay but enough voltage to tickle the coil. My point was that there is always electricity traveling in what I have labeled in "Node 1" and I want to add some type of "switch" to turn that node on and off. I want that switch to be based on voltage: off <10 volts; on >10 volts. I was hoping there was some type of transistor or voltage comparing device; some small, cheap electrical component to place in that node. I know I can use the Arduino but it's very large & expensive for the place I'm trying to work with. I tried to do some research but I’m fairly clueless. I’m not even sure if I used the proper symbols or connections in my diagram. Any help would be greatly appreciated. Many thanks! |
by Markobaldo
September 11, 2012 |
How about an op amp that works as a comparator? |
by lab325
September 20, 2012 |
Thank you very much for replying. It's my understanding that an op amp would multiply the voltage difference of the two input voltages. Not sure how that could be used to switch the current off in Node 1? Thanks, Mark |
by Markobaldo
September 20, 2012 |
Welcome to and please use the power of CL. Rather than post a picture, can make your circuit public or unlisted and post the link to it here. Then people can play with your idea to see if it can be modified to make it work. Questions: i) Are you measuring the voltages directly across the bulbs? ii) Are the bulbs filament or LED? :) |
by signality
September 21, 2012 |
ii) Sorry, you've already said the existing lamps are LEDs ... what type are the ones you want to add? |
by signality
September 21, 2012 |
Do you want the extra light to replicate the tail/brake light brightness or just turn on when you brake? |
by signality
September 21, 2012 |
Do these help? and |
by signality
September 21, 2012 |
Signality,
Thank you sooo much for taking the time to help me. I truly appreciate your effort to create a circuit for me. Yes, Yes...they do help. I'll be purchasing the necessary components next week. I may have a few follow-up questions. |
by Markobaldo
September 21, 2012 |
I don't want to be a wet blanket but ... Bear in mind that these are sketches not fully developed circuits. They can be improved to make them much more robust in terms of short circuit and reverse voltage protection. In their present form, you will have to allow for the MOSFET to dissipate power because the dv/dt of the 1.2V to 12V to 1.2V transitions may be slower than those in the sims so the MOSFET turns partway on and off rather than switching fully on or fully off very fast. Look at what happens if you use a PWL() instead of a PWS() source and make the voltage transitions slower. For help on PWS() & PWL() see: https://www.circuitlab.com/docs/expressions/ More gain between the zener and the MOSFET gate or even a comparator rather than a simple zener driving the gate would fix that. Something like: Thrown together in a hurry and not properly tested so check it carefully in simulation with slow edges using a PWL() source as suggested above. Check the volts, current and power dissipations carefully in the sims and choose your components with generous margins. Motor vehicles and their electrics are neither kind to or forgiving of electronic components. |
by signality
September 21, 2012 |
If I'm using a relay (as in your first diagram) why would reverse voltage be an issue? Doesn't the relay's coil act as an isolator from the rest of the circuit? |
by Markobaldo
September 21, 2012 |
Hi and sorry for jumping in here. I’m not a techie and also new to CL, so take care. @Markobaldo: I’d not touch my bike electronic at all. Where I live it would be unlawful, you’d lose permission to run it and also your insurance, too. Your life may depend on working tail / brake lights. There are heavy mechanical vibrations of nearly all frequencies and the supply voltage is extremely noisy. Rain and UV radiation … OK. Markobaldo wrote: "The motorcycle’s canbus changes the voltage it sends to the light based on its function. When acting as a tail light, the canbus directs 1.2 volts in to the light. When used as a brake light it boosts it to 12 volts." I doubt the 1.2 volts. For LED’S more likely the signal will be a 12 volts PWM signal with, say, 10 % duty cycle, so your relay “buzzes”:1.2 volts DC it wouldn’t really notice (you are thinking about a heavy duty relay with permission for vehicles, aren’t you?). The LED in your circuit must be a special LED for 12 volts as it is used in replacement “bulbs” for motorcycles, the current often is about 300 mA (4 W). What about a (Darlington?) transistor to switch that load? But the chassis is usually negative, you’d have to switch the positive side. Regards, Sancho |
by Sancho_P
September 23, 2012 |
"Doesn't the relay's coil act as an isolator from the rest of the circuit?" To see why it doesn't, ask yourself what happens to the MOSFET, M1, if you reverse the battery voltage, V1. Remember that V2 is ultimately derived from V1. Reversing V1 will pass a huge, uncontrolled current through M1 (MOSFETs have a parasitic diode in parallel with the source/drain connection, though I'm not sure if this is modelled in CL) and D4. A reverse voltage will probably destroy the LEDs too. If CL does model the parasitic diode in M1 then you should see this if you run the sim with V1 (& V2) reversed. You could even replace V1 (& suitably edit V2) with a PWS() source that starts off at +12V and then switches to -12V some time after the start of the simulation. Better still, do the PWS() thing with V1 and edit V2 so that it multiplies V1 by a suitable scaling function to generate the required 0V, 1.2V, 12V sequence. That would generate the voltage from V2 based on what V1 is doing but scaled by a time varying control PWS() voltage. See: https://www.circuitlab.com/circuit/hsss64/pwl-type-source-can-be-used-as-part-of-expression-01/ for some idea of how to do this sort of thing. |
by signality
September 23, 2012 |
@Sancho: I hear your concern about messing with the motorcycle's lighting circuit. I agree. That's why I'm using a relay triggered by the OEM brake light. The only add'l draw I'm placing is related to the relay's coil. Certainly not enough to cause harm. The OEM brake light is ridiculously small; unsafe in my belief. Thanks for your suggestion regarding the Darlington Transistor. I'm unfamiliar with that but will do some research. @Signality: Ah yes, so true. Wouldn't a simple diode offer the protection I need? Thanks for your patience! |
by Markobaldo
September 23, 2012 |
@Signality: OOPs, I posted my reply too soon. I just went back to your circuit diagram & noticed you placed diodes accordingly. Thanks. |
by Markobaldo
September 23, 2012 |
@Sancho could well be right about the possibility of the voltage across the lights being pulse width modulated (PWM). I'm not familiar with CANBus lighting and I've not found a good resource for it on the web yet. PWM makes sense; low losses and that's why LED lights can be seen to flicker in peripheral or glancing vision ... If it is PWM then you cannot use a relay, it's too slow. However, the circuit: https://www.circuitlab.com/circuit/k4hwhp/ should work with a PWM source. You can check this by replacing V2 with a 0 to 12V pulse source. You may not need the zener diode in series with the gate then. Then you need to beware the possibility of generating EMI due to the switching currents and voltages in/on your extra wiring! You could blot out everyone's radio, TV and phones or even your own electrics every time you apply the brakes. |
by signality
September 24, 2012 |
@signality: I think due to your circuit I understood the PWS() function (thanks!) but it is not what’s I assume to be the wave form. The CAN bus module could only switch on or off, nothing in between, to avoid power dissipation. The CAN bus module will also take care of “off - resistance” and “on - current” to check if the LEDs are still OK. Your circuit will work, though, but will reflect tail light + brake light (but I think this is what Mark wants). However, the “bulbs” are all negative grounded (heat sink, 4 W), so you have to switch the hot, positive wire, you can’t switch the “ground” (usually, with fabricated sockets). Instead of the LED you could switch the relay, but this will not work directly with a PWM signal (?) and would work only as brake light. OK, now I think I’ll try to add my first public sketch here to show what I mean … ;-) Mark, are you still stuck at the relay solution? Make sure to think about a heavy duty relay: http://www.r1200gs.info/howto/relay.html But: I’m afraid it would not work directly - let me try to explain ... As I wrote above in my first posting: I suspect your 1.2 volts signal is not simply a DC signal, but a square wave signal with e.g. 100 Hz and a duty cycle of about 10 %. So it is 12 volts for 1 msec, 0 volts for 9 msec, then again 12 volts for 1 msec, 0 volts for 9 msec and so on. Thus your meter would read only a fraction of the 12 volts when measuring DC voltage. You see 1.2 volts when your meter is set to “DC”? Before going one step further make sure that I am wrong (!!! ?): Try to switch your meter to AC: When you still read a voltage above 0.5 volts (don’t start the engine at this point) this would indicate that it’s not straight a DC voltage but a PWM signal. Regards, Sancho |
by Sancho_P
September 24, 2012 |
Well, I've learned something from you about CanBus in vehicles. :) https://www.circuitlab.com/circuit/k4hwhp/ works with a PWM source but obviously not with a grounded load. Here's a version that works with grounded LED's and a PWM source: |
by signality
September 24, 2012 |
@signality: I’ll check your circuit tomorrow. Please have a look at mine, something seems to be wrong? Could you adapt it using a MOSFET? Regards, Sancho |
by Sancho_P
September 24, 2012 |
WOW! I was following along for a while but now I'm in over my head! You two are champs! I truly appreciate your dedication to this dilema. Thanks so much. Sancho, I hope to try the AC test you posted. I must be frank; I have buried my circuit below several layers of panniers, pannier racks and fairings. Reaching the circuit will requiere some disassembly of the motorcycle. BTW...the link you sent of the relay was the EXACT link that piqued my interest in the first place. I, too, have a BMW, albeit a different model but the electronics are the same. Not sure I mentioned this but we are full-time RVers. Yes, we live on the road. On Wednesday, we'll be heading into the backcountry relying on our solar panels for power. I hope to have Internet access. All the best, Mark |
by Markobaldo
September 24, 2012 |
Your circuit does work driving the LEDs ... And this is it with a MOSFET (not far from my last - now slightly edited - effort but with slower MOSFET turn on and off which may be good for EMI but may be bad for MOSFET power dissipation during the edges): Note simplified PWM source using PWS() source (it's what they are intended for). :) If you are set on using 19th century technology (a relay) then you cannot uses any of these circuits. First you will have to average the PWM signal to extract the mean DC level and then either: i) if you want to just turn on brake light repeater LEDs: compare that voltage against a reference voltage using a comparator and then use the comparator output to drive the relay to switch the LED on and off; ii) if you want to switch between separate tail and brake repeater LEDs: do the same but use a change over relay; However, if you want to use the same LED to show tail and brake light intensities, then you cannot use a relay. If you are happy to ride into the 20th century then you will need to take the mean DC level and use that as the input to something that either looks like the output of a voltage regulator or a pair of high power constant current sources (one for the LED on each side) to control the voltage across or the currents through, the repeater LEDs. In both cases you will have a lot of power dissipation in the voltage or current source driving the LEDs. A completely electronic solution based on simply buffering and reproducing the PWM output - with no relay - is far simpler, cheaper and if well constructed, reliable, especially for a motorcycle (speaking as one who rode Guzzi's for many years). :) |
by signality
September 25, 2012 |
Thanks for the MOSFET, this seems to be simple. I don’t have any experience with MOSFETs. Unfortunately they can’t be found in defective CFL’s (we have a lot of these environment - bombs here). AFAIK the power dissipation is no problem with the MOSFET, even without extra cooling, very low voltage drop, very short time, so ... (?). (Reverse voltage and other) protection parts: Hmmm. What isn’t there simply can’t break. Connect it wrong and you will blow it. Learn. Repeat. Learn. But you are right, one should think about. The PWS: OK, elegant, but I prefer the switch because it will better “visualize” the brake switch. However, the long terms in brackets destroy the circuit in each and every case, it seems there is no option to eliminate the formula from the drawing? How do you define the points, I mean, all the ,,,,,,,,? . But the worst is the “Time-Domain Simulation itself. I may understand a bad Darlington model in this early (?) stage, but: How come you need a label to connect the LEDs? The smaller load resistor will slow down? On a simple transistor? Does this happen often? Or similarly with other parts of circuits? I think this is a very basic issue. Is it on a bug list? Is there any? Do they listen? I mean is it worth to … ? Sorry, I’m new here, too many questions, no problem if you don’t find time for all of them. Thanks anyway for your help, now I will restart my own CL project where I had troubles (timer 555). Drop the relay. Take your time. I’d love to see you with your soldering iron on solar power ;-) Regards, Sancho |
by Sancho_P
September 25, 2012 |
Sancho, I had to laugh!! "If you are set on using 19th century technology (a relay)" What else would you expect from an old guy! However, I am willing & eager to learn new tricks. I think it would be good for me to expand my thinking to include a more modern approach. Your suggestion in section (i) seems to make sense to me though I know nothing about setting up a volage comparator. Again, the two Vin's that I'm dealing with are 1.2v & 12v. I only want current to flow with 12 Vin. as I'm all set with the tail lights but only need to activate 12v brake lights. |
by Markobaldo
September 25, 2012 |
"AFAIK the power dissipation is no problem with the MOSFET, even without extra cooling, very low voltage drop, very short time, so ... (?)." Check the power dissipation in the device during the rising and falling edges. The peak power dissipation can get very high when there's current in the device and voltage across it: can be enough to damage it. "However, the long terms in brackets destroy the circuit in each and every case, it seems there is no option to eliminate the formula from the drawing?" Sorry, I don't understand your question. The circuit simulates OK. You may just have to wait for your browser & machine to work through the sums. "How do you define the points, I mean, all the ,,,,,,,,?" See: https://www.circuitlab.com/docs/expressions/ ========================= PWS(t1,x1,t2,x2,...) Piece-wise step signal with value x1 at t=t1, and so on, changing in stepwise fashion at each timestep. If t1 is not 0, then the point 0,0 is implied. All t1...tn must be in ascending order. All tn and xn must be fixed values -- they can not contain further computation. ========================= Look at the times I've put in and compare them against the times in the sim (which maybe you can't see because you can't run the sim?). "How come you need a label to connect the LEDs?" The label sets a net name. two nets with the same name are connected => net name = wire connection. :) "The smaller load resistor will slow down? On a simple transistor? Does this happen often? Or similarly with other parts of circuits?" Welcome to the world of simulation! Bug list? https://www.circuitlab.com/forums/support/topic/8s9n9hav/how-to-use-the-circuitlab-support-forum/ The people at CL are improving it all the time but they have a very long to do list. |
by signality
September 26, 2012 |
Thanks, I really appreciate your full reply to me as a beginner. Sorry, I haven’t been clear. I’ve read ( and so far understood) the basics of the “expressions” - help, and also the sticky “How to use the forum” thread - I wanted your personal “how to” (as the most experienced and knowledgable user here, I’ve read most of your circuits / postings). And I don’t want to hijack Markobaldo’s thread - but I think I did already (sorry, Mark). Again: The expression in brackets quickly goes up to the length of two or three resistors in the circuit diagram, overwriting other values - this is a mess, very ugly and doesn’t help at all to understand what’s going on. On the other hand the field in the property window is ridiculously small (it is not expandable in Safari). So my questions are: a) Can you disable the (expression) display in the circuit (and substitute instead a formula symbol like “f(t)” or so)? b) How do you personally evolve / define / edit (sorry, my English …) such expressions? Good old times, a sketch on paper and counting when you type them in or … ? In my browser (Safari) the field is too small to see where to edit, it’s a pain , even after copy / paste from a text editor I don’t know where I am to edit … c) I understand the label / node. Fantastic, absolutely. But here this is an embarrassing workaround, a shame if it is necessary (do you think it is, as it doesn’t really help in speed, but I have to dig in deeper ... ?). d) I can run the simulation, no problem. However, I can see the severe issues of the time-domain simulation when varying the value of the load resistor. I can see the estimated time going up and down, first in some seconds, then going up again in the minutes, the percentage fuzzing around, no end in sight. This is an extremely simple two transistor circuit without cap or ind - It took me several copy / delete / modify actions to see why the simulation did not run easily: Not because of my bad circuit, but because of a flawed sim design. And there is no warning or hint what could be the reason for the dubious time estimation and real duration, this is very strange with a couple of simple parts in the circuit and estimation about 10 minutes. I have tried the same using Firefox 12.0, but I don’t like the circuit editor when using Firefox. “Welcome to the world of simulation” Two transistors, five resistors, really ;-))) I’m feeling like a rising star now ;-) ... Ooooooh! Adapting the circuit for Markobaldo’s needs now I run into the same difficulty as with my 555 circuit. But I think I’ll start a new thread because it’s fully off topic here, please check the forums (but I have no time today). ........ Hey, first time you are going into details: “I only want current to flow with 12 Vin. as I'm all set with the tail lights but only need to activate 12v brake lights.” Great. In case I’m right with the PWM (AC) signal: 1) Don’t try to use a simple LED, you will burn it, go to your dealer and ask for a 12V bike LED. There are plenty, ready to use as extra brake light. 2) Drop the relay - idea. You need electronics anyway, the relay would be superfluous. 3) Check my adapted circuit, now with MOSFET (following @signality), to switch the extra LEDs ON only when the original brake light is fully ON. 4) Some component values may depend on your PWM (AC) signal, feel free to come back here to discuss. Regards, Sancho |
by Sancho_P
September 27, 2012 |
More on (b): You can construct a time & voltage sequence using LibreOffice Calc (or any other spreadsheet) then save or export it in CSV format. Paste the CSV contents into the expression like this: PWS( put it in here ) or PWL( put it in here ) and off you go. It doesn't even have to be along just one spreadsheet row because CL seems to ignore CR's in the expression for a PWS() or PWL(). |
by signality
September 28, 2012 |
Sancho, Thanks. I'm currently parked in the desert with a poor Internet connection. Thanks so much for the diagram. I plan to purchase components when I reach the "civilized" world. I assume wiring the MOFSET will be a straight-forward procedure. I also assume the item #'s listed in your circuit will be the same I use to order. Many thanks. I'm grateful to have this forum. Mark BTW... no worries about the "hijack" as I've learned a lot! |
by Markobaldo
September 30, 2012 |
Whoa, steady. Your circuit is close but fails if the max duty cycle with brake lights on is < 100%. This is what happens if the duty cycle swings 10% to 90%: This: fixes the problem by simply averaging the PWM signal. Note increased R3 & R4 values to reduce load on low pass filter and set trip at approx 6V (50% duty cycle). However, as I explained before, you may need more gain to speed up the MOSFET switching edge. This: is a circuit which uses a comparator to give you the necessary gain. It does not actually show a comparator because the CL comparator model is for a fixed 5V output whereas we need a rail to rail or an open drain/open collector output. In this circuit, the CL comparator, CMP1, is replaced by a behavioural model of an open collector or open drain output comparator using a voltage controlled switch. A small amount of hysteresis has been added to prevent the LEDs "fizzing" near the switching points. However, all these circuits with low pass filters and comparators completely miss the point. All you need to do is to replicate the PWM signal being applied to the original Stop/Tail light LEDs and apply that to your additional LEDs. Anything else just overcomplicates things and obscures what you're actually trying to achieve. The above circuit with C1 and R14 omitted or this: or this: will do the job fine. See "A design process" in: and then use simulation to test every possible condition to try to ensure your circuit will work as you require in the real world. Think very hard about what those conditions might be. It takes a few hours to source, buy and assemble all the bits to make a project. It takes about 10us to completely destroy it with no second chance of seeing what might have gone wrong. You cannot destroy a simulation: don't be afraid to use it. :) BTW: To see how the PWM source works: |
by signality
October 02, 2012 |
Thanks. What you said is sooo true about destroying things in a μs. My plan is to use the simulation feature but also to purchase the components and set up an off-bike trail set up. Thanks for everything, Mark |
by Markobaldo
October 03, 2012 |
Deep joy. |
by signality
October 03, 2012 |
Please sign in or create an account to comment.
CircuitLab is an in-browser schematic capture and circuit simulation software tool to help you rapidly design and analyze analog and digital electronics systems.