Well, I wouldn't explain in details how it works (I just give a few hints at the end), because I mostly used the "make up some values, simulate, adjust, simulate, add a diode, simulate, drink a beer, simulate, start again from scratch." strategy, and didn't write a single formula, so I can't justify everything that is here (and it can certainly be improved). All three leds are driven with a current that looks like the "Alternative cross-fade strategy for even brightness" curve above (love those diagrams, really). Requiring only a quad-opamp chip and some passives ! Runs from a 7-32V supply (well, I think - maybe a few resistors needs to be adjusted). While I agree in every sentence of transistor's answer, and consider it the best answer you could make (and I couldn't upvote it enough), the comment "I agree that analog takes more head scratching and I started to doodle but realised that it got complicated very quickly. Alternative cross-fade strategy for even brightness. You don't need the plateaus particularly if you want an even brightness (100% red + 100% green will be bright compared to red and green separately). Note the slightly wider black gap in the 12 o'clock position which offsets the patterns by the required 1/4 of a step. The other two will contact the "teeth" on the 'A' and 'B' segments in quadrature. One is always in contact with the common strip at the bottom of the photo. The rotor has three connected contacts 120° apart. Note the clever arrangement of the contacts in Figure 6. Source: an interesting disassembly article on Efton.sk. Innards of the rotary encoder portion of an encoder / pushbutton. Note that the micro's internal pull-up resistors would have to be enabled and some debounce logic required in the code to prevent spurious counts due to contact bounce.įigure 6. E.g., rotating knob un-pressed changes colour as discussed above. With this you can now do much more sophisticated control. The encoder has a third contact that makes when the button is pressed. your code compares become integers and avoid the 16.667 multiples Choose a maximum count value to give the resolution / speed If (count < 0) count = 100 // or your value for maximum count. Assuming the micro analog in read or encoder counting from 0 to 100 and the analog outputs put out 0 to 100 the code would look something similar to the pseudo-code below // RGB LED cross-fade control pseudo-code. This would be a little complex to do with an analog circuit but easy enough with a micro. Note that you can't get white light with this setup as you would require all lights on.
0 Comments
Leave a Reply. |