• Parts Assembled

    Patrick Graham11/05/2016 at 18:28 0 comments

    I've assembled the parts on a breadboard and written just enough code to test each component. I've also learned the very basics about how to create a rechargeable IoT device that reports it's battery status, though I still have a lot more to learn.

    The battery is a 3.7V Li-Ion 18650, which when fully charged will output 4.2V. I decided to add an MCP1825S, an LDO regulator, which will regulate the power coming from the battery to a constant 3.3V because I don't know what to expect if I don't. Probably blue smoke. I'll be using the one analog input on the ESP8266 to measure the charge left on the battery.

    The analog input seems to be reading a 10 bit value from 0V-3.3V, but I read that the pin is only rated to measure accurately between .1V and 1V. To bring the reading into that range I added a voltage divider so the maximum charge of 4.2V on the battery will read as 1V. The voltage divider consists of a 22kΩ and 10kΩ resistors in series coming from the battery to a junction, which then connects to the analog pin and to another 10kΩ resistor that goes to ground.

    Once I got this working I tested it out by flashing the ESP8266 with an arduino sketch that would measure the reading and display it to the TM1637, the 4 bit 7 segment clock display. I also tested out connecting a button and a buzzer. I hadn't even seen this documented elsewhere, but variables for the NodeMCU pins were already mapped. This must be part of the board definition. I found this out when I went to create variables for mapping each pin index to what is written on the NodeMCU. So instead of using the number 16 to refer to the GPIO16 pin when calling digitalWrite, for instance, I can just say D1. I talked to a few other people who have been deploying arduino sketches to the NodeMCU and they didn't realize this either. I still haven't tested this out for the non-GPIO pins, but it seems like some of the most popular tutorials skip this detail or maybe its just a more recent improvement.

    Now that I have the basic setup complete I'm going to try creating some schematics for it using Fritzing. I'm having a little trouble figuring out how to create new parts for Fritzing, but it seems like most of the work is done outside of Fritzing using your vector editor of choice. I'll try to have the sketches ready for my next post.

  • First Prototype Parts Received

    Patrick Graham10/17/2016 at 19:35 0 comments

    I've decided to kick off this project by connecting a TM1637 4 bit led clock display module up to a NodeMCU. I found an arduino library for the TM1637 and was up and running with a timer that ticked up in no time.

    I love the ability to flash Arduino code onto the NodeMCU through its built in USB. It's especially nice after the pain and suffering involved in trying to flash a the ESP8266 by pulling some wires high and others low. It always took me several tries before getting it working because of the difference between different modules for the ESP8266.

    After getting a working display I added a single 18650 battery, and everything lit up OK when I connected it to the 3.3v pin on the NodeMCU. I also purchased a TP4056 recharging board for the battery. I'm going to look into what it takes to measure the charge on the battery, but I think I would like to be able to know what percentage the battery is at.

    I also received some arcade push buttons in 4 different colors that light up and have a great feel to them. The only thing I'm unsure about is using the arcade mount format for a button, since it takes up a whole lot of space and I don't know how large or small I want to make the finished clock yet. I may switch out the button for a capacitive touch

    The first prototype of the clock will incorporate these parts in such a way that it will have a single 4-bit display, one button that lights up to indicate the clock is counting, and one micro usb port for recharging.

    The plan for my next update is to have all of these parts assembled and loosely held together in some fashion while I work on my first few iterations of the firmware. In particular, I'm looking forward to learning more about how to create a rechargeable IoT device that reports it's battery status.