I want to take a switch that provides resistance values depending on position and have it perform an action based on those values.
The switches values are as such: Down is 47Ω to ground, Up is 307Ω to ground. No switch pressed is 10kΩ to ground.
The action would be to control a forward/reverse relay module that is 3 wires. FWD/GND/REV. Model: F-1020 12v, Specs: Operating Voltage 10 - 15v DC, Switch Short current 30mA @ 12V
Will the M0 handle this? If not, is there another tiny controller that could?
Can I use a M0 for this?
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- dastels
- Posts: 15653
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Can I use a M0 for this?
Any microcontroller will be able to do this with the right additional circuitry. You would add a pullup resistor to Vcc to turn those switch resistances into a variable voltage divider, then read the voltage at the point between the pullup and the switch using an analog input. The relay would need a drive for each of FWD and REV. A transistor and shunt diode for each will probably suffice. See https://learn.adafruit.com/transistors- ... rs-2998941.
Dave
Dave
- XRAD
- Posts: 754
- Joined: Sat Nov 19, 2016 3:28 pm
Re: Can I use a M0 for this?
Yes, you can read the resistance in your code and 'do' something with it....That's how you can get multiple functions off one pin, like stereo control steering wheel buttons in a car...just have to read the pin for state changes....
classic example: rotary resistance switch with 'x number of' positions....
another way is by 'timing' the button press...ex: 1 second is forward, 2 sec is reverse...ect....
classic example: rotary resistance switch with 'x number of' positions....
another way is by 'timing' the button press...ex: 1 second is forward, 2 sec is reverse...ect....
Please be positive and constructive with your questions and comments.