What’s the right approach to control the speed of this small 3V DC motor connected to a Wemos D1 Mini? It’s a simple 3V two-wire motor (no PWM), but changing the supplied voltage varies the speed. Would Speed Fan work or is there a better component for this?
Yes that would work. Note however you can expect these motors to draw approx 200mA, your GPIO pin is rated for 40mA.
Thanks, where can I find the max ratings for the board’s GPIO pins and the motors? Is the concern that it could overheat the port/board or just not work?
Here’s what I tried
output:
- id: marble_tower
platform: gpio
pin: D8
fan:
- platform: speed
name: "Marble Tower"
output: marble_tower
…but I get this error:
ID ‘marble_tower’ of type gpio::GPIOBinaryOutput doesn’t inherit from output::FloatOutput. Please double check your ID is pointing to the correct value.
If gpio is not the proper platform to generate a float output, what should I be using considering it is wired to a GPIO pin?
If you want to control the speed, you need to use a PWM output:
GPIO platform is for binary outputs - you would use that with a switch component, which then would only be on and off.
If you want to vary the voltage output you will need to switch to an ESP32 and use a DAC. Note that for a simple motor PWM will sometimes work as well as a DAC.
Ah, SOFTWARE PWM. Nice, thank you. This worked:
output:
- platform: esp8266_pwm
pin: D8
frequency: 1000 Hz
id: marble_tower
fan:
- platform: speed
name: "Marble Tower"
output: marble_tower
Where can I find the max ratings for the board’s GPIO pins and the motors? Is the concern that it could overheat the port/board or just not work?
Overheat. The ESP8266 specs are on the Espressif website. As for the motor, Google “dc 3v n20 micro speed gear motor stall current rating”. The no-load current may be within spec but the stall current (max load current) may be your issue.
A simple motor driver circuit can be made with only 3 or 4 components if it becomes an issue. Here’s one but you can find heaps with a Google search:
OK, thanks.
I searched for the max rated current (“current”, “amp”, etc.) in this document ( esp8266-technical_reference_en.pdf (espressif.com)), but came up empty. What should I be looking for in their Technical Documents library if not the “Technical Reference Manual?”
For those who may stumble upon this post in the future, here’s a good article on the terms - How Do I Interpret DC Motor Specifications? - Let’s Make Robots / Tutorials - RobotShop Community.
Here is the Hardware Design guide for the ESP8266. It doesn’t say what the maximum draw per pin is though, just states the power requirements on average for the whole chip.
There’s the FAQ as well - again there are numbers in the hardware section but nothing definitive.
I guess run it, monitor the unit and see what happens. If you start with an ESP12E it’s only cents lost if it blows up.
LOL. That’ll be the plan. I’m using the motor in one of these:
It won’t run continuously, but I’ll take some measurements especially to see the current draw at startup.
It does seem strange that the per pin specs are so hard to find, but I saw a couple references on Google searches to as low as 12 mA per GPIO pin, but that seems prohibitively low.