Wednesday, June 27, 2018

ESP8266 Breakout Board

The bare ESP8266 chip is cheap, but has non standard pin spacing, and isn't easy to work with. There is a "Bread Board Friendly" breakout for it, but it has a couple of quirks.

1. It's wide enough that it takes the outer rows of pins on a standard solderless breadboard, so you need to connect your wires underneath, then plug the breakout board on top. I'll post a picture of this shortly.

2. Most descriptions for the board claim one of the included 10k ohm resistors (the right one) connect to GPIO2 (which would be wrong) when it's actually connected to GPIO15 (which is correct).

3. The middle "0" ohm resistor is actually a jumper, and needs to be removed if attaching a 3.3v regulator on the back side.

3. I recommend a external 3.3v supply of 600ma or more. As mentioned above, a 3.3v regulator can be attached to the back side, but ....

A number of resources claim the regulator is a LM31117-3.3v 800ma (and some adapter board dealers even include one). That part will not work, as pins 2 & 3 are reversed. You need a AP7215 (AP7215-33YG-13) 600ma 3.3v SOT-89 regulator. I do wish input and output capacitors (1uf is fine) would have been preinstalled on the board, or at least pads for them. Place one between pin 2 and gnd, and the other between pin 3 and gnd. Alternatively, you can use a external 3.3v regulator or module, as I am doing.



4. There are still a few more resistors you will have to add:
    GPIO0 to VCC with a 10k ohm
    RST to VCC with a 10k ohm
    RST to Gnd through a momentary (reset button)
    GPIO0 to Gnd through a momentary (program button) and a 470 ohm in series.



5. You will need a ttl serial programmer.

The good news is that it's very easy to solder the ESP8266 to the adapter if you have a fine point soldering iron.

Additional references:

https://tttapa.github.io/ESP8266/Chap02%20-%20Hardware.html

https://www.esp8266.com/viewtopic.php?f=13&t=6505



Tuesday, June 26, 2018

Coulomb Counting and Amp Hours

Do you need to know how much Energy a device is consuming? How about producing? Maybe you want to keep track of how much juice is left in a battery pack? Now you can know!

Cliff Note version:
Take a Amp reading every second (Coulombs). Add those readings together (running total). Divide total by 3600 gives you Amp Hours. Multiply by the Volts to get Watt Hours.

Building battery "Fuel Gauges" is simple when you use Coulomb counting. A Coulomb is equal to 1A * 1s, so if your current sensor records a 5A draw this second, that's 5 Coulombs. If draw is steady for a minute, that would be 300 Coulombs (5 * 60), and if for an hour, 18000 Coulombs (5 * 60 * 60). 18000 / 60 / 60 = 5 Ah
If over two hours, you count 36000 Coulombs, 36000 / 60 / 60 = 10 Ah. So take the total Coulombs you have counted for whatever period of time period you choose, and divide by 3600 (60 * 60), that gives you your Ah charge (or discharge).

The following code simulates a current sensor reading as a fixed rate (0.5A). It prints the Coulomb totals every second, and the running Ah total.

Code Link

Stay tuned as we combine this with a current sensor and a voltage divider to get Amps, Volts, Ah, and Wh readings.

ACS715 Current Sensor Project

ACS712 Current Sensor Project

Current sensing with a shunt
Related Posts Plugin for WordPress, Blogger...