Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Turn pot, blink LED for a period of time in proportion

Status
Not open for further replies.

fuper

New Member
Hey all -

I'm solving the following with an AVR. For fun I tried to figure out how to implement this without a micro controller but failed.

You have a pot, and an led. When you turn the pot, the led blinks for a period of time. The amount of time the LED flashes is in proportion to turn of the pot. The frequency of the led flashing is not really important, say a few hertz.

I was thinking with the pot setup as a voltage divider. If you turned the pot the change in voltage could be used to enable an oscillator.

One thought I had is that you use a couple of 555. One as a LFO, and another as a one-shot that enables/disables the LFO.

From there you use the pot as a voltage divider feeding a voltage comparator. The voltage goes higher, the comparator output goes high, turns on the one shot which enables the LFO for a period of time.

I got stuck on how to dynamically change a voltage comparator to set the new threshold.

Anyway - an interesting puzzle. Anyone have any ideas?

Cheers!
 
Maybe configure a LM393 as a window comparator and run a triangular waveform into it. The higher the frequency of the triangular wave the faster the rise and fall times as the wave passes through the window?

Ron
 
Maybe configure a LM393 as a window comparator and run a triangular waveform into it. The higher the frequency of the triangular wave the faster the rise and fall times as the wave passes through the window?

Ron

Hmmm not sure i understand. Lets say the pot is at 0. Turn it all the way and have the led flash for 1 minute. turn it only half and it flashes for 30 seconds etc. I would need to adjust the comparator dynamically, which is the rub as I can't figure out how to do it!

Thanks!

Shane
 
What initiates this sequence? Do you want this to happen only once (say every time you press a button), or does the cycle of on and off continue indefinitely?
 
um, idk if arm has analog input to read the pot, since i use pics, but here is BASICish;)

value1 = readAN1

repeat value1
set led1 on
wait 250ms
loop


repeat (total time - value1)
set led1 off
wait 250 ms
loop

GOTO begining
 
Turning the pot initiates the sequence. Once the sequence is complete you would have to turn the pot again to start the led flashing. In my case i'm driving a pneumatic cylinder with a solenoid but I used a LED to simplify the question a bit.

So lets say Vdd = 10Volts. Lets also say that if you turn the pot from 0 to 5 volt the LED flashes for a period of 30 seconds. If you turn the pot bring it up to 7.5 volts then the led will flash for an additional period of 15 seconds. Turn the pot down back to 0 and the led will flash for 45 seconds etc.

Thanks for the reply!
 
Could you use 2 x 555 as you surggested and have the pulse from the first LFO charge the cap on the one shot timer through a resistor and blocking diode.

That way as you increased the pulse rate (frequency) of the first 555 the 2nd 555 would latch sooner as the cap would charge quicker.

Pete.
 
I misunderstood your first post. :(

You want the time to run once or do you want the pulses to repeat but with the ability to change the on time.

So lets say Vdd = 10Volts. Lets also say that if you turn the pot from 0 to 5 volt the LED flashes for a period of 30 seconds. If you turn the pot bring it up to 7.5 volts then the led will flash for an additional period of 15 seconds. Turn the pot down back to 0 and the led will flash for 45 seconds etc.

What do you want to initiate the cycle? I am still lost on this one.

Ron
 
I misunderstood your first post. :(

You want the time to run once or do you want the pulses to repeat but with the ability to change the on time.



What do you want to initiate the cycle? I am still lost on this one.

Ron

Thanks for the reply Ron!

I want the time to run once per turn of the knob. The duration of the run is directly related to the amount you turn the knob. The led flashes at a independently set fixed frequency [in my application 10-20 hz].

The cycle is initiated when the knob is turned. Turn the knob a little bit the led will flash for for a small amount of time. Turn the knob more and the led will flash longer.

In my application I will be pulsing a solenoid attached to a pneumatic cylinder. The cylinder will be extended fully when it receives X number of pulses. Turn the knob 50% of max and the AVR will send X/2 pulses to the solenoid thus extending the cylinder approx 50% of its length. Turn the knob another 25% of the total and X/4 pulses will be sent.

Shane
 
So you also want the cylinder to retract when you turn the knob back? If so, how do the pulses retract the cylinder? Do they pulse a different solenoid?

You need to tell us exactly what you are doing to get the correct answer. Being coy by substituting what you think is a simpler problem only leads to incorrect assumptions and answers. We're big boys here. We can handle the truth. :D
 
Hey Carl thanks for the reply!

To position a pneumatic cylinder you can pulse the controlling solenoid on and off at a low frequency and you can get a "somewhat" accurate position of the rod. There are a bunch of papers on this as a means of positioning a cylinder. There are complications due friction, and the compressability of air. Pulsing it lets you get better control and it's relatively simple and inexpensive. Alternative solutions involve expensive servo driven valves.

I am using a pot so a user can position the cylinder by hand. Turning the pot fires off a set of pulses to one solenoid, which lets in fixed bursts of air, and thus extending the actuator. Turning the pot the opposite way sends off another set of pulses to a second solenoid which is connected to the cylinder's opposite port. The cylinder's are double ports so you can extend/contract them. So yes there are two solenoids. I'm in the process of wiring this up with an AVR a couple of Clippard solenoids and a uln2803 and a linear potentiometer. I will derive the number of pulses experimentally. I'm doing this as a hobby for a human leg assist device as I have oddly found myself with a number of friends who are all physical therapists.

I was curious if it could be done with discrete chips instead of programming a solution. I couldn't figure out a way to do it without a micro controller so I thought I would ask as it was puzzling me!

Shane
 
Last edited:
I wonder if PWM could be a solution? The thing is that you would need the pot as you mention but also a button that when pressed would allow the PWM to pass to the solenoid. That or when fully CCW there would be no pulses and as the pot were turned CW pulses would start slow and increase. Something like that may work with discreet components.

Ron
 
I wonder if PWM could be a solution? The thing is that you would need the pot as you mention but also a button that when pressed would allow the PWM to pass to the solenoid. That or when fully CCW there would be no pulses and as the pot were turned CW pulses would start slow and increase. Something like that may work with discreet components.

Ron

Adding the button would certainly be the easiest way to get it working with discrete chips! Thanks for the suggestion!

Shane
 
If you want the cylinder position to be proportional to the pot position (which is my understanding of what you would like) then you will need some sort of linear position sensor feedback. Otherwise the pot position and cylinder position will eventually get out of sync no matter how carefully you try to adjust them.

One thing that could help this is to have limit switches at each end of the cylinder movement. You could use that to reset the pot position versus cylinder position at the zero and maximum settings of the pot.

All in all the complexity of this task would seem to be better suited to your micro solution.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top