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.

  • TCB13@lemmy.world
    link
    fedilink
    English
    arrow-up
    17
    ·
    edit-2
    4 months ago

    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
      link
      fedilink
      English
      arrow-up
      8
      ·
      edit-2
      4 months ago

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