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

Ask Electronics

3350 readers
2 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 2 years 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
[–] TCB13@lemmy.world 17 points 4 months ago* (last edited 4 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. They can be easily programmed with the Arduino IDE.

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.

[–] tofubl@discuss.tchncs.de 8 points 4 months ago* (last edited 4 months ago) (1 children)

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

[–] TCB13@lemmy.world 4 points 4 months ago

Fair enough:

[–] 0x01@lemmy.ml 5 points 4 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

[–] pryre@lemmy.world 4 points 4 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.

[–] theit8514@lemmy.world 2 points 4 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.