0
\$\begingroup\$

I'm building a window blinds system. I have an arduino powering a motor via a DRV8833 Dual-H bridge controller. At the limits of each direction of motion, I have limit switches that kill the power to the motor in that direction. I also want the arduino to read when the limits are hit, but I can't feed the raw power from the limit switch into an input pin as it will exceed the 3.3V logic inputs.

I've got what I'm calling forward working with an NPN transistor to feed 3.3V logic when its corresponding limit switch is hit. However I'm really struggling figuring out the wiring to determine when the reverse limit switch is hit. In that case you end up with a negative voltage in a sense coming from the limit switch. I've had a couple of random configurations that seemed to work, but not consistently. I'm attaching diagram of what I have in place currently. In this diagram, I'm representing the reverse and forward directions separately with reversed voltage sources even though in practice, the two limit switches are next to each other between the DRV8833 and the motor (represented by lamp). I have diodes across the limits to allow motion in the opposite direction when a limit is hit. I have Q8 being activated when SW7 is hit and the arduino pin reads the switch activation. I need help getting SW5 to indicate to the arduino when it's been hit. Note resistors are just default ratings in diagram.

enter image description here Circuit Lab

\$\endgroup\$
10
  • \$\begingroup\$ With the current circuit, pin3 is always connected to 3.3V. If Q6 turns ON, what limits the current through Q6 ? \$\endgroup\$
    – AJN
    Jul 27, 2020 at 15:40
  • \$\begingroup\$ Why not use the same scheme as SW7 ? input to Q8 is low when motor is running and input to Q8 is high (8V) when motor is not running. If you use the same scheme for SW5 also, only difference is that you will get high when motor is running and low when motor is not running. Just do a logical inversion inside the arduino code. \$\endgroup\$
    – AJN
    Jul 27, 2020 at 15:54
  • \$\begingroup\$ Are the BJTs necessary? Can this not be done with voltages dividers? \$\endgroup\$
    – Joe Mac
    Jul 27, 2020 at 17:37
  • \$\begingroup\$ I'm a total newb at circuitry so there is possibly a better way to do this than BJT. I hadn't thought about voltage dividing but I just felt like there were too many variables to ensure I get a clear an accurate and safe voltage into the input pin. I don't know at this point what voltage I'll need to run the motor at (it's on a buck converter so I can set voltage) and PWM may also come into play and I don't under stand how PWM affects things. It's possible I don't have a grasp of how VD works and it may be viable. I just don't have the knowledge or experience under my belt. \$\endgroup\$ Jul 27, 2020 at 17:51
  • 1
    \$\begingroup\$ Voltage converters feeding motors are generally a very bad idea \$\endgroup\$ Jul 28, 2020 at 16:00

1 Answer 1

0
\$\begingroup\$

Using limit switches with DPDT contacts would be one more way to meet your requirement of having hardwired limit switches with status feed back to the controller.

Another alternative would be to wire the limit switches to the controller inputs and have only software control.

\$\endgroup\$
7
  • \$\begingroup\$ While these are options, it is false to claim that they are the only ways to solve the problem. The stated plan of monitoring a negative voltage is achievable. \$\endgroup\$ Jul 28, 2020 at 12:56
  • \$\begingroup\$ So @vu2nan, are you recommending that instead of the SPDT limit switches I have now, I could use a DPDT switch to essentially create a separate circuit that gets activated when the switch is thrown? That circuit could be at 3.3V reference and I don't have to deal with whatever voltage the motor is running? That actually sounds like a good idea that hadn't occurred to me. I didn't know DPDT limits existed. Looks like they are much harder to buy and more expensive but they would simplify things if I'm understanding correctly. Then I wouldn't need the BJTs. XV-156-2C25 looks like a good option \$\endgroup\$ Jul 28, 2020 at 15:41
  • \$\begingroup\$ Hi Chris, Thank you very much for pointing it out. It was not my intention to make such a claim. My answer has been amended. \$\endgroup\$
    – vu2nan
    Jul 28, 2020 at 15:54
  • \$\begingroup\$ I just ordered some DPDT limits from Amazon for Thursday delivery. From circuit lab... it seems like your idea would work great and simplifies things even if it raises the cost a bit. circuitlab.com/circuit/ewkka5paqveh/blinds-with-dpdt-limits If it works once I get the parts, I'll mark this as the answer \$\endgroup\$ Jul 28, 2020 at 16:00
  • \$\begingroup\$ If I was going to take one of the ideas from this answer and run with it, it would be the idea of making the control always go via the MCU software \$\endgroup\$ Jul 28, 2020 at 16:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.