The zeigometer is an autonmous device that can show a value on a scale. It can be made of a an ESP8266, a servo motor, a powerbank or battery and some housing - I used an ice-cream package for this.
The servo motor is connected to an ESP8266, reads analog values from an MQTT Broker and sends the value to a servo that visualizes the value on a scale. The project is mainly inspired by the pingo meter project from the Raspberry Pi Magazine.
Here is what the device actually does.
- Power on
- Connect to a pre-configured Wifi-AP
- Fetch a message from an MQTT Broker from a given topic. The message type must be an integer value between 0 and 100. Use retained messages when posting to this topic such that the client receives older messages.
- Adjust the needle connected to a servo motor to reflect the value - 0=left, 100=right.
- Go into deep sleep for some pre-configured period of time.
- Awake and start from the beginning.
- The servo is connected to the VCC and Ground for power supply.
- GPIO12 (or what ever is configured) is used as PWM pin for controlling the servo.
- GPIO16 and RESET are connected to awake the ESP8266 from deep sleep mode. GPIO16 is the only pin that can be used for this purpose.
- Power supply via VIN. Since this pin is controlled by a power regulator, up to 10V can be used.
Move config_sample.py to
config.py and adjust
the values. The file contains comments that explain what the purpose
of the values.
The ESP8266 needs to be flashed with a Micropython firmware.
The servo is hosted in a plastic ice-cream package. A hole was drilled to stuff the motor through. The servo itself is glued to the cover with hot glue.
Finally a scale is made that hides the shitty cover. Here is the template file for this.
As the the device should work autonomously it still needs some power. The easiest way to do this would be to use a small powerbank. However, since the ESP8266 has very low power consumption of about 20 µA in deep sleep mode, the powerbank may turn itself off automatically.
The VIN pin of the nocdemcu devkit is connected to a power regulator. Therefore a single 9V battery or a 4 x 1.5V battery pack can be attached to power the board.
An article at Henry’s Bench explains different possibilities in powering the nodemci-devkit board.