this post was submitted on 28 Jul 2024
17 points (100.0% liked)

Ask Electronics

3325 readers
1 users here now

For questions about component-level electronic circuits, tools and equipment.

Rules

1: Be nice.

2: Be on-topic (eg: Electronic, not electrical).

3: No commercial stuff, buying, selling or valuations.

4: Be safe.


founded 1 year ago
MODERATORS
 

I have one of those basic motor kits you can buy off of Amazon. I was wondering what steps I should take to make it so that I can turn the motor on/off with the press of a button, wirelessly.

I'm still very new, so any information you can offer no matter how basic will probably be useful to me.

top 6 comments
sorted by: hot top controversial new old
[–] [email protected] 15 points 3 months ago* (last edited 3 months ago) (1 children)

Easiest and cheapest way will probably be an ESP32 board. For your needs the ES32-S2 Mini or the ESP32 S3 Mini is more than enough.

Both can be bought from Aliexpress very cheap (< 5$) here and there with fast shipping. To be fair it isn't worth to buy any electronics form Amazon, you're looking are resellers that just mark up the price from Aliexpress.

In order to have it control the motor you'll also need a relay or a transistor because you can't drive the motor directly from the ESP32 GPIO pins as they are designed for signals and not power.

Choosing between a relay or transistor will depend on the power and voltage your motor requires. For a large motor here's a tutorial with a relay: https://randomnerdtutorials.com/esp32-relay-module-ac-web-server/. You can find a cheap relay here.

If you're talking about a cheap 5V or 12V DC motor that runs of a few mA then a transistor like the BC517 or the 2N2222A will be enough and very cheap. The circuit should be something like this:

The 1K resistor is optional but advisable and on the picture the 3v3 DC that is powering the motor can be whatever power supply voltage your motor already has assuming it is bellow 30V. If you're above those voltages use the relay circuit above.

The software should be the same for both the relay or the transistor, just look up at the example.

[–] [email protected] 6 points 3 months ago* (last edited 3 months ago) (1 children)

Don't forget a flyback diode at the inductive load or your transistor will bacon at midnight.

[–] [email protected] 4 points 3 months ago

Fair enough:

[–] [email protected] 5 points 3 months ago

You can use rc kits, hobby stores will have relatively simple systems designed for custom rc cars that you can plug and play

In the same vein you can always find alert cheap rc cars at your local second hand store, goodwill has em for afew dollars and you can scavenge whatever you want

These days though I prefer an esp32 or an arduino with a Bluetooth shield, much easier to work with

[–] [email protected] 4 points 3 months ago

Broadly speaking, you probably want some kind of relay either mechanically switched or electronically (e.g. with MOSFETs). Most people would prefer an electronic one as they won't make a "clack" noise when turning on or off. Electronic may or may not be more expensive, it depends on the rating.

The key factor will be getting one that is rated to the voltage and current draw of the motor. If the motor is AC powered (e.g. 240V) and is rated at 1200W, then you will need a relay rated to 10A. Same thing goes for DC, just smaller numbers.

You should be able to find some kind of wireless relay on Amazon as well. There are plenty of WiFi ones I'm sure if you want to use an app. There's probably also an assortment of radio ones if you want to use a fob key. The easiest would be to look for something that is a kind o "inline adaptor" so that you plug it between the power and the motor, and it powers itself.

[–] [email protected] 2 points 3 months ago

IANAEE. For an on-board application you can create a simple switch with a transistor. https://www.electronics-tutorials.ws/transistor/tran_4.html

To make something wireless you'll probably want to go with a microcontroller or Raspberry Pi and hook up GPIO pins to the motor controls. A transistor wouldn't be needed in that case as the microcontroller can hold the pin high or low depending on what state you want.