Project – GRBL Controller Board


Anything would help really. My goal is to have this website ad free and so you can enjoy my content without having to look at ads. Thank you



1. Introduction
2. Bill of Materials
3. Schematic
4. 3D Redering
5. Final Thoughts
6. Download Original files


With all the low cost CNC machines out in the market, there is also an abundant of GRBL shields for the arduino platform. Like always, I’m always looking to for ways to customize and improve whats in the market.

What I’ve created is a slightly better GRBL controller board for low cost CNC machines. This uses the Arduino Nano instead of the Uno as this allowed for more flexibility on the size of the board. It also integrates the relay switch for the spindle with an integrated flywheel diode to avoid over voltage spikes when the spindle is first turned on.

Below I’ll discuss in more detail along with the files you need to create this board.


Click here to download the bill of materials


Here in the schematic you can see a couple of items that are different from the traditional ebay/amazon grbl shields. First of all this is not a shield per say but more of a standalone controller board.

  • Since the capacitors that are used to filter the stepper drivers are 35V rated, I’ve limited the input voltage to 24V
  • I’ve added a TVS diode at the power input that protects from over voltage spikes.
  • Used better output connectors for the stepper motor drivers
  • Added 0.1uF capacitor for the probe pin for autoleveling
  • Added x3 5V rail connectors
    • One thing to add is that these connectors are taking power from the USB port and should not be loaded more than 0.2A combined
    • I added these for low current 5V noctua fans to cool the stepper drivers
  • Added relay control on the main board to eliminate adding external relay switch for the spindle.
    • some newer versions of the grbl software, I believe v1.1 has the spindle pin and z-axis switch so thats why I included the option to switch between the two
    • I believe you can switch this back in the firmware of the grbl settings. But none the less the option is there
  • The relay controller also includes a 1000uF and a flywheel diode to prevent voltage spikes on turn-on


Here is a 3D Rendering from Kicad of the board. I’ve added this rendering because I thought it looked really cool.

Here is a picture of the final board below:

Below is the board fully soldered and it works amazing. I will add some images of the quality of boards my machine makes with the new controller board.

Future revisions of the board I will increase the 5V rail to supply up to 1A of current for high current draw fans and order accessory’s. Also, I will try to route out the limit switch pins. This will require me to remove the z-limit switch pin that connects to the spindle control but that should not be an issue.

If you have any comments or suggests please feel free to send them my way.

Thank you!!

Download original files here.

I have about 8 extra PCB boards that I’d be willing to sell. Let me know in the comments below if that’s something you’d like to buy

Project – DC Power and Efficiency Meter


Anything would help really. My goal is to have this website ad free and so you can enjoy my content without having to look at ads. Thank you



1. Introduction
2. Bill of Materials
3. Schematic
4. Code
5. ME Cad design
6. Final Thoughts
7. Download Original files



This is a fun little project that actually took me awhile to put together.  What makes this project interesting and useful is that it will display your voltage, current, and power of any device you plug it into.  What also makes this project useful is that it will calculate the efficiency of your device for example a dc dc converter.

The heart of this project is two INA219 high side current sensors from Texas Instruments.  With this sensor you can measure up to 26V DC and up to +/-3.2A with a 0.1ohm shunt resistor (if you swap out the shunt with a 0.01ohm shunt you can measure up to +/-32A)


Click Here for bill of materials


Here you can see a block diagram showing how I connected the different boards to create this project. Since I used my CNC machine to create the boards, it’s always much easier to separate the circuits into different boards for routing.

The main board consist of an arduino pro mini to keep the footprint as small as I can and also host a 5V boost converter being power from the 18650 lithium ion battery.  In order to charge the battery without having to remove it from the enclosure, I decided to add a lithium ion charger board that connects in parallel with the battery.  Its powered by a 5V USB mini connector and can be bought on amazon.

The second board host x2 INA219 high side I2C current, voltage, and power sensor by Texas Instrument.  This IC is an amazing little thing because it takes a lot of the number crunching away from the Arduino and just sends the data over I2C that you need.

The final piece of this is the I2C liquidcrystal display for the arduino.  I used this library here for the display.  Make sure you connect the display and run an i2c address scanner on the examples for arduino because sometimes the displays have a different address than the default one listed.



 * Name: Steven Guzman
 * Date: 2018/03/18
 * Description: This is a DC power meter that measures input and output
 *              power and calculates the efficiency of the system.
 *              It can also measure voltage and current of one or two
 *              voltage sources

LiquidCrystal_I2C lcd(0x3F,20,4); // Set the LCD address

 * Below are the array values to store the measurements
 * and then used to convert float to string
char float_volt1[8];  // voltage 1 array
char batt0[21];
char float_volt2[8];  // voltage 2 array
char batt1[21];
char float_current1[8]; // current 1 array
char curr1[21];
char float_current2[8]; // current 1 array
char curr2[21];
char float_eff[8];  // efficiency variable array
char line6[21];
char float_batt[6]; // battery voltage array
char line5[21];

// Analog sampling number
int sample = 20;

// Inialize current sensors.
// ina219_A default address is 0x40
Adafruit_INA219 ina219_A;
Adafruit_INA219 ina219_B(0x43);

// Variables to store current sensor data
float busvoltage1 = 0;
float busvoltage2 = 0;
float current_mA1 = 0;
float current_mA2 = 0;

float batt = 0.00;

void setup()




void loop()
  float xbat = 0.00;

  for(int x=0;x<sample;x++)
    batt = analogRead(A0);
    xbat = xbat + batt;
  // Read voltage levels from the voltage address
  // of the IN219 on both ICs
  busvoltage1 = ina219_B.getBusVoltage_V();
  busvoltage2 = ina219_A.getBusVoltage_V();

  // Read current levels from the current address
  // of the IN219 on both ICs
  current_mA1 = ina219_B.getCurrent_mA();
  current_mA2 = ina219_A.getCurrent_mA();

  // Average out the analog measurements
  // for the lithum ion battery voltage
  // sensing
  xbat = xbat/sample;
  float battery = xbat * (5.00/1024);
  sprintf(line5, "Battery:%-5s",float_batt);
  char temp3[] = "V";

  // Convert float values into an char array to
  // better update on the lcd screen without
  // having to use the lcd.clear function
  sprintf(batt0, "V1:%-5s",float_volt1);
  char temp2[] = "V";
  strcat(batt0, temp2);

  sprintf(batt1, "V2:%-5s",float_volt2);
  char temp1[] = "V";
  strcat(batt1, temp1);

  // Convert mA to A readings
  float C1 = current_mA1/1000;
  float C2 = current_mA2/1000;

  sprintf(curr1, "C1:%-5s",float_current1);
  char temp4[] = "A";
  strcat(curr1, temp4);

  sprintf(curr2, "C2:%-5s",float_current2);
  char temp5[] = "A";
  strcat(curr2, temp5);

  float power1 = busvoltage1 * C1;
  float power2 = busvoltage2 * C2;

  float eff = (power2/power1)*100;

  sprintf(line6, "Efficiency:%-7s",float_eff);

   * Display on LCD screen all the values.
   * I used char arrays to update the values on the
   * screen.  Using the lcd.clear caused flickering
   * and was annoying.  With char array you can include
   * the units and it will update properly and not
   * overright the units.








There might be some issues with how wordpress displays the arduino code but I attached the original files at the end this tutorial.

As mentioned before, the libraries used here I obtained from other sources:

  1. Liquid crystal display library
  2. INA219 adafruit library


I designed the enclosure in fusion 360 and printed the both with matterhackers pro series PETG red.  I used a monoprice maker select v2 to print this enclosure.

Here is the step file for the enclosure


This was one of my favorite projects yet because the design alone makes me feel accomplished learning everything on my own.  I still feel like I can make some upgrades to how I mount the internals and to be honest, I really rushed this part because I wanted to finish it.

Some upgrades I’m considering is using the arduinos internal 1.1V reference with a voltage divider to measure the battery voltage because it wasn’t as accurate as I wanted it to be.

Thank you for visiting and reading my project. if you have any questions or comments or suggestions please don’t hesitate to ask.


Original files

Electronics: FTDI USB TO UART


Anything would help really. My goal is to have this website ad free and so you can enjoy my content without having to look at ads. Thank you





1. Introduction
2. Bill of Materials
3. Schematic
4. Oshpark
5. Final Thoughts
6. Download Original files


With the Arduino mini, there is a need for a USB to UART controller to upload your sketches and this could also be used for the ESP8266.

This project is inspired and based off the Sparkfun’s FT231X breakout board design.  I’ve created this project because 1. I like designing and soldering electronics 2. Try to create a cheaper alternative to the popular FT232RL and also add 1 or 2 features to the current FT231X breakout board.


For the bill of materials, its pretty straight forward.  I’ve attached links to digikey for each component as I find them easier to order from but you could also get the parts from arrow or mouser as well.



Component Description Part number Quantity Link
47pF, 0603, 50V C1608C0G1H470J080AA 2 Digikey
0.1uF, 0603, 25V CGA3E2X7R1E104K080AA 4 Digikey
10uF, 0805, 6.3V TCJN106M006R0250 1 Digikey
Micro B Connector 10118192-0001LF 1 Digikey
6-pin Header M20-7910642R 1 Digikey
N-Channel FET BSS84-FDICT-ND 1 Digikey
27 ohm, 1206 RC1206JR-0727RL 2 Digikey
10k, 0603 RT0603DRD0710KL 2 Digikey
FT231X, SSOP-20 FT231XS-U 1 Digikey


Below I’ve attached an image of the schematic but i’ve also attached the original kicad files and a PDF version of the schematic at the end of the post.


If you feel like you want to get this board made, I’ve attached a link to my oshpark project.  With oshpark, I find they make great quality boards at a great price for small sized boards.

Order from OSH Park


I know this was a short post and project but I found it important to share another option for those’s who want to find a cheaper solution and want to learn along the way.  You can find a lot cheaper solutions on amazon that are china made but i’ve read stories in some cases that they were not genuine FT232RL ICs.  If you wish to build your own, its very easy and rewarding at the same time.

In the next revision I will add LEDS for TX and RX indication as for this version I eliminated to save some cost and space.

Hope you enjoyed this post, THANK YOU 🙂





Anything would help really. My goal is to have this website ad free and so you can enjoy my content without having to look at ads. Thank you




1. Introduction
2. Bill of Materials
3. Block Diagram
4. Schematics/CAD DESIGN
5. Assembly
6. Final Thoughts/ Improvements
7. Download Original Files



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.


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


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.


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.


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.


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.


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.






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






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!


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


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.


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


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()

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
    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);
      x = 0;
    if (digitalRead(Open) == LOW)
      x = 0;


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


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  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:


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


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:


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 &amp;amp;lt;ESP8266WiFi.h&amp;amp;gt;
#include &amp;amp;lt;arduino.h&amp;amp;gt;
#include &amp;amp;lt;SPI.h&amp;amp;gt;
#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");&amp;amp;lt;span 				data-mce-type="bookmark" 				id="mce_SELREST_start" 				data-mce-style="overflow:hidden;line-height:0" 				style="overflow:hidden;line-height:0" 			&amp;amp;gt;&amp;amp;amp;#65279;&amp;amp;lt;/span&amp;amp;gt;


bool connectedToWiFI = false;

void setup()

  delay(10); // short delay

void loop() {
  if (wifiConnected)

    if (event.connect())
       if (digitalRead(2) == HIGH)
       event.setValue(1,"Garage Door is Open, close it NOW!!");
       debugln("Connected To Maker");;

      if (digitalRead(2) == LOW)
        event.setValue(1,"Garage Door is Closed");
        debugln("Connect to Maker");;
    else debugln("Failed To Connect To Maker!");

    delay(5000); // pause for 1 second
    delay(60 * 1000); // 1 minute delay before trying to re connect

bool ConnectWifi()
  // Connect to WiFi network
  debug("Connecting to ");
  unsigned long startTime = millis();
  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED &amp;amp;amp;&amp;amp;amp; startTime + 30 * 1000 &amp;amp;gt;= millis()) {
  if (WiFi.status() == WL_CONNECTED)
    debugln("WiFi connected");
    debugln("WiFi Timed Out!");

bool wifiConnected()
  return WiFi.status() == WL_CONNECTED;

void debug(String message)

void debugln(String message)

void debugln()

Here is the second file needed for the ESP8266:

#include &lt;Arduino.h&gt;
#include &lt;ESP8266WiFi.h&gt;

#ifndef DataToMaker_h
class DataToMaker
    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!

    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("", 80))
    return true;
  else return false;

void DataToMaker::post()
  client.print("POST /trigger/");
  client.println(" HTTP/1.1");

  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: ");

bool DataToMaker::setValue(int valueToSet, String value)
  switch (valueToSet)
    case 1:
      value1 = value;
    case 2:
      value2 = value;
    case 3:
      value3 = value;
      return false;
  return true;

void DataToMaker::compileData()
  if (value1 != "" || value2 != "" || value3 != "")
    dataAvailable = true;
    bool valueEntered = false;
    postData = "{";
    if (value1 != "")
      valueEntered = true;
    if (value2 != "")
      if (valueEntered)postData.concat("\",");
      valueEntered = true;
    if (value3 != "")
      if (valueEntered)postData.concat("\",");
  else dataAvailable = false;
#endif&lt;span 				data-mce-type="bookmark" 				id="mce_SELREST_start" 				data-mce-style="overflow:hidden;line-height:0" 				style="overflow:hidden;line-height:0" 			&gt;&lt;/span&gt;

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


Here is the final project assembled:


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.



Project files



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.


  • x1 ATtiny85 – Link
  • x1 Arduino Uno – Link


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:



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:


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.


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.


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.


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.


/// 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 &lt;avr/sleep.h&gt;
#include &lt;avr/wdt.h&gt;

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

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&lt;&lt;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 &lt; 15)
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: // 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);

MCUSR &= ~(1<<WDRF);
// start timed sequence
WDTCR |= (1<<WDCE) | (1<<WDE);
// set new watchdog timeout value
WDTCR = bb;

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


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.



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.


1. Microchip
2. Big Dan the Blog Man
3. Renewable Energy Innovation

Arduino: WiFi Temperature Data Logger


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


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


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.

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 = "";

WiFiClient client;
void setup()
// Pin 0 = SDA
// Pin 2 = SCL


Serial.print("Connecting to ");

while (WiFi.status() != WL_CONNECTED)

Serial.println("WiFi Connected");

// Initialize the sensor
if (pressure.begin())
Serial.println("BMP180 init success");
Serial.println("BMP180 init fail\n\n");

// Print the IP address
Serial.print("Use this URL to connect: ");

void loop()
// This starts the BMP180 sensor and takes a reading
status = pressure.startTemperature();
if (status !=0)
status = pressure.getTemperature(t);
// Converts Celsius into Farenheid
tf = (9.0/5.0)*t+32.0,2;
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("Connection: close\n");
client.print("X-THINGSPEAKapiKey: "+apiKey+"\n");
client.print("Content-Type: application/x-www-form-urlencoded\n");
client.print("Content-Length: ");

Serial.print("Temperature: ");



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

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++)




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

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