input voltage to control program parameters
trazym
Posts: 10
Hi,
I am new with microcontrollers and i want to know if it is possible to read the voltage applied to one pin and to use this value as a parameter into the program?
If it is possible, how can i do it?
Thank you for your help!!
Fred
I am new with microcontrollers and i want to know if it is possible to read the voltage applied to one pin and to use this value as a parameter into the program?
If it is possible, how can i do it?
Thank you for your help!!
Fred
Comments
if you want a digital input it's simple. If levels match that of the controller simply connect - if not add a level converter.
You mean analog voltage? Search the object exchange for ADC.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Airspace V - international hangar flying!
www.airspace-v.com/ggadgets for tools & toys
maybe you should tell a bit more. Is your goal to have a input device to control the program or do you really have some kind of device which produces different voltages and you want to attach exactly that to the microcontroller (hopefully a propeller;o) ?
For a simple analoge input device the delta-sigma ADC would be a good thing to start with. It measures the resistance of a variable resistor with only one additional condensator and one additional (fixed) resistor. You can find it in the propeller educational lab which can be downloaded in the propellers download section.
Maybe a variable voltage isn't the best solution!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Airspace V - international hangar flying!
www.airspace-v.com/ggadgets for tools & toys
My first Idea was to change the control parameters using knobs and screwdrivers.
So the variable resistor would work. Other possibility would be to use an encoder ( I don't know the english word for it, maybe it's wrong ) You can turn it and it gives you impulses on two pins for each step. With the timing of these impulses you can determine in which direction it's been turned. One COG count's up and down accordingly. But then you wouldn't need a screwdriver;o)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle
as it is for an offroad motorbike the device should be as robust as EVER possible.
I wouldn't use an analog potentiometer at all for this purpose. On an offroad motorbike
everything use shaking around and this will make a potentiometer make fail after 100 km
Still we need more information.
Are you doing some finetuning of the motor-ignition ALL the time in realtime when the engine's rpm goes up and down ?
Are you doing some adjustements BY HAND two or three times a day with 6 steps between min and max ?
How many steps do you need from min to max ?
The best solution will depend on what you want to do. S
o post a detailed description of your project.
best regards
Stefan
In fact, maybe 6 steps between min and max is enought. I've to try with changing the values with the laptot and then i'll see if that's enought!!
Which component would you use to do it?
Thank you for your fast and serious answers! [noparse];)[/noparse]
- www.digikey.com
- www.mouser.com
- www.farnell.com
and there are many more offering such devices.Oh, if you only need to encode 6 different values you can use up/down keys and count the values in software.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Airspace V - international hangar flying!
www.airspace-v.com/ggadgets for tools & toys
it's still not clear to me what you want to do exactly.
Would you like to adjust the engine power while driving.
I mean you see the mud 100m ahead and want to do a quick switch to the mud-engine-power-mode
while still riding the bike at full speed or
one day riding through mud switching to the mud-engine-power-mode
another day riding on dry and solid ground switching to the dry-engine-power-mode ?
and how many parameters have to be adjusted ?
One robust solution could be very robust mechanical switches or inductive proximity sensors
one for increase the value one for decrease the value. Every press of the button counts the value one up or down
and a 7-segment display shows the actual value. With two 7segment digits this would give you values from 0 up to 99
Inductive-proximity-sensors are working WITHOUT any mechanical parts. If something made of iron, steel or aluminium comes close
to the sensor the sensor switches its output. I think there are even sensors that could be used under water.
You can drive them from 10V -30V. They are available in a lot of different sizes. 4mm diameter 40mm long up to 30mm diameter 100mm long
or small boxes in that size. Maybe the specification should say something about how much vibration (accelation and frequency) the sensor can
deal with without beeing damanged
best regards
Stefan