8S Arduino Cell Monitor

Become a Patron!

Introduction

Like all my other projects, I’ve decided to create my own custom version of a cell monitor. Here we have an 8S arduino based voltage cell monitor that I designed to allow the user have control on how they monitor there batteries and how its displayed.

Its a very basic and not a lot of bells and whistles but still powerful enough to allow you to monitor cell voltages with accuracy and precision. This project is open source and so you will have the ability to add features or change them.

Specifications

  1. Cell count: 8
  2. Battery type: Li-ion, LiFePO4, NiMH
  3. ADC resolution: 16-bit
  4. Voltage measurement resolution: 1mV accuracy
  5. Fault detection: Over-voltage, Under-voltage
  6. I/O: 1-CH Digital output

The main purpose this is designed for is to measure an 8S Lithium Iron Phosphate pack up to 1mV resolution.

Hardware

Now here is were the fun part starts with the hardware used to create this DIY cell monitor. The main sections we will talk about are:

  1. ADC
  2. Power Supply
  3. MCU
  4. Menu Button Controls

ADC

Here we talk about the most important part of the project and that’s the ADC section. I’ve decided to go with two external 16-Bit adcs instead of the internal adcs of the arduino.

Since we need to step down the voltage from 30V max and need the best resolution possible. If we go with the internal adcs of the arduino, with a 10-Bit ADC we will only have resolution of 17mV/Bit. Now with 16-bit adcs, we have a resolution of 0.9mV/bit which is a huge increase.

I’ve decided to go with the ADS1119IPWR which is a 16-bit I2C adc. See below for a snip-it of the schematic:

ADS1119IPWR 16-Bit ADC x2

Power Supply

In the power supply section, we have a small profile buck converter that can handle up to 36V input. For this version I did not add a series fuse for the input of the buck converter but will add in second version. One this that was added was a tvs diode to protect the buck converter.

One thing I noticed is that when you plug anything into a high capacity battery bank, you need to protect your circuit from inrush current that causes a quick spike in current voltage that could damage your circuit before you even start. Adding a TVS diode will clamp this voltage and protect your circuit.

MCU

As the title implies, we are using the Atmega328P running the minicore bootloader https://github.com/MCUdude/MiniCore .

One thing I did change from the standard arduino board is use a cmos oscillator instead of the typical crystal oscillator. Honestly this is mostly a preference but it can be modified to use the typical crystal.

Menu Button Controls

Here is the schematic section for the control buttons. Its a little more complex than the typical push button design but this helps a lot with debounce.

We have a two stage design used to eliminate electrical debounce. First we have a passive RC low pass filter and then an inverting logic gate which adds some buffer to further reduce any false triggers.

Below is the full caption for all 4 input buttons:

Software

Normally I would breakdown every section of the code but its too large to fully go through the code. But I will go over the important sections:

  1. Menu controls
  2. ADC calibration

Menu Controls

In the control menu you are able to set the UVP value for cells and pack as well as the OVP value for cells and pack. In order to get into the menu screen you need to press the menu button and hold for about a second or two.

Once you are in the menu screen, you can navigate using the up and down buttons. Now even though I have the debounce circuit and a small software delay, the movement is still not smooth but it sufficient to operate.

In order to change the values, navigate for example to the OVP value with the arrow and then click the enter button to enter the OVP value screen. Using the up/down buttons you can increase or decrease the value by 0.05 increments. Once you are satisfied with your value then you can save the value by pressing the enter button and this will save to EEPROM so that its store permanently even after the power is removed.

ADC Calibration

Now before you can get accurate measured values, you need to calibration each ADC input to fix the offset from each IC.

You can calibrate using the serial monitor with an FTDI board connected to the UART port of the cell monitor.

The simplest way of calibrating each value is to measure each cell with a multimeter and write down the values.

Next, in the serial monitor, you need to enter the following:

1002, (cell 1 value), (cell 2 value) , (cell 3 value), (cell 4 value), (cell 5 value), (cell 6 value), (cell 7 value), (cell 8 value)

example: 1002,3.111,3.154,2.967,3.546,2.567,3.222,3.234,3.555

Make sure not to include spaces as this will not calibrate if you do.

After the calibrate is complete, calibrated values are stored in EEPROM so that after power is removed then the board is still calibrated.

Conclusion

Even though you can buy an 8S lithium battery monitor with probably more features, this one gives you more flexibility and also the confidence that its doing what it is suppose to do.

If you have any comments, suggests, or feedback let me know in the comments below. Thank you.

Here is the link to the schematics and code on my github:

https://github.com/simple-ee/CellMonitor

OCP and UVP Protection

I strive to provide my content for free without using ads as I personally do not like ads in most website. If you can afford to donate anything via Paypal i would great appreciate it. Thanks:

INTRODUCTION:

This project was created in order to provide protection for my battery projects. I didn’t really trust the cheap low cost protection boards you find online so I decided to try and create my own.

The protection board I’ve designed has bidirectional current detection (can detect charging and discharging currents) which in turn means you can set independent OCP( over-current protection) for discharging current and charging current.

One thing to note before hand is that the current maximum current that can flow is about 5A due to lack of heatsink on the powerFETS. Adding heatsink is necessary to allow more current

Main features:

  1. Over current protection with output latch open when tripped
  2. Under voltage protection for the whole battery pack
  3. Theoretically 45-50A pass-through current ( will require heatsink)

In the next sections I will discuss in more detail this project.

SPECIFICATIONS:

Here are some more technical details of this project

Minimum input voltage (V)10
Maximum input voltage (V)34
Maximum current (A)50A*
Quiescent current (mA)**
Undervoltage protectionYes (adjustable)
Overcurrent protection Yes (adjustable)
Short circuit protectionYes***
Overvoltage protectionNo

*Maximum current passing through this board will depend on sizing and adding a heatsink to the power mosfets

**Quiescent current has not been measured yet but it is below 1mA during normal operation with a 4S battery. This will change slightly when using more cells in series

***Theoretical the supervisor IC will latch when the overcurrent protection section detects its threshold. This will need testing to confirm

SCHEMATIC AND CIRCUIT DETAILS

Here in this section I will discuss the project in more detail by talking about the different sections used to create this whole circuit.

Lets first discuss the over-current/short-circuit protection sections of the circuit:

Bidirectional Current sensor

Here we have the heart of the over-current detection. We have the MAX4081FASA which is a bidirectional current sense IC that can handle a max VCC of 76V which is more than enough for our applications. The FASA has an internal gain of 5V/V coupled with a 10 milliohm sense resistor value ( I have two 20 milliohm in parallel for size reduction) this will allow the sense current of up to 50A.

REF1A is tied to 5V reference IC and REF1B to ground. With this we have a bias point of 2.5V meaning that when no current is passing the voltage on the OUTPUT pin 5 is 2.5V. When current is discharging into a load the output will rise up to 5V being the 50A max. When current is flowing the other direction to charge the batteries then it will go below 2.5V to 0V being 50A max.

In order to both detect charging and discharging current since I will be using this for a battery pack, I had to create a circuit that detects both an upper limit and lower limit. Hence I went with a window comparator to detect charge and discharge values.

Window comparator with latching supervisor IC

Here is where you can adjust your own over-current detection points for charging and discharging and they can be set independently from each other. The idea here is when the output from the max IC is within the window of the voltage values you set from the voltage divider values on pin 3 and pin 6, the output of the opamp will be high. As soon as the output value goes above or below those set points, it will pull the output of the op-amp low and trigger the supervisor IC.

The supervisor IC is very important because this is what controls the power mosfets allowing current to pass through. This one is different from normal supervisor ICs because when this triggers, the output is latched low and this pulls the power mosfets high causing them to stop current flow. The only way to clear the fault condition is to pull the clear pin 1 to 5V. What I have done is add the option for a push button on the board directly or pads to run the clear pin trigger somewhere else.

Here is a simple equation to calculate the discharge current detection resistor values on PIN3 of the op amp:

(0.05 V/A * X) + 2.5V = VdetectHigher ; X = current trigger desired

For charging current detection here is the equation for the lower voltage detection of the op amp PIN 6

(0.05 V/A * X) – 2.5V = Vdetectlower; X = current trigger desired

Here is the power mosfets controlled by the supervisor IC. When no fault condition is triggered then the supervisor IC pulls Q4 to high causing the 10k resistor to be tied to ground. This then creates a voltage difference between the gate and source for the powerFETS allowing current to flow. When an overcurrent fault condition is triggered the supervisor IC is then pulled low and Q4 stops conducting which in turns unties the 10k resistor from ground and makes the gate and source the same potential.

Now the under-voltage protection scheme works by using a different supervisor IC measuring the input voltage. When the voltage falls below the threshold then the output pulls low and stops current flow in the powerFET

Here you see this circuit in action. A voltage divider is used to bring down the input voltage of the pack to a range the supervisor can handle. I have defined some voltage divider resistor values for different size battery packs in which it will trigger when the threshold is hit. I only used one MOSFET for this because this will stop discharging current but will allow charging current to flow via the body diode until the input voltage is above the threshold and then turn on the mosfet.

Here you have to take some precautions not to kill the mosfet when an event triggers an under-voltage event and you try to charge the pack.

When an event happens, start charging the pack with 0.5A-1A until there is about 1V above the under-voltage value. Then maximum current charging can be applied. This part of the circuit will need more tweaking in the future

CONCLUSION / IMPROVEMENTS

Hopefully this project will help someone out. I created this to help protect my batteries and to allow the flexibility to adjust as much values as I can and have as much control of my protection circuitry as possible. Of course this is not perfect and I am still working on improvements.

IMPROVEMENTS:

  1. Figure out a way to protect Under-voltage powerFET from getting damaged when charging through the body diode initially until the supervisor IC allows current to flow through the FET and not the body diode
  2. Use DPAK powerFETS instead of IPAK due to cost. Size increase is negligible or non-existent
  3. Create a heatsink to provide maximum current discharge through mosfets. Currently the maximum current discharge without heatsink is roughly 5A without getting too hot. Will do testing after its completed.
  4. Perform thorough testing and post results.

DOWNLOAD DESIGN FILES:

Download Here:

Arduino 4S BMS: UPDATE (Version 5)

UPDATE:

This is an updated post regarding my 4S arduino based lithium ion balance management system (BMS).

If you click here, you will see the original post with details on the project.

IMPORTANT CHANGES:

  1. Replaced external voltage reference to a more stable one. Upgraded to a REF3012AIDBZT from Texas instrument.  This does not require an output capacitor for stability.
  2. Modified Buck converter RT6208GE.  Grounded pin 4 to set the max peak current to 50mA which is an average current of 25mA.  This was done to eliminate audible oscillation from the buck converter
  3. Increased copper traces for ADC pins A0-A3
  4. Better layout to increase continuous copper plane on internal layer

Minicore bootloader

updated 01/13/2019: For the new arduino version, load bootloader with 8MHz clock. I did more testing and this was more stable and accurate on the adc then the 1MHz clock setting.

I will be doing testing on these new versions and see how they perform.  I will post results as soon as I can.  Also below I will attach all files needed (schematics, gerber, bom) if you wish to make your own. 

Arduino Code Download

updated 01/13/2019: Download arduino code version A15.

Schematic and Gerber Download

CNC: CNC CONTROL BOX

btn_donateCC_LG.gif

SUMMARY

1. Introduction

2. Bill of Materials

3. Block Diagram

4. Schematics/CAD DESIGN

5. Assembly

6. Final Thoughts/ Improvements

7. Download Original Files

INTRODUCTION

Arduino and the implementation of GRBL has allow for amazing things to be created.  One of those things are low cost CNC machines that enable us to create anything we want.

I bought myself a low cost CNC engraver from amazon and after modifying it, it has been one of my best investments because as en electrical engineer I can create PCB boards to test my designs here at home and verify before getting them sent out. One problem I usually have is that I use my laptop to run the gcode software and my laptop is really big and sometimes a hassle to keep on my desk.

My solution was to create this project and make a standalone CNC machine controller to run the gcode software in a compact package.  I tried fiddling around with using a raspberry pi 2 as my main PC but I’m still a beginner with raspberry pi’s and I had issues getting the settings right.  My next option was to use a windows based machine and luckily I found just the solution.

In this tutorial I will explain how I put this together and what improvements could be made.

BILL OF MATERIALS

Component Quantity Link
Windows computer stick 1 Amazon
Wireless keyboard/mouse 1 Amazon
DIY HDMI male adapter angled 1 Adafruit
DIY HDMI female adapter 1 Adafruit
DIY HDMI Ribbon cable 20cm 1 Adafruit
3.5 inch Screen 1 Amazon
Left angled micro usb cable 1 Amazon
Top angled usb 3.0 extension 1 Amazon
USB Board
USB Female Connector 2 Sparkfun
5VWM TVS Diode 1 Digikey
0.1uF 50V X7R 1206 1 Digikey
1uF 25V X7R 0805 1 Digikey
10uF 16V X5R 0805 1 Digikey
100 OHM 0.1% 1/8W 0805 2 Digikey
TERM BLOCK 5MM 2POS 2 Digikey

BLOCK DIAGRAM

Visio_blog - block diagram

Here is the block diagram for how this project is wired.  With the exception of the enclosure itself and the usb power board, everything was bought ready to go.  I’ve added a fan as a just in case because the computer stick does generate some heat so the fan will prevent the system from over heating but so far it does not seem to be an issue with heat and therefore is an option.

The 5V and 12V supply are coming from my 24V power supply that powers my Arduino GRBL shield.  What I did was use two step down converters 1) For 5V step down and 2) For 12V step down.  I realized this might not be idle but it is my first revision of this project.

SCHEMATICS/ CAD DESIGN

The only schematics I have is for the USB power board and I created that using Kicad.  The board was basic, since both the screen and the windows computer stick ran on 5V via micro USB, I needed to distribute power from one source into two loads.  To add some safety, I did add a TVS 5VWM diode to prevent over voltage spikes from destroying the devices along with some filtering capacitors.

Electronics_pdf - cnc usb power board-1

If its a little blurry don’t worry because all original files will be included in a download link at the end.

Now for the enclosure, I designed it using Fusion 360.  Honestly, I am not a Mechanical engineer/Designer so this was my first attempt at designing something in a CAD software.  Mine you its really just a box but Fusion 360 makes it really easy to design for someone who had no prior experience.

I designed this in two pieces:

  1. The bottom portion of the enclosure:CAD_pdf - Enclosure Drawings-1
  2. The Lid for the enclosure:CAD_pdf - Lid Drawings-1

For material used for making this enclosure, I used my Maker Select V2 3D printer with PETG filament for the temperature resistance and flexibility.

I will include the STL files so you guys can 3D print this yourself.

ASSEMBLY

Now for the fun part, putting this thing together and hoping everything works without the magic white smoke lol jk.  This was actually very easy to put together though there were a couple of design hick ups.

Since I wanted to get the print out as fast as possible, I sacrificed quality of the print which is why it looks the way it does but its very function.

As I mentioned I did have some design issues after I was putting this thing together.  If you look at image 3, you can see that the usb power board is tilted up and thats because I placed the cooling fan to close.  The board was able to fit but I could not connect anything because the fan was blocking the connectors.

I decided to use hot glue to hold everything down because it wouldn’t be a DIY project if hot glue wasn’t involved.

In image 4, you can see I used some basic terminal block connectors to attach my 5V and 12V supply.  You can also see the USB port to connect the arduino grbl controller board.

FINAL THOUGHTS/IMPROVEMENTS

Overall I enjoyed putting this project together.  It’s made my project efficiency increase dramatically because I don’t have to take it out and set it up every time I want to make a board.

With anything we do, there’s always room for improvements.  In a future version of this project I plan to improve the way I connect my external 5V and 12V supply instead of using the terminal blocks.  I might possibly use some type of molex connector that can easily detach.  To reduce the amount of external connectors, I could switch out the 12V fan with a 5V fan and run it with only one step down converter.  I’m going to also move the fan placement so that I do not have to angle the usb power board.

DOWNLOAD ORIGINAL FILES

Bill of Materials

KiCad files

3D STL files

PDF Documents

Thank you for visiting and I hope you enjoyed this project.

Please leave a comment and let me know about your thoughts, improvements or any issues you see with this post.  All comments are welcomed 🙂

Arduino – Garage Door Indicator

First I would like to say thank you in advance for visiting my site.  My goal is to help anyone who loves to work with electronics.

btn_donateCC_LG.gif

TABLE OF CONTENTS

1. Introduction

2. Bill of Material

3. Block Diagram

4. Schematics

5. Arduino Uno sketch and upload

6. ESP8266 sketch and upload

7. Final thoughts

8. Download original files

INTRODUCTION

I don’t know about you guys but when it comes to closing my garage door I always seem to forget.  Most of the time I don’t even notice until the night before I head to bed.  I was getting tired of leaving it open so then I was inspired to create this project.

The garage door indicator project essentially sends you a text if the garage door is left open for more than 5 minutes.  It uses an arduino, ESP8266, and IFTTT to remind me that I left it open.

Lets get started!

BILL OF MATERIAL

Board Part Quantity Link
Arduino Board
 Arduino Pro Mini 1 Amazon
ESP8266 Board
ESP8266 ESP01 1 Amazon
RC1206JR-0710KL 4 Digikey
C1206C104K5RAC7867 2 Digikey
Boost Converter #1: Arduino Board
GRM21BR61E475MA12L 1 Digikey
MCP1640T-I 1 Digikey
GRM21BR61C106KE15K 3 Digikey
RC0805JR-07560KL 1 Digikey
TC33X-2-105E 1 Digikey
MSS5131-103ML 1 Coilcraft
Boost Converter #2: ESP8266
AAT1217ICA-3.3-T1 1 Digikey
GRM21BR61E475MA12L 1 Digikey
GRM21BR61C106KE15K 3 Digikey
RC1206JR-071ML 1 Digikey
MSS5131-472ML 1 Coilcraft
Switch: ESP8266 Power
DMG2305UX 2 Digikey / Arrow
2N7002-7-F 1 Digikey
RC1206JR-0751KL 1 Digikey
RC1206JR-0710KL 1 Digikey

BLOCK DIAGRAM

Electronics - Garden_Block diagram_01

Here the block diagram gives you a general idea of how this is connected together. I’ve made this project very modular so upgrades and replacements are easy to do.  I decided to go with two boost converters because the ESP8266 has a lot of noise issues that always messed with my arduino board and so separating the supplies and the controllers from each other did the trick.

SCHEMATICS

Below I’ve listed all the schematics that are associated with this design.  I’ve designed this project to be very modular because I CNC mill all the boards and it makes it a lot easier to work with.

If you click on the schematic images, i’ll take you to the pdf version that you can download.

Arduino nano board:

Arduino Board

ESP8266 Board:

Electronics - ESP8266 Board

Boost Converter #1:

Electronics - MCP1640

Boost Converter #2:

Electronics - AAT1217

Switch: ESP8266 Power:

Electronics - Switch ESP8266

ARDUINO NANO SKETCH

Here is the arduino sketch used in the garage door project.  Essential the arduino nano is used to first sense the status of the garage door and second to wake up the ESP8266.

The way this sketch is written is the arduino is put into an 8 second sleep state because thats the longest the watchdog timer will fire.  This is then looped in that adds up to 5 minutes.

The reed switch is connected to the interrupt pin 2 on the nano and is used to wake up the arduino  when the door is open.  Then a counter will start counting and when 5 minutes are up that the door is left open, this will activate the switch that will turn on the ESP8266.


#include "LowPower.h"

int ESP8266 = 10;

int Open = 2;

int x = 0;

void setup()

{

  pinMode(ESP8266,OUTPUT);

  pinMode(Open,INPUT);

  digitalWrite(ESP8266,LOW);

  delay(500);

}

void loop()

{

  // put your main code here, to run repeatedly:

    // Low power sleep mode is used here to put the arduino

    // in an 8s sleep state

    LowPower.powerDown(SLEEP_8S,ADC_OFF,BOD_OFF);

    if (digitalRead(Open) == HIGH)

    {

      x = x + 1;

    }

    // Here is the value entered that will

    // set the time it takes for it to

    // wake up the ESP8266

    // 2 minutes = 15

    // 4 minutes = 30

    // 5 minutes = 39

    // 10 minutes = 80

    if ( x == 39)

    {

      digitalWrite(ESP8266, HIGH);

      delay(10000);

      digitalWrite(ESP8266,LOW);

      x = 0;

    }

    if (digitalRead(Open) == LOW)

    {

      x = 0;

    }

    delay(100);

}

All sketches and libraries will be attached in the links at the end of the post under download files

ESP8266 SKETCH AND UPLOAD

After the arduino nano is configured to wake up the ESP8266, the next thing we will do is load the sketch for the ESP8266.

Now before we go into the sketch, we first need to setup an account with IFTTT.com.  After that is done then we need to create a new applet.

IFTTT - New Applet

Next, we click on If this:

IFTTT - If this

Next, we search for webhooks service:

IFTTT - Webhooks

After that, we create the trigger.  Here we enter “Door” as our trigger:

IFTTT - Trigger

Now we need to create the action, in this case send a text when this is activated.  We click on THAT now:

IFTTT - That

We search for SMS and click on the first one:

IFTTT - SMS.PNG

We now set the action, leave it as is and click on create:

IFTTT - Event.PNG

Then you click finish.

In case your phone number is not set, lets go to search:

IFTTT - sms_number.PNG

And we click on settings and edit.  Here you enter your phone number you wish to receive your text:

IFTTT - Pin.PNG

Now the last and most important part, we need to get your “mykey” needed to link ifttt with your esp8266.

We go to search again and this time type in webhooks.  Then you go to settings and you copy the highlighted key into your ESP8266 sketch:

IFTTT - Webhooks_mykey

Now you are ready to continue to the sketch.

Here is the sketch for the ESP8266.

Original sketch was taken from this link and modified slightly for my project.


///////////////////////////////////////////////////////////////////////////////////////////////////

// Name: Steven Guzman

// Date: 12/13/2017

// Description: ESP8266 code for sending a message over to IFTTT that the garage door is open

///////////////////////////////////////////////////////////////////////////////////////////////////

#include <ESP8266WiFi.h>

#include <arduino.h>

#include <SPI.h>

#include "DataToMaker.h"

#define SERIAL_DEBUG // Uncomment this to dissable serial debugging

// Define program constants

const char* myKey = ""Enter your key right here"; // your maker key here

const char* ssid = "Enter your SSID wifi name here"; // your router ssid here

const char* password = "Enter your password here"; // your router password here

// declare new maker event with the name "ESP"

DataToMaker event(myKey, "Door");<span 				data-mce-type="bookmark" 				id="mce_SELREST_start" 				data-mce-style="overflow:hidden;line-height:0" 				style="overflow:hidden;line-height:0" 			></span>

// LEAVE SET

bool connectedToWiFI = false;

void setup()

{

#ifdef SERIAL_DEBUG

  Serial.begin(115200);

  delay(200);

  Serial.println();

#endif

  pinMode(2,INPUT);

  delay(10); // short delay

  WiFi.mode(WIFI_STA);

  ConnectWifi();

}

void loop() {

  if (wifiConnected)

  {

  debugln("connecting...");

    if (event.connect())

    {

       if (digitalRead(2) == HIGH)

      {

       event.setValue(1,"Garage Door is Open, close it NOW!!");

       debugln("Connected To Maker");

       event.post();

      }

      if (digitalRead(2) == LOW)

      {

        event.setValue(1,"Garage Door is Closed");

        debugln("Connect to Maker");

        event.post();

      }

    }

    else debugln("Failed To Connect To Maker!");

    delay(5000); // pause for 1 second

  }

  else

  {

    delay(60 * 1000); // 1 minute delay before trying to re connect

    ConnectWifi();

  }

}

bool ConnectWifi()

{

  // Connect to WiFi network

  debugln();

  debugln();

  debug("Connecting to ");

  debugln(ssid);

  unsigned long startTime = millis();

  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED && startTime + 30 * 1000 >= millis()) {

    delay(500);

    debug(".");

  }

  if (WiFi.status() == WL_CONNECTED)

  {

    debugln("");

    debugln("WiFi connected");

  }

  else

  {

    WiFi.disconnect();

    debugln("");

    debugln("WiFi Timed Out!");

  }

}

bool wifiConnected()

{

  return WiFi.status() == WL_CONNECTED;

}

void debug(String message)

{

#ifdef SERIAL_DEBUG

  Serial.print(message);

#endif

}

void debugln(String message)

{

#ifdef SERIAL_DEBUG

  Serial.println(message);

#endif

}

void debugln()

{

#ifdef SERIAL_DEBUG

  Serial.println();

#endif

}

Here is the second file needed for the ESP8266:


#include <Arduino.h>

#include <ESP8266WiFi.h>

#ifndef DataToMaker_h

class DataToMaker

{

  public:

    DataToMaker(const char*, String); // constructor

    bool connect();

    bool setValue(int, String);

    void sendToMaker();

    void post();

  protected: // it is protected because the subclass needs access

    //to max distance!

  private:

    void compileData();

    WiFiClient client;

    const char* privateKey;

    String event;

    String value1, value2, value3 = "";

    bool dataAvailable;

    String postData;

};

DataToMaker::DataToMaker(const char* _privateKey, String _event)

{

  privateKey = _privateKey;

  event = _event;

}

bool DataToMaker::connect()

{

  if (client.connect("maker.ifttt.com", 80))

    return true;

  else return false;

}

void DataToMaker::post()

{

  compileData();

  client.print("POST /trigger/");

  client.print(event);

  client.print("/with/key/");

  client.print(privateKey);

  client.println(" HTTP/1.1");

  client.println("Host: maker.ifttt.com");

  client.println("User-Agent: Arduino/1.0");

  client.println("Connection: close");

  if (dataAvailable)

  { // append json values if available

    client.println("Content-Type: application/json");

    client.print("Content-Length: ");

    client.println(postData.length());

    client.println();

    client.println(postData);

  }

  else

    client.println();

}

bool DataToMaker::setValue(int valueToSet, String value)

{

  switch (valueToSet)

  {

    case 1:

      value1 = value;

      break;

    case 2:

      value2 = value;

      break;

    case 3:

      value3 = value;

      break;

    default:

      return false;

      break;

  }

  return true;

}

void DataToMaker::compileData()

{

  if (value1 != "" || value2 != "" || value3 != "")

  {

    dataAvailable = true;

    bool valueEntered = false;

    postData = "{";

    if (value1 != "")

    {

      postData.concat("\"value1\":\"");

      postData.concat(value1);

      valueEntered = true;

    }

    if (value2 != "")

    {

      if (valueEntered)postData.concat("\",");

      postData.concat("\"value2\":\"");

      postData.concat(value2);

      valueEntered = true;

    }

    if (value3 != "")

    {

      if (valueEntered)postData.concat("\",");

      postData.concat("\"value3\":\"");

      postData.concat(value3);

    }

    postData.concat("\"}");

  }

  else dataAvailable = false;

}

#endif<span 				data-mce-type="bookmark" 				id="mce_SELREST_start" 				data-mce-style="overflow:hidden;line-height:0" 				style="overflow:hidden;line-height:0" 			></span>

Make sure to place the datatomaker file code above in the same directory as the ESP8266 code.

FINAL THOUGHTS

Here is the final project assembled:

IMG_20171216_144834.jpg

This project was not designed to be pretty but since I used my CNC machine to mill out the boards I was limited to the one side.  There is an upside to designing it this way, if one or two of the boards happen to malfunction, you can switch it out.  Or if you ever need to upgrade, you can easily swap out what you need to upgrade.

I’m planning on making a professional board and consolidating the boards into one or two boards in the future but for now I’m happy with the results.

If you have any questions please feel free to comment or if you find an error or an issue with anything posted please let me know and I’ll correct it.

THANK YOU!

DOWNLOAD FILES

Project files

ARDUINO: ATTINY85 AS AN ARDUINO AND SLEEP MODE

btn_donateCC_LG.gif

INTRODUCTION

The arduino platform is one of the biggest and most popular platforms used for prototyping.  One of the most popular Arduino boards is the Arduino Uno and for good reasons because its very intuitive and easy to use with plenty of IO pins and analog pins.

With the Arduino uno having 28-pins, sometimes your design or project will only require a handful of IO pins and will need to be crammed into a small board.  That’s when the ATTINY85 IC comes to the rescue.

The ATTINY85 is a low-power, 8-bit AVR microcontroller.  Its a great little micro controller that can be programmed with Arduino, though it does have its limitations like a smaller 8kB flash memory instead of the Arduino uno 32kB.  Its is still a great alternative for small not so code intensive projects.

Along with having a small package, if you run this off battery you want to make sure it’ll last more than a couple of days.  To fix this issue, we can implement a sleep cycle and wake it up using a watchdog timer that’ll make it last for easily over a year on 2 AA NiMh batteries.  Below I’ll add the sleep code you can paste into your own to add a sleep function to your ATTiny85 projects.

BILL OF MATERIALS

  • x1 ATtiny85 – Link
  • x1 Arduino Uno – Link

HARDWARE/SCHEMATIC/CONNECTIONS

Below is a general wire diagram for connecting the Arduino Uno and the ATtiny85 in order to upload your program.  Unlike the Atmega328P used on the arduino, the ATtiny85 does not require a special boot loader in order to upload Arduino code.

Blog - ATtiny85_Arduino

Here is a schematic version below:

ATTiny85_breakout

SETUP

The next step is to download the libraries for the ATtiny85.

Go to file -> Preferences

Under Additional Boards Manager URLs copy and paste this link:

https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json

Preferences

Then click ok.

Next, go to tools -> Board -> Boards Manager

Board Manager

Next, type in ATtiny85 on the search bar and install the ATTinyCore by Spence Konde.  Select the newest version available.

ATtiny85

Now that you have the libraries installed for the ATTiny85 IC, you next need to setup your Arduino uno to be an ISP programmer to upload your code to the ATTiny85.

ArduinoISP

Once you’ve opened up that example code, you upload that sketch file into your arduino.

Next step is to choose the right board before uploading.

REMEMBER TO SELECT ARDUINO AS ISP UNDER PROGRAMMER or your code will not upload to the Attiny85.

Boards_ATTiny85

The last step before being able to upload your code to the ATTiny85 is to make sure your settings in the image above are exactly the same.

ATTINY85 SLEEP CODE


///////////////////////////////////////////////////////////////////////////////////////////

/// Title: Auto Garden Project (Tiny) //

/// Author: Steven Guzman //

/// Date: 5/11/17 //

/// Description: This code can be added to any ATTiny85 project in order to put it into //

/// a sleep cycle //

///////////////////////////////////////////////////////////////////////////////////////////

#include <avr/sleep.h>

#include <avr/wdt.h>

int watchdog_counter = 0; // Used for looping the watchdog timer

ISR(WDT_vect)

{

watchdog_counter++; // Increments the watchdog timer counter

}

void setup()

{

set_sleep_mode(SLEEP_MODE_PWR_DOWN); // Power down everything, will only wake up from WDT

sleep_enable(); // Enable sleep

}

void loop()

{

ADCSRA |= (1<<ADEN); // Turns on ADC in order to read analog values

// 15 = 2 minutes

// 37 = 5 minutes

// 75 = 10 minutes

// 112 = 15 minutes

// 255 = 30 minutes

// Loops the 8 second internal to extend the sleep state

while (watchdog_counter < 15)

{

setup_watchdog(9);

ADCSRA &= ~(1<<ADEN); // Turns off the ADC sleep_mode(); } watchdog_counter = 0; } // This is creating the back end code for running the sleep // function of the ATTiny85. The longest sleep cycle is // 8s //From: http://interface.khm.de/index.php/lab/experiments/sleep_watchdog_battery // 0=16ms, 1=32ms,2=64ms,3=128ms,4=250ms,5=500ms // 6=1 sec,7=2 sec, 8=4 sec, 9= 8sec void setup_watchdog(int ii) { byte bb; int ww; if (ii &amp;gt; 9 ) ii=9;

bb=ii < 7;

if (ii > 7) bb|= (1<<5);

bb|= (1<<WDCE);

ww=bb;

MCUSR &= ~(1<<WDRF);

// start timed sequence

WDTCR |= (1<<WDCE) | (1<<WDE);

// set new watchdog timeout value

WDTCR = bb;

WDTCR |= _BV(WDIE);

}

For some reason the html code doesn’t properly convert the characters, I’ve attached the arduino file here.

UPLOADING SKETCH

Now that you have the code ready. The next thing is to upload your code into the ATTiny85. Simply click on the right arrow in the tool bar and it’ll start uploading.

ATTiny85_Upload

FINAL THOUGHTS

Hopefully this helped you guys learn how to easily use an ATTiny85 with your Arduino code.  They are a little limited in what they can do but if your project is not that complicated and you need to save space then this is the micro controller for you.

Please leave me any comments below let me know what you think.

References

1. Microchip

2. Big Dan the Blog Man

3. Renewable Energy Innovation

Arduino: WiFi Temperature Data Logger

btn_donateCC_LG.gif

Introduction

Lets build a WiFi temperature data logger!!  The reason this project came to mind was because I needed to monitor the temperature of an outside enclosure box that will eventually house a couple of lithium ion batteries.  Can’t have the box get too hot or else we will end up having a nice backyard campfire.

This temperature data logger consist of three sections:

  1. The WiFi web server
  2. The temperature sensor
  3. The sleep controller

Lets get into the project now 🙂

Schematics, PCB, Arduino Libraries can be downloaded Here

Bill of Materials

  • x1 ESP8266 – Link
  • x1 Barometric (BMP180) – Link
  • x1 Atmega328P-PU – Link
  • x1 FTDI to Serial Converter – Link
  • x1 2N7002 – Link
  • x1 DMG2305UX-7 – Link
  • x7 10k Resistor 1206 – Link
  • x3 0.1uF Capacitor 1206 – Link
  • Female Headers – Link
  • x1 28 pin DIP Socket – Link
  • x1 PCB Terminal block – Link
  • x1 3.3V Boost Converter – Link

Hardware/Schematic/Assembly

I’ve designed this project to consist of two microcontrollers.  Its not the most efficient way of doing it but it is effective.  The heart of this project is the ESP8266-ESP01 IC.  It will take in the data from the BMP180 sensor over I2C and send the data over to a web hosting site Thingspeak.com

Schematic:

Webserver - Schematic

The schematic is not that all complicated but it is very effective at trying to save as much battery as possible and deliver my data for viewing purposes.

In order to have this be powered by 2x AA batteries and last longer then a couple of days or weeks, I needed a couple of things to make this possible which is where the second microcontroller comes into play.

First, we need to make sure we have a stable power supply that can provide up to at least 0.3A and have a minimum quiescent current in the low uA range.

Thingspeak.com

Before we get started into writing the code on the ESP8266 we need to set up an account at thingspeak.

Blog - Thingspeak

Click on the signup and fill out the information:

Blog - Thingspeak_2

Click on new channel:

Blog - Thingspeak_3

The most important information to fill out is the fields, in our case we will fill out field 1 and type in temperature.  The name could be any name you want, for this purpose we will write Temperature Data Logger. Once finish, scroll down and click save.

Blog - Thingspeak_4Blog - Thingspeak_5

The final piece of information we need is the API key, for this just click on the API Keys button and copy the Write API Key.

Blog - Thingspeak_6

Now we can move on to the code.

Click here for step by step on installing the ESP8266 arduino addon.[3]

ESP8266 Code


//////////////////////////////////////////////////////////////////////////////////

// Name: Steven Guzman                                                          //

// Date: 4/4/2017                                                               //

// Description: Temperature webserver that will update every 30 minutes to      //

//              thinkspeak with data that shows the temperature of the inside   //

//              of the enclosure.                                               //

//////////////////////////////////////////////////////////////////////////////////

#include <ESP8266WiFi.h&>

#include <Wire.h>

#include <SFE_BMP180.h>

SFE_BMP180 pressure;

char status;

double t, tf;

// Replace with your channel's thingspeak API key

String apiKey = "";

// Enter your wifi information below

const char* ssid = "";

const char* password  = "";

const char* server = "api.thingspeak.com";

WiFiClient client;

void setup()

{

Serial.begin(115200);

delay(10);

// Pin 0 = SDA

// Pin 2 = SCL

Wire.begin(0,2);

WiFi.begin(ssid,password);

Serial.println();

Serial.println();

Serial.print("Connecting to ");

while (WiFi.status() != WL_CONNECTED)

{

delay(500);

Serial.print(".");

}

Serial.println("");

Serial.println("WiFi Connected");

// Initialize the sensor

if (pressure.begin())

{

Serial.println("BMP180 init success");

}

else

{

Serial.println("BMP180 init fail\n\n");

//while(1);

}

// Print the IP address

Serial.print("Use this URL to connect: ");

Serial.print("http://");

Serial.print(WiFi.localIP());

Serial.println("/");

}

void loop()

{

// This starts the BMP180 sensor and takes a reading

status = pressure.startTemperature();

if (status !=0)

{

delay(status);

status = pressure.getTemperature(t);

}

// Converts Celsius into Farenheid

tf = (9.0/5.0)*t+32.0,2;

if(client.connect(server,80))

{

char t_buffer[10];

// This will convert the double variable into a string

String temp=dtostrf(tf,0,5,t_buffer);

String postStr = apiKey;

postStr +="&field1=";

postStr += String(temp);

postStr +="\r\n\r\n";

client.print("POST /update HTTP/1.1\n");

client.print("Host: api.thingspeak.com\n");

client.print("Connection: close\n");

client.print("X-THINGSPEAKapiKey: "+apiKey+"\n");

client.print("Content-Type: application/x-www-form-urlencoded\n");

client.print("Content-Length: ");

client.print(postStr.length());

client.print("\n\n");

client.print(postStr);

Serial.print("Temperature: ");

Serial.println(t);

Serial.println((9.0/5.0)*t+32.0);

Serial.println(temp);

}

client.stop();

Serial.println("Waiting...");

delay(20000);

}

Arduino Code


///////////////////////////////////////////////////////////////////////////////////////////

/// Title:  Auto Garden Project                                                          //

/// Author: Steven Guzman                                                                //

/// Date:   4/6/17                                                                      //

/// Description: This project will automatically water a plant when the sensor reads low //

///              water levels in the soil.  If sensor reads low water, it will turn on   //

///              boost converter that controls the solenoid valve and then turn on the   //

///              solenoid valve control circuit to allow water to flow into the soil.    //

///////////////////////////////////////////////////////////////////////////////////////////

#include <LowPower.h>

int ESP1 = 2;          // Turns on sensor; set to low for battery consumption purposes (Active High)

void setup()

{

pinMode(ESP1,OUTPUT);     // Configure sensor control as output

digitalWrite(ESP1,LOW);   // Setup as low output

delay(100);

}

void loop()

{

digitalWrite(ESP1,HIGH);  // Turns on the ESP8266

delay(15000);             // 15 second delay

digitalWrite(ESP1,LOW);   // Turns off the ESP8266

// Loops the 8 second internal to extend the sleep state

// 15 = 2 minutes

// 37 = 5 minutes

// 75 = 10 minutes

// 112 = 15 minutes

// 255 = 30 minutes

for(int x = 0; x <= 255; x++)

{

LowPower.powerDown(SLEEP_8S,ADC_OFF,BOD_OFF);

}

}

Programming

ESP8266-ESP01

First things first, we will upload the code to the ESP8266-ESP01.  This one is a little bit tricky but after awhile you’ll get the hang of it.

You need to make sure your settings are correct under the Arduino IDE.

See image below:

Arduino ESP8266 settings

Here’s the wiring diagram for connecting the FTDI programmer to the ESP8266:

Blog - ESP8266_WIRING

Now that your settings are correct, this is were it gets a little tricky to upload the code, you need to follow the steps below in order to upload correctly and successfully

Before hitting upload:

  1. Ground GPIO0 (hold down the push button JP2)
  2. Reset by pulling RST pin to ground (Press and release JP1 button)
  3. Once it restarts, hit the upload sketch icon
  4. When you see compiling sketch switch to uploading, then release the GPIO0 pin
  5. uploading should begin
ATMEGA328P-PU (ARDUINO LILYPAD)

Next, we will upload the second code into the ATmega328 which has the lilypad bootloader installed ( Click HERE [2] for tutorial on flashing ATMEGA328P-PU with bootloader).

See image below for settings:

Blog - ESP8266

Final Thoughts and Future updates

And now the final product:

Blog - Thingspeak_graph

Its not the most elegant but I actually used my CNC machine to make these boards, in the future I might get them professionally made but for now its perfect for me.

Future Updates:

  1. Replace the ATMEGA328P-PU IC with a smaller ATTINY85 which can also be flashed with the Arduino bootloader
  2. Connect the Arduino to the I2C communication lines to expand its data logging capability
  3. Since this is running on 2x AA NiMH batteries, it would be great to monitor battery capacity.  We can use one of the analog pins on the arduino to read the data and send it over I2C to the ESP8266

1. Arduinesp

2. ATMEGA328 Bootloader

3. ESP8266 installation

Boost Converter – 3.3V@ 0.4A

btn_donateCC_LG.gif


Its time to show you my 3.3V output boost Converter design. In one of my earlier post I showed you step by step on how to design your own boost converter and if you haven’t read that yet then click here.

You can purchase this board fully assembled by clicking here. 🙂

Lets get started:

Intro.

First of all, why do we even need this converter? Well every sensor, microcontroller, arduino, ESP8266, and various other digital components need a constant voltage.  A constant voltage is necessary to maintain proper operation of these components.

Here we will see the advantage of this boost converter.

Specifications.

Below are the operating specs for this converter

\Huge \bold V_\text{IN} = 1.8V - 2.4V

\Huge \bold V_\text{OUT} = 3.3V 

\Huge \bold I_\text{OUT} = 0.4A 

  • Note: Different Vin voltages gives you different max power output
    • \Huge \bold V_\text{IN} = 1.8V @ I_\text{OUT}: 0.2A
    • \Huge \bold V_\text{IN}: 2.0V @ Iout: 0.3A
    • \Huge \bold V_\text{IN}: 2.4V @ Iout: 0.4A

\Huge \bold V_\text{P-P} = 80mV 

Bill of Materials.

Here is a screenshot of the bill of materials.  I added the suppliers on the spreadsheet because I’ve found that some sites have better pricing than others.

Using octopart.com, you can actually find the best value for the component you’re looking for.  I highly suggest you go look at the site.

BOM - L6920

Schematic.

Attached here is the schematic for this project.  All the original files are available for download at the bottom of the page.

L6920.Rev.5

Layout.

I figure I’d help you guys out a bit if I added the layout for this board.  My approach for this layout was to minimize the overall size in order to get a better price for manufacturing the board.

L6920.PCB.Rev.5

Testing.

Here comes the fun part, actually testing what you designed.  Now one thing that took me awhile to learn was that design and theory never really match reality.  There are a lot of different parameters that are not accounted for when designing in theory.

A couple of the major issues that could make or break your design is parasitic elements.  One of the biggest parasitic elements is ESR for output capacitors.  This is the equivalent series resistance of the capacitor that is not taking into account when designing.  In my post that covers the design of a boost converter, I emphasizes this topic to make you aware of this parasitic element.

Now, my design parameters consisted of loading the converter at 3 different voltage inputs (1.8V, 2.0V, and 2.4V).  Each input voltage was loaded starting at 0.1A and ending at 0.4A.  This load all depended on which input voltage was tested because the lower input voltage cannot provide the max output power.

First test – Vin: 1.8V @ 0.2A

Will add soon.

Next test – Vin: 2.0V @ 0.3A

2.0V_0.3A_3.13.17

Last test – Vin: 2.4V @ 0.4A

2.4V_0.4A_3.13.17

After completely the voltage ripple test, I also conducted a load regulation test at max load for each input voltage.  I got a 1.5% voltage drop from calculated voltage meaning at full load, my output voltage was 3.25V at the lowest.

Downloads.

Order from OSH Park

All files available here – Click

How-to: Design a Boost Converter

image-boost-converter
Figure 1: Basic Boost Converter Circuit

btn_donateCC_LG.gif


Designing a boost converter sounds complicated and intimidating, well that was always my impression when it came to this topic in school.  In reality, the design and testing of a boost converter is a lot easier than meets the eye.

Here I will walk you step by step on designing your first boost converter and how the datasheet is your best friend when designing.  For this tutorial we will be using the L6920DC IC Boost converter from skyworks.[1]

Download the Boost Converter excel spredsheet from the Resources page.

This information was referenced from TI reference report.[2]

First and foremost, download the highlighted datasheet, datasheet-l6920dc. This has all the highlighted paremeters that you will need when designing a boost converter.

Step 1:

You need to decide what are your specifications.  These are the key parameters:

  • Vin(min)
  • Vin(max)
  • Vout
  • Iout
  • n = efficiency; Most boost converters average around 85 to 90% under medium load and up to 95% on heavy load.  We will use the lowest percentage to be safe.

Example:

  • Vin(min): 1.8V
  • Vin(max): 2.4V
  • Vout: 3.3V
  • Iout: 0.4A
  • n = 87% or 0.87

Step 2:

With your specifications, next step is to find your DUTY CYCLE:

\bf \Huge D= 1 - \cfrac{(V_{\text{IN}}*n)}{V_{\text{OUT}}}

We calculated the duty cycle for both lowest input voltage and highest input voltage.

  • Lowest input voltage gives you the highest switching current you will see
  • Highest input voltage gives you the highest output current your converter can produce

Example:

\bf \Huge V_{\text{IN-MIN}}

\Huge D = 1 - \cfrac{1.8V*0.85}{3.3V} = 0.52

\bf \Huge V_{\text{IN-MAX}}

\Huge D = 1 - \cfrac{2.4V*0.85}{3.3V} = 0.36

Step 3:

Next we will estimate the switching current or CURRENT RIPPLE of the Inductor:

ΔIL = (0.3) * I_\text{OUTmax} * \cfrac{(V_\text{OUT})}{(V_\text{IN})}

Example:

\bf \Huge V_{\text{IN-MIN}}

ΔIL = \Huge  (0.3) * 0.4A * \cfrac{3.3V}{1.8V} = 0.22A

\bf \Huge V_{\text{IN-MAX}}

ΔIL = \Huge  (0.3) * 0.4A * \cfrac{3.3V}{2.4V} = 0.165A

Step 4:

Next we calculate the minimum INDUCTANCE we need:

\bf \Huge L_\text{MIN} = \cfrac{(V_\text{IN})*(V_\text{OUT} - V_\text{IN})}{\Delta I_\text{L}*f_\text{S}*V_\text{OUT}}

\bf \Huge f_\text{S} – This is the switching frequency that the converter will operate at.

Example:

\bf \Huge V_{\text{IN-MIN}}

\Huge L_\text{MIN} = \cfrac{(1.8V)*(3.3V - 1.8V)}{0.22A*1MHz*3.3V} = 3.72uH

\bf \Huge V_{\text{IN-MAX}}

\Huge L_\text{MIN} = \cfrac{(2.4V)*(3.3V - 2.4V)}{0.165A*1MHz*3.3V} = 3.97uH

We would select the highest inductance value to meet our input voltage rage of 1.8V-2.4V

When selecting the inductor, the key parameters you need to look for is low DCR, package size, and max current the inductor can handle.

DCR – Is the resistance in the coil because at the end of the day, an inductor is still a wire. When you keep this value at a minimum, it will increase your effieciency and the ability to provide a higher output power.

In step 7 , you will calculate the maximum current the inductor will see and there you will have all the necessary parameters needed to chose the inductor.

Step 5:

Now that we have our inductor value, we can calculate the actual CURRENT RIPPLE of the Inductor:

ΔIL = \bf \Huge \cfrac{V_{IN}*D}{f_\text{S}*L}

Example:

\bf \Huge V_{\text{IN-MIN}}

ΔIL = \Huge \cfrac{1.8V*0.525}{1MHz*3.72uH} = 0.19A

\bf \Huge V_{\text{IN-MAX}}

ΔIL = \Huge \cfrac{2.4V*0.36}{1MHz*3.97uH} = 0.18A

Step 6:

Next we need to calculate the MAX OUTPUT CURRENT the boost converter can output:

\bf \Huge I_\text{MAXOUT} = \bf  \Huge (I_\text{LIM} - \cfrac{\Delta I_\text{L}}{2}) * (1 - D)

I_\text{LIM} – This is the current switch limit of the boost converter.

Example:

\bf \Huge V_{\text{IN-MIN}}

\Huge I_\text{MAXOUT} = \bf  \Huge (0.8A - \cfrac{0.19A}{2}) * (1 - 0.52) = 0.33A

\bf \Huge V_{\text{IN-MAX}}

\Huge I_\text{MAXOUT} = \bf  \Huge (0.8A - \cfrac{0.18A}{2}) * (1 - 0.36) = 0.45A

Step 7:

Next we will calculate the MAX SWITCHING CURRENT, I_\text{SW} the Inductor will see.  This value cannot exceed the ILIM value of the boost converter:

\bf \Huge I_\text{SW-MAX} = \cfrac{\Delta I_\text{L}}{2} + \cfrac{I_\text{OUT}}{1 - D}

Example:

\bf \Huge V_{\text{IN-MIN}}

\Huge I_\text{SW-MAX} =  \cfrac{0.19A}{2} + \cfrac{0.4A}{1 - 0.525} = 0.94A

\bf \Huge V_{\text{IN-MAX}}

\Huge I_\text{SW-MIN} =  \cfrac{0.18A}{2} + \cfrac{0.4A}{1 - 0.36} = 0.72A

Note: \Huge I_\text{SW-MAX} value cannot exceed \Huge I_\text{LIM} which can be found in the datasheet.  In this example we see that with a low input voltage, the switching current exceeds the limit in the datasheet.  The boost converter might still be able to output the desired current at that low input voltage because \Huge I_\text{LIM} is the minimum switching current it can handle.  But better to be safe than sorry.

Here you can see the inductor will see a max of 0.94A at its lowest input voltage. Now we can chose the inductor for our design.

For this design I went with,MSS5131-472MLB, a 4.7uH inductor from coilcraft.[3]

Since I chose an inductor that has a higher value than previous calculated, the inductor current ripple and output power will be slightly lower but it will not effect your design negatively.

Step 8:

This step is only if your boost converter has an adjustable output voltage.

(This boost converter is a fixed output and does not require these resistors.  Step 8 values are dummy values but the process )

Here we will find R1 AND R2 values for the feedback network:

\bf \Huge I_\text{R0.5} >= 100 * I_\text{FB}

\bf \Huge I_\text{FB} – This is the current that the feedback resistor draws.

\bf \Huge R_2 = \cfrac{V_\text{FB}}{I_\text{R0.5}}

\bf \Huge V_\text{FB} – This is the feedback reference voltage

\bf \Huge R_1 =  R_2 * (\cfrac{V_\text{OUT}}{V_\text{FB}}-1)

Example:

\Huge I_\text{R0.5} >= 100 * 350nA = 35mA

\Huge R_2 = \cfrac{1.24V}{35mA} = 35.4kΩ

\Huge R_1 =  35.4k \Omega * (\cfrac{3.3V}{1.24V}-1) = 58.74kΩ

Step 9:

Next l, we will calculate the INPUT CAPACITOR and OUTPUT CAPACITOR needed to minimize the ripple going in and out of the system:

First, you find your input capacitor:

\bf \Huge C_\text{IN}: Typically this value is 4.7uF to 10uF

Next, we need to first to look at these two equations below[6]:

\bf \Huge \Delta V_\text{OUT}= \cfrac{I_\text{OUT} *T_\text{ONmax}}{ C_\text{OUT}}

\bf \Huge T_\text{ONmax} – This is the maximum on time of the boost converter.  It is also written as

\bf \Huge D * T_\text{S}

Were \bf \Huge T_\text{S} = \cfrac{1}{f_\text{S}}

\bf \Huge \Delta V_\text{OUTesr} = ESR* I_\text{SW-MAX}

ESR – All capacitors are not ideal capacitors and therefore have what is known as Equivalent Series Resistance. This is an important parameter that you need to consider when choosing the right output capacitor.

Example:

Cin = 10uF

First, we need to choose a voltage ripple that we can live with. Here I chose 50mV, and if we rearrange the first equation, we get:

 \Huge \Delta C_\text{OUTmin}= \cfrac{0.4 *6.25us}{50mV} = 50uF

Now we have a couple of options to choose from when it comes to materials for capacitors.

Most common are ceramic and electrolytic capacitors.  Each have there own pro and con.

Ceramic capacitors offer lower ESR for lower ripple but they typically do not have the bulk capacitance.

Electrolytic capacitors have bulk capacitance but generally have a high ESR that adds to ripple.

In this case I decided to go with both, getting the benefit of bulk capacitance and low ESR.

I went with a 1206 package, 10uF ceramic capacitor and a 47uF Electrolytic in parallel. For the electrolytic, they also have an aluminum polymer that has high capacitance with the added benefit of low ESR. I went with a 47uF that has an ESR of 40mΩ.

Now we plug in the values we got back into the equations and we get:Special Note: For ceramic capacitors, you need to be careful of which class and package size you choose because you only see a certain percentage of your nominal value (ex. 1206 10uF X7R will see 73% of 10uF)[4]. Click here for more info. I generally go with 1206 or 1210 with capacitors.

\Huge \Delta V_\text{OUT}= \cfrac{0.4A * 6.25us}{50uF} = 50mV

\Huge \Delta V_\text{OUTesr} = 40m\Omega*0.94A = 37mV

\Huge \Delta V_\text{OUT} = 87mV

Always refer to the datasheet and compare recommended value vs calculated[1]

You’ve now designed your own boost converter regulator.  See it wasnt too hard :).

I will post this project soon that has the schematic and bill of materials, it’ll be under the projects menu bar, stay tuned!!

Feel free to comment below and correct me if anything seems incorrect to you.

References:

1. L6920 Datasheet

2. TI Basic Calculations of a Boost Converter Power Stage

3. Coilcraft Inductor

4. Temperature and Voltage Variation of Ceramic Capacitors

5. Ceramic or electrolytic output capacitors

in DC/DC converters—Why not both?

6. Boost Converter Output Capacitor Selection