Notifications
Clear all

Circuit suggestion: Potentiometer to discreet output

4 Posts
2 Users
1 Likes
2,201 Views
SHD
 SHD
(@shd)
Member
Joined: 5 years ago
Posts: 5
Topic starter  

This is going to start like a project request, but at its heart it is a basic electronics question.  I am hoping that those more familiar with electronics can help suggest an approach to my current problem.  I have a small door that is being operated by an incline motor salvaged from an old treadmill.  The motor has three A/C lines -- a common netural and a hot line for each direction.  It also has a 10k pot geared to the shaft to register the position.  The range of motion of the door is only a portion of the range of the motor. 

During my initial design/tests, I had been intending on running the door using an ESP module.  I have one of those pre-assembled, optically isolated, 3-relay boards on hand so the chip can use two of those relays to run the motor up and down.  I tested feeding the pot into the analog input and using that to set the end points of travel in the code.  Works fine.

The problem is, since then the control chip has gone from microcontroller to SBC -- an OrangePi Zero, to be exact.  The door is only one of the functions I need in that building and some of the others are definite SBC territory.  This leaves me with no analog input.   

So there are a couple of solutions here right off the bat.  Use an analog-->digital converter to feed the pot values into a digital GPIO on the pi.  Or I could put physical switches/sensors at the ends of travel and either feed that input back to the pi or just have it cut the relevant AC line to stop the motor and then have the pi run for a period of time that is greater than that needed for travel.  Still, there is already that pot sitting there just aching to spit out motor position.  Even better, I don't really care about all the positions during travel -- I only care about the two end points.

So basically what I'm asking for is suggestions on the type of approach can I take to turn that pot signal into a simple binary state where it is 'on' in a slice of its overall range and off at either outside edge.  The output could be used to cut the neutral to the motor, a particular hot line, interrupt the GPIO signal between the pi and the relay board or even abandon the relay board and work it into a soldered board where a transistor is controlling a relay?  Better still if the solution comes with a couple pots that can be used to fine-tune where those outside edges are.

I did do a quick test where I simply put a pot and fixed resistor between the pi and relay board.  I found that the resistance at which the voltage drop was enough to toggle the relay, though, was finicky and inconsistent.  There are some components (LED, etc.) on the input side of the optical isolators, the optical isolators, and the relay coils.  Somewhere in there, there seems to be some 'slack' in the system.  So I really do seem to need a clear digital signal coming into that relay board if I use it.     

I know this is a long/somewhat vague question, but any help would be appreciated.

Cheers,
Dave

     


   
Quote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
 

May be completely crazy but you could use the pot and resistor as a voltage divider and an opamp as a comparator. The opamp will switch on and off as the voltage increases and decreases against the reference voltage.

Hope this helps or at least point you in the right direction.


   
SHD reacted
ReplyQuote
SHD
 SHD
(@shd)
Member
Joined: 5 years ago
Posts: 5
Topic starter  

@pugwash

Thank you.  That's _exactly_ the sort of thing I was looking for.  Took a very quick look at op amps/comparators and how they work and that is definitely an avenue worth exploring.  Better still, I know that when I looked up what some of the ICs I've been pulling off of old electronics are, some of them were op amps -- so I may even have something on hand that will either do the trick or at least let me get some hands-on breadboard tinkering time with this sort of component until I properly understand them.

I'm also generally interested in anything that might be considered crazy .. so that's a bonus.  🙂

Cheers,
Dave    


   
ReplyQuote
SHD
 SHD
(@shd)
Member
Joined: 5 years ago
Posts: 5
Topic starter  

Update:  So a bit of reading and a bit of rummaging through salvaged parts and I was able to find a dual opamp with what seemed like suitable specs in the form of an M5223P.  I've breadboarded myself up two comparators that use pots to set the reference voltages and a third (on the breadboard itself; camera right) to simulate the motor pot being fed 3.3v from the OrangePi.  The output for the amps is set between 0 and 5V, with this being fed into the relay board.   The result is that both relays are on when values are between the two reference voltages, but each cuts out at its respective limit. 

Right now I just have the trim pots being fed by a constant 3.3v, but if I swap that out for the gpio pins of the Pi then I can get the motor to open and close at will, with each being cut out when the voltage coming from the motor pot matches the reference voltage for that amp.

Cheers,
Dave

comparator breadboard

 


   
ReplyQuote