I am looking for some advice regarding my control setup for an ROV and how to make it as smooth as possible. Currently, I have two arcade style joysticks with standard micro switches inside. How I envision the system working is like this: Joystick outputs 3.3V or logic 1 equiavalent to a GPIO input on the BBB. I have a script setup to run on boot for the BBB that immediately sets up the input pins, and sets the output pins to low (temporarily) to avoid any floating high. A series of while loops or equivalent designate what input on which pin will correspond to the BBB outputing a HIGH value on another pin, which then goes to a 16-channel relay board, which in turn feeds out to 8 (maximum) 12V bilge pump motors.

Now here is my issue: How do I go about getting the joystick to output a signal that is of the proper voltage/amperage so as to not harm the BBB by damaging the substrate by having a GPIO sink too much current. I have seen some 3.3V regulators out there, and I assume with a proper current limiting resistor the system would function correctly without harming the Beaglebone. However, I am not sure if this would even work and how it would be setup for optimal function. For example, should I have a regulator feed 3.3V to the microswitches and have the joystick switch 3.3V? Seems like this would work in theory, but I would really like to be sure before I do any damage to the board.

If you are still not sure what my question is, let me put it to you this way: What would be the optimal setup utlizing the components above to produce a system that is both safe for the BBB and functional for the purpose intended (controlling 12V bilge pump motors by driving a relay board). To be clear, I'm not asking for anyone to design this for me, more just looking for constructive feedback and criticism to see if there is anything I can improve. Let me know if any clarifications are needed.

  • 1
    \$\begingroup\$ Why is the BBB in there in the first place, can you not just wire the joystick switches to the relays? Also, relays are quite a ponderous thing to control movement, for anything switching that often with that fine degree of control you'd be better off using solid-state (transistors, FETs, etc.) \$\endgroup\$ – John U Aug 28 '13 at 7:39
  • \$\begingroup\$ The joysticks are presumably entirely passive, just switches? Do you want them at the end of a long cable? Do you have enough GPIO for the joysticks (presumably 8 pins, one for each switch direction)? \$\endgroup\$ – pjc50 Aug 28 '13 at 9:36
  • 1
    \$\begingroup\$ electronics.stackexchange.com/questions/69154/… \$\endgroup\$ – pjc50 Aug 28 '13 at 9:36

Several things to comment here.

First off, if the joystick puts out 3.3v then it won't damage the BBB. If you can control the wiring of the joysticks (I'm assuming they're just microswitches and you can modify the wiring), then a better plan would be to connect a ground signal to one side of the j/s switch and the BB to the other. Atmel chips have built-in pullups. I can't imagine the BBB has that feature. In which case, connect the signal to Vcc via a 10K or 47K resistor. Add a small capacitor for debounce.

In normal operation, the switch is open. The resistor pulls your signal input to a high state. When you operate the switch, the resistor gets shorted to ground and your input goes low. The capacitor just takes the "edge" off the signal to avoid the rough edges you get with your average switch.

I'd second someone else's comment about using relays. Your bilge pumps operate on +12v with a current of around 2A (give or take). You can use an N-channel MOSFET to drive the pump instead. Connect the + to +12v, and the - to the drain of the MOSFET. Connect the source to ground and the gate to the BBB. Cheaper, smaller and better than a relay. Also put a shunt diode across it.

Make sure to use a MOSFET which has a gate threshold compatible with the BBB output or it won't switch on.

The other advantage of the MOSFET is you can pulse the stepper quite quickly. To avoid the pumps "kicking" when turned on, you would switch them on in software for a millisecond (for example), then leave them off for 9ms. Turn them on for 2 and off for 8, etc, until they're fully on. That way, as you operate the joystick, the motors will rev up, rather than kicking hard over and making small movements difficult if not impossible.


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.