1

I am currently working on a project that requires many different motors to be powered by a raspberrypi. Common drivers like the L298N use two gpio pins to drive a single motor in a direction, the direction is specified by setting one of the two pin states to HIGH. I want to know if it's possible to only use one pin for this purpose, i.e. setting a gpio pin to HIGH equals pin1=HIGH and pin2=LOW and setting it to low equals pin1=LOW and pin2=HIGH.

4
  • 1
    Ah, D-Flip Flop is your friend: en.wikipedia.org/wiki/Flip-flop_(electronics)#D_flip-flop – tlfong01 Jul 5 '20 at 1:15
  • So you want the motors to be running full speed ALL the time? You just want to select run clockwise or run counterclockwise. – joan Jul 5 '20 at 7:45
  • @joan yes i always want one of the pins to be high, would this chip do the thing I want? aliexpress.com/item/… – Yes Jul 5 '20 at 9:30
  • Possibly. I'd be tempted to use a port expander such as the I2C MCP23017. You can hook up 8 for 128 extra GPIO so sidelining the problem. If you do go the 74HC route make sure you can connect the chip. A DIL package will just plug in to a breadboard. The linked chip would be hard to use unless you are very good at soldering. – joan Jul 5 '20 at 12:09
1

Use a MUX or logic gate and create a function that does two things while gpio reacts differently. This way you can do that.

4
  • 1
    you mean something like this? aliexpress.com/item/… – Yes Jul 8 '20 at 21:58
  • @Yes You can use something like this. But I think there better chip-set – Sohan Arafat Jul 17 '20 at 9:24
  • do you maybe know a place to buy one? – Yes Jul 17 '20 at 10:31
  • @Yes if youy are leaving near China try Ali. Your nearest Store can be a place to search – Sohan Arafat Jul 17 '20 at 13:44

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.