Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Controlling a DC motor with foot switches and a microcontroller with a sensor

LEROY180

Newbie level 4
Newbie level 4
Joined
Mar 5, 2025
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
90
IMG_7711 (1).jpeg

I am hooking up a 12 v dc motor into a project AI have been working on. The motor is attached to a linear actuator (trapezoidal screw) that will raise and lower a shaft. I have a deep cycle 12 v battery I am using to power this. Power is ran to a fuse box. The motor is a 12-24 vdc 24 amp motor. I have a 7 pin rocker switch I would like to use for an automatic and manual mode selector if possible. I would also like a on/off switch (2 pin) wired in front of this rocker switch. The manual mode will control the motor, up and down with the foot pedal. Then when you switch the rocker switch to the automatic mode, it will have the motor move up and down based off inputs from the ultrasonic distance sensor if there is any obstacles, and will raise the shaft accordingly.

I am unsure how to fully wire this up. I have 12v-5v buck converters that I can use to power the microcontroller if needed. The microcontroller is a Metro M4. I also have an IBT-2 and two IBT-4s I can use to wire things together as well. I have access to other microcontrollers if needed too. I have other SPDT relays I can use as well.

I do not know how to wire this up so that it works. I attached multiple images with my equipment as well as some wiring diagrams for different things. Any information or guidance is greatly appreciated. If there are other images or information I should provide please let me know. Thank you.
 

Attachments

  • IMG_7710.jpeg
    IMG_7710.jpeg
    1.7 MB · Views: 35
  • IMG_7707.jpeg
    IMG_7707.jpeg
    2 MB · Views: 31
  • IMG_8ECD4BEB-C55C-4A11-88EA-238168D4AF9C.jpeg
    IMG_8ECD4BEB-C55C-4A11-88EA-238168D4AF9C.jpeg
    2.5 MB · Views: 31
  • IMG_6B10AE1E-6421-4746-A1D2-DD362B0E1C6B.jpeg
    IMG_6B10AE1E-6421-4746-A1D2-DD362B0E1C6B.jpeg
    934.4 KB · Views: 35
  • IMG_7667.jpg
    IMG_7667.jpg
    338.6 KB · Views: 32
  • IMG_7666.jpg
    IMG_7666.jpg
    287.4 KB · Views: 37
  • IMG_7705.jpg
    IMG_7705.jpg
    195.5 KB · Views: 36
Hello!

It's not easy to reply.
- No info about the sensor. Is it a plain transducer, or is it a module with output wave and input echo, etc, etc
- No clear idea of what you want to do in "automatic" mode. Move the motor, and once at a certain distance move back?
Any tolerance of the movement? Any security requirements? Suppose it's a drill, which works in automatic mode. Do you
have any security requirements (make sure that nobody's hand is under the drill)?

Beside this, I'm not sure anybody will reply, at least not for free. You come with a bunch of components, and you are
asking the forum to make your design. What about starting to actually do something, in which case it would be easier
to help you on specific matters rather than doing a full project.

Dora.
 
It's unclear what voltage and current levels your linear actuator responds to, either: a) On-Off power from wiring, or b) range of voltages coming from sensor or potentiometer inside your foot switch.

In the neighborhood of the linear actuator, you must condition each incoming source so its signals are acceptable to the actuator. Almost certainly this means amplifying signals from the ultrasonic sensor.

The SPDT switch has a center post (electrically speaking). By pushing to either side you connect it to one of the two remaining posts. The diagram makes it appear easy to follow however it's unclear exactly how many individual center posts are inside your rocker switch.
 
Hello!

It's not easy to reply.
- No info about the sensor. Is it a plain transducer, or is it a module with output wave and input echo, etc, etc
- No clear idea of what you want to do in "automatic" mode. Move the motor, and once at a certain distance move back?
Any tolerance of the movement? Any security requirements? Suppose it's a drill, which works in automatic mode. Do you
have any security requirements (make sure that nobody's hand is under the drill)?

Beside this, I'm not sure anybody will reply, at least not for free. You come with a bunch of components, and you are
asking the forum to make your design. What about starting to actually do something, in which case it would be easier
to help you on specific matters rather than doing a full project.

Dora.
Thank you for your response. The sensor I am using is an IP68 rated ultrasonic distance sensor. I attached an image of it here.
Here is a link to it as well:
Underwater Sensor

While in automatic mode, the sensor, which is in the water, will detect any obstacles within lets say 30 cm and then raise the motor for lets say 4 seconds. And then again as a hypothetical that if the sensor hasn't detected an obstacle in 1 minute will lower for 4 seconds. So automatic mode just raises and lowers the shaft automatically, without a user input, just the sensor input. The lifting device I am using (trapezoidal screw) is taken from an adjustable desk leg. I attached an image of it here, but in the image the motor is disconnected from the top. The screw will travel about 16 inches of possible movement in total. Ideally the lifting device stays close together which means the shaft is as deep as it can be in the water. This project is revolved around raising and lowering a trolling motor shaft that goes on a boat.

I know it has a lot of components and I am asking for a lot of advice, but I am having trouble wrapping my head around where I need specific relays or buck converters or motor drivers like the IBT-2. I am also just wondering if it is possible to wire it like I explained above.

The progress I have made is connect the on/off switch which has two pins to the fuse box. One pin has a wire to a positive terminal of the fuse box, then the other wire goes to the 7 pin rocker switch. I then have power to the rocker switch and can flip it up or down to get voltage to specific pins and can run the motor, but I am having trouble fitting the foot pedal into the wiring.

If you have any other advice or need any other information I would really appreciate it. Thank you.
 

Attachments

  • 61sa7r1tBGL._SX522_.jpg
    61sa7r1tBGL._SX522_.jpg
    16.1 KB · Views: 18
  • IMG_7682.jpeg
    IMG_7682.jpeg
    2.9 MB · Views: 17
It's unclear what voltage and current levels your linear actuator responds to, either: a) On-Off power from wiring, or b) range of voltages coming from sensor or potentiometer inside your foot switch.

In the neighborhood of the linear actuator, you must condition each incoming source so its signals are acceptable to the actuator. Almost certainly this means amplifying signals from the ultrasonic sensor.

The SPDT switch has a center post (electrically speaking). By pushing to either side you connect it to one of the two remaining posts. The diagram makes it appear easy to follow however it's unclear exactly how many individual center posts are inside your rocker switch.
Hi, thank you for the response.

The voltage that the motor will receive is the 12v from the deep cycle battery. The motor runs without a load and draws about 2-3 amps, but under a load it draws somewhere between 15-20 amps. I have tested it under the load it will need to lift (trolling motor shaft that goes on a boat) with a 20 amp fuse in the fuse box and it raises and lowers just fine.

In regards to the automatic mode, the sensor is hooked to a microcontroller, so the output of the microcontroller would have to go through an amplifier and basically step up the 5v that I stepped down already back up to the 12v which then goes to the motor? And then the motor is also somehow connected to the foot pedal which only works when in manual mode? I am just having a hard time wrapping my head around how to wire this all together.

Here is a link to the 7 pin rocker switch I bought if that helps identify things on how to wire it for the manual and automatic modes.
Link: 7 pin rocker switch

Any other information or advice is really appreciated. Thank you.
 
Two foot switches...
I guess each is simple On-Off type? Carrying up to 20 Amperes?

Since there's two of them it sounds as though you must devise your automatic system to produce its own similar set of signals. Say your automatic device outputs one signal... then you must split that signal to two relays (or two transistors). Energize one or the other, while most of the time both are Off.

You just may have sufficient tabs on your rocker switch to adapt it to your purposes.

There's a caveat: You must explore the wiring to locate ground wires in your manual system. Avoid sending heavy current directly to the 'common' wire (or ground wire), and avoid sending it in a reverse direction to devices that would be ruined. Your automatic system must be constructed so its wiring is compatible with your present system.
 
You might "lose" the ultrasonic ranging requirement
if you just used armature current as a load "sensor"
(probably you will need some blanking at motor
start, though, to ride out the starting torque bump).

I don't believe this application needs a uC at all.
Just limit switches and an latch-off or fast acting
overcurrent protection that overrides the "go"
switch. That could be a dumb ol' transistor and
sense resistor, opening a NC relay in series with
the "go, then see if you get in a bind" switch. Or
something.
 
  1. I assume vertical speed is fast enough to clear rock at trolling speed.
  2. I hope you understand the ultrasound will not work thru a metal hull. Fiberglass OK.
  3. You will need to spend a lot of time decoding the sensor data decoding a rock in writing a program.
  4. A flat surface creates the strongest reflection range of 5m while a rock will be proportionally less S/N.
  5. Any mounting bracket vibration will further reduce sensitivity.
  6. Beamwidth is often 50 deg of Tx/Rx sensors so forward tilt of the same is required or in-hull if fiberglass.

What is the DC resistance of the servo motor? This defines surge current.


You have a lot more to figure out how it can fail to make it work.
 
Last edited:
Update:

I tried attaching the foot pedal to the motor with the IBT-2, and I was unsuccessful. I was getting no output voltage when I pressed either pedal. I then switched out the IBT-2 for two IBT-4s. I had the same issue with the foot pedal, it just simply was doing nothing. I then opted for an older 'foot pedal' switch/button that I was planning on using. This is a trim tab switch, with 3 wires.

I wired each IBT-4 from the fuse box separately. The PWR+ came from the fuse box separately, and the PWR- grounded separately at the fuse box as well. I then wired one motor wire into the outer motor module on one IBT and then wired the other motor wire into the other outer motor module on the other IBT. The trim tab has 3 wires, purple which is hot, green which is down, and blue which is up. I wired the purple (hot) wire directly into the fuse box. The green wire is connected to the IN1 on one IBT and the blue wire is also connected to the IN1 on the other IBT. I then wired the GND on each IBT together and grounded them on the fuse box. This works, when I press the trim tab up button it turns the motor one way and when I press the trim tab down button it turns it the opposite way.

If anyone has any advice on how to possibly condense this down, let me know. I also might wire the trim tab switch to the IBT-2 to simplify things. If anyone has advice on how to now possibly wire things into a rocker switch, or another way to 'select' modes for the manual and automatic please let me know. If someone also knows how to wire the motor up so each input is wired to the motor, I would appreciate it.
 

Attachments

  • IMG_7759.jpeg
    IMG_7759.jpeg
    1.3 MB · Views: 20
  • IMG_51D7D38B-959B-46A5-905C-DEF86B51DD98.jpeg
    IMG_51D7D38B-959B-46A5-905C-DEF86B51DD98.jpeg
    1 MB · Views: 17
  1. I assume vertical speed is fast enough to clear rock at trolling speed.
  2. I hope you understand the ultrasound will not work thru a metal hull. Fiberglass OK.
  3. You will need to spend a lot of time decoding the sensor data decoding a rock in writing a program.
  4. A flat surface creates the strongest reflection range of 5m while a rock will be proportionally less S/N.
  5. Any mounting bracket vibration will further reduce sensitivity.
  6. Beamwidth is often 50 deg of Tx/Rx sensors so forward tilt of the same is required or in-hull if fiberglass.

What is the DC resistance of the servo motor? This defines surge current.


You have a lot more to figure out how it can fail to make it work.
Thank you for the response.

The vertical speed is fine. I have a fiberglass hull, and in regards to the sensor, I understand that it will not be the most efficient things because objects will reflect differently and I am fine with that.

The motor I am using is a 12v 24a. I haven't had it draw 24a yet, under the load of the trolling motor shaft it probably draws around 15a. I had a 20a fuse connected to the fuse box and lifted the trolling motor just fine.

I just posted an update to the manual side of things using a trim tab instead of the foot pedals. Thank you for this information. Any other advice or guidance is really appreciated.
 
You might "lose" the ultrasonic ranging requirement
if you just used armature current as a load "sensor"
(probably you will need some blanking at motor
start, though, to ride out the starting torque bump).

I don't believe this application needs a uC at all.
Just limit switches and an latch-off or fast acting
overcurrent protection that overrides the "go"
switch. That could be a dumb ol' transistor and
sense resistor, opening a NC relay in series with
the "go, then see if you get in a bind" switch. Or
something.
Thank you for the response. I would like to keep the sensor and microcontroller set up because this project needs a level of 'complexity' that the sensor brings.

Are you suggesting using limit switches that are wired in the water? And when it hits an obstacle it then raises the motor? I am not super electrically sound when it comes to all of this, so if you have any other advice or ideas I would really appreciate it. Thank you again for your response.
 
Two foot switches...
I guess each is simple On-Off type? Carrying up to 20 Amperes?

Since there's two of them it sounds as though you must devise your automatic system to produce its own similar set of signals. Say your automatic device outputs one signal... then you must split that signal to two relays (or two transistors). Energize one or the other, while most of the time both are Off.

You just may have sufficient tabs on your rocker switch to adapt it to your purposes.

There's a caveat: You must explore the wiring to locate ground wires in your manual system. Avoid sending heavy current directly to the 'common' wire (or ground wire), and avoid sending it in a reverse direction to devices that would be ruined. Your automatic system must be constructed so its wiring is compatible with your present system.
Yes I just posted an update where I tried to wire the foot switches into an IBT-2 and two IBT-4s, but had no luck with the foot pedal. I did switch the foot pedal out for a trim tab switch to use as a foot pedal instead and I had luck with the two IBT-4s. The up and down on the trim tab controlled cw and ccw motor rotation, I just might need to simplify it to the single IBT-2 and then figure out how to wire in a mode selector like the 7 pin rocker switch or something like that. I also have to figure out how to wire the motor so that it will raise/lower in both automatic and manual modes.

If you have any other ideas or advice please let me know.

Thank you for all your help.
 


Write your reply...

LaTeX Commands Quick-Menu:

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top