not sure what to use---out of my league

Status
Not open for further replies.

seanbris

New Member
Well, I have definatly dove into the deep end. Its been years since I have messed with electronics but I am a quick study so I will grasp pretty quick. Here is the project.....oh yeah, must be very small.

5v source
1 momentary ground input--button being pressed
I need 3 outputs that do 2 things.
1) light appropriate led for which step we are on...1,2, or 3
The light needs to stay lit for what step we are on.
2) send a specific voltage out (2.23, 3.18, 4 volts dc)

I know this is way to basic of an explanation but like I said...I have done in a little deep. I have been looking through stuff and a PIC looks promissing as I could program a loop to do the above but how I regulate the voltage out of it still baffles me.

Any advice....other than quit of course.

Thanks,
Sean
 
So the light is supposed to indicate what voltage is being put out? Well I'll assume you know how the LEDs light using a PIC.

For the voltage out, that depends on how much current you need (and how many different voltages you need). If it's just a voltage with neglible current then you can use a DAC- the simplest of which is getting your PIC to send out a PWM pulse through a low-pass RC filter. You can get a bunch of voltages out like this as long as they are within a certain range (usually slightly more than GND and a bit less than your PIC voltage).

For real currents (like actually powering something else) you're probably going to need some regulators and transistor switches controlled by the PIC to switch their individual outputs between a common output. But that only works for a few finite voltages. If you want something that can put out a lot more, then it's really messy. I would think you would need some kind of adjustable switching regulator that can be controlled by the PIC to adjust the output voltage. Probably not a problem if you know how to build switching regulators since it's a minor change, but I bet if there are commercial products out there that do that, they are very expensive.

Or you can hack a switching power supply from Dimension Engineering- that is get their AnyVolt Mini and rip out the adjustment potentiometer and stick in a digital pot to be controlled by the PIC. Or you can look at their AnyVolt.

EDIT: Oh, I'm being stupid. I forgot they have adjustable linear regulators. Just instead of a fixed resistor use a digital potentiometer and you can adjust the output voltage.
 
Last edited:
dknguyen said:
So the light is supposed to indicate what voltage is being put out? Well I'll assume you know how the LEDs light using a PIC.

Bad assumption. I am reading on it though. Ok, I guess I was a little messy with the above setup. Lets forget the output voltage as I can use resistors to change my voltage after the LED. So we can just focus on the LED.

3 LEDs, 1 momentary input. The IC needs to count the number of times the button was pushed cycling around at 3 and always starting at 1. Give it power and it lights up LED 1, push the button and it turns off 1 and lights up 2, push it again and it turns off 2 and lights up 3, push it again and it turns off 3 and lights up 1, etc...

I would have to be concerned with bounce as I don't want it thinking the button was pushed twice. And I would have to have it check for the button release as I could hold the button for too long. Since size is an issue I would guess I could use a bounce IC to handle this rather than another circuit?
 
Okay, so you are changing series resistors to control the current (not the voltage) across the LED thereby controlling brightness? THe forward voltage drop across LEDs (and all diodes) is fixed so you can't change that.

From what you have said, it's all in the code. That's the wonderful thing about PICs. Most PICs can drive 25mA of current which is enough to light one LED to the max. So basically, all you have to do is take the LEDs, connect their cathodes together and connect each anode to a separate PIC pin (through a resistor of course). Then you have the button connected through a debouncer to another pin. I don't know any debounce circuits off the top of my head, but a debounce IC is overkill for this since you only need one. But if size is an issue and you don't mind getting one, go for it. No harm done. That's what samples are for right?

The rest is code. Just have a counter or something to count the number of presses and have it reset every 4rth press. The PIC can set the appropriate LED pin HI (and the other LED pins LO) based on the number currently in this counter.

-Let the 3 LEDs and their corresponding pins be labelled LED0, LED1, LED2.
-Counter goes from 0->2 (0->3 if you want to have a state where no LEDs are on).
-set other two LED pins to LO and set pin LED[counter] to HI; pin LED[counter+1] if you want an off state where no LEDs are on
-every button press increment/cycle the counter 0,1,2, 3 (if needed)
-have the software periodically check the counter and update the HI/LO on LED pins

If you want to adjust brightness of the LED or something, then you could use a digital potentiometer instead of a fixed resistor. The digital pot would connect to the PIC through some serial pins that you would use to control the resistance.
 
Last edited:
Oh..!! At Last, I find your site again..!!

Oh..!! At Last, I find your site again..!!
A few days ago I search "https://www.electro-tech-online.com/" in the NET, and find this magnificent topic. But not SAVE your address www.electro-tech-online.com. I've been reading it for a while, and decided to try my luck asking a few questions…., and I'd like want more about the "https://www.electro-tech-online.com/", and about active members.!
Where I can find more INFO about the "https://www.electro-tech-online.com/". Thank you very much
Best Regards..!!
 
If it plugs into a breadboard it's pretty much the same if it's 16 pin or 40 pin. The hard part about big chips of the same line is the PCB layout.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…