TheRecklessEngineer Posted May 28, 2009 Share Posted May 28, 2009 I'm struggling in finding a part here - I'm hoping someone might have an idea. My idea is this: Around the outside of my speedo I add some LEDs to indicate RPM. Possibly I might replace the needle with more LEDs in a different colour to indicate speed, but this isn't a priority at the moment. I have a PIC doing various bits n stuff behind the dash (mostly to do with the RFID starting system - I'm not going to discuss this here...) so programming it to produce a byte on a port to indicate RPM would be quite straight forward. However, the issue comes with driving these LEDs - there are plenty of bar graph generators out there - but they rely on analogue signals (basically cascaded comparators - I think FridgeFreezer made a rich/lean indicator using these). I want to make these into a bargraph indicating the value of the binary output on the port of the PIC. I can find decoders to turn on a single output relating to the binary input (binary to one of four/eight/sixteen converter), but I want to keep the lower outputs on - i.e. a bargraph. Does anyone know if these exist? Does this post make sense to anyone? Quote Link to comment Share on other sites More sharing options...
MECCANO Posted May 28, 2009 Share Posted May 28, 2009 There are lots of simple d-a converter circuits that would take your digi out put and create an stepped analogue value equivilant, which would be more than fine for your application. I will have to dig out one of my text books but for a quick search: http://www.tkk.fi/Misc/Electronics/circuits/dacs.html This one has the R/2R network, i've palyed aorund with this and it works quite well for its simplicity: http://www.ikalogic.com/dac08.php Just to add, the chip/ led bar driver chip thing enables you to have a solid (bar graph liek you want) by connecting the apparopriate pins. Or alternatively jsut a single bar. To use that chip though, like you say, you need an analogue input first. Quote Link to comment Share on other sites More sharing options...
western Posted May 28, 2009 Share Posted May 28, 2009 Does this post make sense to anyone? Waaay over my head, lost me when you said, binary & PIC Quote Link to comment Share on other sites More sharing options...
TheRecklessEngineer Posted May 28, 2009 Author Share Posted May 28, 2009 Meccano - Thanks. I had considered using a D/A converter, but it seems like a bit of a bodge to me. I've taken the trouble to compute/scale the RPM in the PIC, seems a shame to spoil it all by converting it back to analogue! What I'm really after is some sort of logic system... Quote Link to comment Share on other sites More sharing options...
TheRecklessEngineer Posted May 28, 2009 Author Share Posted May 28, 2009 Aha...I've just had a suggestion from my neighbour. I can use shift registers - not ideal as I'll have to pass the data out serially over time resulting in a time delay - but if I'm running at 20MHz I doubt if it will be noticeable! The advantage is that it will only tie up two lines of a port - plenty left for speed indication, or anything else groovy I can come up with! Quote Link to comment Share on other sites More sharing options...
TSD Posted May 29, 2009 Share Posted May 29, 2009 Why not generate a PWM output, either using the onboard timers, or simply decrement a counter in the main program loop (if the loop has fairly stable timing) or via an interrupt routine. Feed the output via an integrator to the LM3914 (bargraph driver that FF used). That only uses one pin from the micro. Aha...I've just had a suggestion from my neighbour. I can use shift registers - not ideal as I'll have to pass the data out serially over time resulting in a time delay - but if I'm running at 20MHz I doubt if it will be noticeable! The advantage is that it will only tie up two lines of a port - plenty left for speed indication, or anything else groovy I can come up with! Quote Link to comment Share on other sites More sharing options...
TheRecklessEngineer Posted May 29, 2009 Author Share Posted May 29, 2009 TSD - excellent idea, but my program has horrendously unstable timing (mostly due to my poor skill), and I've tied up the PWM output with dimmer control for the LEDs. I've settled on using shift registers - specifically the HEF4894B. 12 outputs, cascadable, will cope with a 20MHz clock, and will sink enough current to drive an LED directly. Sorted Quote Link to comment Share on other sites More sharing options...
MECCANO Posted May 29, 2009 Share Posted May 29, 2009 Meccano - Thanks. I had considered using a D/A converter, but it seems like a bit of a bodge to me. I've taken the trouble to compute/scale the RPM in the PIC, seems a shame to spoil it all by converting it back to analogue!What I'm really after is some sort of logic system... But in the end all your doing is switching on some Leds, it's not exactly space age! Quote Link to comment Share on other sites More sharing options...
RangeyRover Posted May 30, 2009 Share Posted May 30, 2009 I used to love programming pics! Use whatever system takes the least pins from the micro. The resolution of this led display is what? one led per 500 rpm? elegance and accuracy in program design count for nought if your output device has poor resolution It's not a criticism of your aim, but be pragmatic abut the system you use. In PIC programming the best solution is usually the one using least pins on the output, as they have relatively few outputs anyway. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.