Quantcast
Channel: Embedded Lab
Viewing all 713 articles
Browse latest View live

WiFi switch for AC appliance

$
0
0

Are you looking for a simple design of a DIY remote switch for controlling your AC appliances over WiFi, this Instructable provides details of making such a switch from scratch. The project uses ESP8266 WiFi module that communicates with a phone using the Blynk app. The entire circuitry is enclosed inside a box with a male plug that goes to the wall socket, and a female input plug for your device. The controller receives the power supply from the mains socket.

DIY WiFi relay switch

DIY WiFi relay switch

The post WiFi switch for AC appliance appeared first on Embedded Lab.


WiFi enabled anemometer

$
0
0

A wireless anemometer project using ESP8266 and Adafruit’s wind sensor is shared by  on github. The wind sensor provides an analog output voltage proportional to the wind speed. The ESP8266 reads in the output voltage through its A/D channel, computes the wind speed, and displays it on a web browser upon receiving a HTTP request from a client machine.

WiFi Anemometer

WiFi Anemometer

 

The post WiFi enabled anemometer appeared first on Embedded Lab.

Arduino controlled rover with FPV live video

$
0
0

Tamas is a 17 years old electronics enthusiast from Hungary. His latest creation, which he shared on Instructables, is an Arduino-powered rover that can be controlled with brainwaves or a joystick. The best part of it is, while it’s being operated, you will also have access to a live video stream from the mounted camera via your pair of virtual reality glasses.

Arduino powered rover with FPV video streaming

Arduino powered rover with FPV video streaming

This is an all terrain vehicle, that means that you can control it on snow, sand, any kind of ground, wet surface and of course indoors. It is powered by two 18650 lithium-ion batteries with a capacity of 2600 mAh. These are connected in series so the maximum voltage is 8.4 volts, that ensures the seamless operation. Can climb hills that up to 35-40 degrees. The maximum control range with the new HC-12 serial communication module is 1.8-1 kilometers if the controllers can see each other. That’s insane! Of course the WiFi FPV’s range is only around 45-50 meters, but the HC-12 ensures a very stable communication.

The post Arduino controlled rover with FPV live video appeared first on Embedded Lab.

Autonomous Parallel Parking Car

$
0
0

Owing to limited parking space, crowded cities require you to have really good parallel parking skills to park your vehicle in a narrow parking space. This stressful task has lately been made easier in the new automobiles with the implementation of automatic parallel parking technology based on multiple imaging cameras and laser sensors. This add-on could add a few thousand dollars extra on your car price. Alberto Gutiérrez, Shaan Shetty, and Boling Hu (students from Cornell University) built a low-cost prototype car with autonomous parallel parking capability that would enable the car to find a suitable parking space and park itself without any assistance from the driver. Their design uses Ultrasound Sensors with a PIC32 microcontroller to map the surrounding obstacles, and determines if the available parking space is sufficient to park the car.

Autonomous parallel parking car

Autonomous parallel parking car

Our system is mainly composed of five ultrasonic sensors (HC-SR04, a dual motor driver, a PIC32MX250F128B microcontroller, a TFT display and two DC motors with gear boxes. The car is capable of parking autonomously after it detects a parking space on its right side. There is one sonar on the front, one on the back, two on the right side and one on the back right corner of the vehicle. One of the side sensors is in charge of keeping the car aligned to the parking space boundaries using a closed-loop Proportional-Integral (PI) controller.

Here’s the demo of the autonomous parking car.

The post Autonomous Parallel Parking Car appeared first on Embedded Lab.

Bluetooth-connected weight scale

$
0
0

This design application note from Microchip illustrates the the implementation of a Bluetooth-connected weight scale using Microchip’s PIC16F1783 MCU and the RN42 Bluetooth module. It is powered by 2 AAA batteries and the measured weight is displayed and recorded on a smartphone or tablet.

Bluetooth connected weight scale

Bluetooth connected weight scale

Weight scales have been used for quite a while in homes, businesses and medical facilities. With the increase in demand for health-related information, connected weight scales can now send data to smartphones, tablets and the Cloud where it can be utilized by medical providers and other care givers. Connected weight scales are being used with other home-based consumer and medical devices to improve the health and general well-being of many people.

Microchip’s Connected Weight Scale Demonstration Board shows the implementation of a Bluetooth-connected weight scale using Microchip’s PIC16F1783 MCU and the RN42 Bluetooth module. The PIC16F1783 MCU is an eXtreme Low Power (XLP), cost-effective 8-bit microcontroller with an integrated capacitive touch sensing module, 12-bit ADC and operational amplifiers.

Connected Weight Scale Demonstration Board Highlights
  • Displays instructions to user and measures weight in pounds and kilograms
  • Bluetooth module is used to demonstrate smartphone/tablet connected design capability
  • Low overall BOM cost due to function integration
  • Low-power operation utilizing Microchip’s eXtreme Low Power PIC16F1783 MCU
  • Powered by two AAA batteries

The post Bluetooth-connected weight scale appeared first on Embedded Lab.

DIY Arduino Pong Game

$
0
0

Nick from educ8s.tv shows in the following video tutorial how to build a pong game using Arduino Uno, a 0.95″ SSD1331 driven SPI color OLED display, and some tact switches and jumper wires. You can play against the Arduino that controls the green paddle. Each time a player scores, the score is displayed on the screen.

DIY Pong game using Arduino

DIY Pong game using Arduino

Posted below is the complete video tutorial.

The post DIY Arduino Pong Game appeared first on Embedded Lab.

Tutorial 3: Connecting an OLED display to ESP8266

$
0
0

Whether you want to show sensor readings, implement a navigational user interface menu, or display diagnostic information during prototyping a project, a graphic OLED display is always a cool add-on to embedded systems. In this tutorial, we will learn how to interface an I2C monochromatic OLED screen to ESP8266 (we will use EasyESP-1 board) using Arduino IDE. The OLED display used in this tutorial is SSD1306-based that can be bought for ~$5 on eBay or Aliexpress. You can also get a similar I2C OLED display with a grove connector from Elecrow for plug-and-play interfacing with the EasyESP-1 board.

Interfacing an SSD1306-based I2C OLED to EasyESP-1

Interfacing an SSD1306-based I2C OLED to EasyESP-1

Buy EasyESP-1 board

Hardware Setup

The I2C OLED breakout board chosen for this tutorial consists of a 0.96″ diagonal length display with 128×64 monochrome pixels. Despite its small size, the readability is pretty good due to its high contrast. Individual pixels are turned on or off by the on-board SSD1306 controller chip that supports both SPI and I2C interface. This tutorial uses an OLED display with I2C interface and has only four signal lines, namely VCC, GND, SCL, and SDA. For this experiment, these pins are connected to 3.3V, GND, D1, and D2 pins on the EasyESP-1 board, respectively.

SSD1306 based 0.96" OLED display module

SSD1306 based 0.96″ OLED display module

Wiring OLED pins to the EasyESP-1 board

Wiring OLED pins to the EasyESP-1 board

If you would like to use a grove OLED module, it can be connected to one of the I2C port on the EasyESP-1 board, as shown below.

Connecting a grove OLED

Connecting a grove OLED to I2C connector on the EasyESP-1 board

Software

There are several libraries available to support the SSD1036-based OLEDs for Arduino platform. For ESP8266, I would suggest to use one written by Daniel Eichhorn from squix. It supports both I2C and SPI versions of SSD1306 based 128×64 pixel OLED displays on the Arduino/ESP8266 platform. The library is very versatile and supports drawing pixels, lines, rectangles, and text of different font sizes. You can download this from the following github link.

https://github.com/squix78/esp8266-oled-ssd1306

Installation and setup of an external user library to Arduino IDE is easy. First, download the zipped library folder to your machine. Then unzip it and move the unzipped library folder to your Documents/Arduino/libraries/ location. You need to restart the Arduino IDE in order to use it in your new application.

After installing the OLED library, it’s time to try some built-in examples that come with the library. Open File->Examples->ESP8266 Oled Driver for SSD1306 display-> SSD1306SimpleDemo.

fgf

Testing OLED examples

The example programs are configured for I2C version of SSD1306 OLED by default. So, the only thing that you need to modify in the example code is to assign the correct ESP8266 I/O pins for I2C communication. Note that the EasyESP-1 I2C ports use D2 for SDA and D1 for SCL. So find the following I2C initialization statement in the code and make the changes as

// Initialize the OLED display using Wire library
SSD1306 display(0x3c, D2, D1);

Next, compile the program and upload it to the EasyESP-1 board.

Output

The SSD1306SimpleDemo example cycles through all the basic features of the OLED library, like drawing pixels, rectangle, circles, texts, WiFi logo, etc.

Drawing concentric circles

Drawing concentric circles

OLED text output

OLED text output

You can also try running other examples in Daniel’s OLED library. There is one called SSD1306ClockDemo that displays an analog and digital clock on the LED screen. For this example, you will need to install the Arduino Time library.

Clock example

Clock example

Buy EasyESP-1 board

More tutorials

TUTORIAL 2: EASYESP-1 “HELLO WORLD” EXAMPLE
TUTORIAL 1: SETTING UP THE ARDUINO IDE FOR EASYESP-1
EASYESP-1: A RAPID PROTOTYPING AND DEVELOPMENT BOARD FOR ESP8266

The post Tutorial 3: Connecting an OLED display to ESP8266 appeared first on Embedded Lab.

Send a note to your valentine “the IoT way”

$
0
0

Valentine’s day is coming soon, and some of you must be ready to send a personal note to your long-distance sweetheart. Would you like to try something different this year? How about sending a warm note via internet, or more appropriately, “the IoT way”. Becky Stern posted a new Instructable about sending a valentine note over the internet using ESP8266 devices and Adafruit IO cloud platform. This project uses a small vibrating motor to gently wave a tissue paper heart and flash an LED when it receives instructions over the internet from another device.

Sending your valentine a note via internet

Sending your valentine a note via internet

I built two versions of the ESP8266 wifi circuit, also equipped with two buttons for triggering the two commands. The devices talk over the Adafruit IO cloud data service to communicate with each other from anywhere with wifi, and I’ll show you how to activate your valentine with the API gateway service IFTTT as well, in case you only want to build one valentine circuit.

This is a pretty easy Internet of Things project! Before you dive in, you should have a workable knowledge of the Arduino software and electronics soldering. Try my beginner Arduino Class and/or Randy Sarafan’s basic Electronics Class to get up to speed!

Demo video is posted below.

The post Send a note to your valentine “the IoT way” appeared first on Embedded Lab.


Tutorial 4: Working with ESP8266 WiFi Scan Class

$
0
0

Working with ESP8266 WiFi functionality using Arduino IDE has been made surprisingly simple by the availability of the versatile ESP8266WiFi library that allows user to configure the ESP8266 as a WiFi network scanner, a WiFi station (connected to a WiFi network), a soft access point (creating it’s own WiFi network), etc. In this tutorial, we will explore the features of the Scan Class of the ESP8266WiFi library. The Scan Class allows you to scan and list the available WiFi networks in the range. In order to try this feature, open an example code from File->Examples->ESP8266WiFi->WiFiScan.

In the example code,

int n = WiFi.scanNetworks();

returns the number of WiFi networks found within the range. You can also print out the names and Received Signal Strength Indication (RSSI) values in dBm using WiFi.SSID() and WiFi.RSSI() functions.

WiFi Scanner example

WiFi Scanner example

The complete WiFi Scan example code is posted below.

/*
 * This sketch demonstrates how to scan WiFi networks. 
 * The API is almost the same as with the WiFi Shield library, 
 * the most obvious difference being the different file you need to include:
 */
#include "ESP8266WiFi.h"

void setup() {
 Serial.begin(115200);

 // Set WiFi to station mode and disconnect from an AP if it was previously connected
 WiFi.mode(WIFI_STA);
 WiFi.disconnect();
 delay(100);

 Serial.println("Setup done");
}

void loop() {
 Serial.println("scan start");

 // WiFi.scanNetworks will return the number of networks found
 int n = WiFi.scanNetworks();
 Serial.println("scan done");
 if (n == 0)
 Serial.println("no networks found");
 else
 {
 Serial.print(n);
 Serial.println(" networks found");
 for (int i = 0; i < n; ++i)
 {
 // Print SSID and RSSI for each network found
 Serial.print(i + 1);
 Serial.print(": ");
 Serial.print(WiFi.SSID(i));
 Serial.print(" (");
 Serial.print(WiFi.RSSI(i));
 Serial.print(")");
 Serial.println((WiFi.encryptionType(i) == ENC_TYPE_NONE)?" ":"*");
 delay(10);
 }
 }
 Serial.println("");

 // Wait a bit before scanning again
 delay(10000);
}

Upload the example code to your EasyESP-1 board and open the Serial Monitor window. You will see the ESP8266 prints out the list of available WiFi networks on the screen, as shown below.

WiFi scanner output

WiFi scanner output

Buy EasyESP-1 board

More tutorials

EASYESP-1: A RAPID PROTOTYPING AND DEVELOPMENT BOARD FOR ESP8266
TUTORIAL 1: SETTING UP THE ARDUINO IDE FOR EASYESP-1
TUTORIAL 2: EASYESP-1 “HELLO WORLD” EXAMPLE
TUTORIAL 3: CONNECTING AN OLED DISPLAY TO ESP8266

 

The post Tutorial 4: Working with ESP8266 WiFi Scan Class appeared first on Embedded Lab.

Tutorial 5: Setting up an ESP8266 Web Server

$
0
0

In this tutorial, we will explore how to setup an ESP8266 web server to serve an webpage that can be displayed on a client’s browser. The client can be any other computer, smartphone, or tablet connected to the same WiFi network. The webpage will also provide an user interface to allow you to toggle an I/O pin of the ESP8266 hardware.

ESP8266 Webserver setup tutorial

ESP8266 Webserver setup tutorial

Hardware Setup

There is nothing much to do in the hardware setup of this experiment. In your EasyESP-1 board, all you need to do is to connect the LD1 pin to D1 pin using a jumper cable. This will connect the LD1 LED on board to the D1 I/O pin of the ESP8266.

Setup

Hardware Setup

Software

As mentioned above, this tutorial illustrates how to create a standalone local web server using EasyESP-1. The web server will respond to a client’s request with a web page that will allow the user to toggle the LED connected to the D1 I/O pin. The first step to do that is to create a server object, which is done with the following statement.

WiFiServer server(80);

The server will respond to clients on port 80. You need to provide the credentials (network SSID and password) to connect to the chosen WiFi network. You can initiate the connection using WiFi.begin(ssid, password) function. Once connected to the network, you can find out the local IP address assigned to your ESP8266 using WiFi.localIP(). The complete code for this tutorial is posted below. The content of the webpage is defined in the string variable HTMLpage.

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
 
ESP8266WebServer Webserver(80);
 
// Replace with your network credentials
const char* ssid = "your network ssid";
const char* password = "password";
 
String HTMLpage = "";
int LED = D1;
 
void setup(void){
  HTMLpage += "<head><title>Webserver Tutorial</title></head><h3>ESP8266 Webserver Demo (Toggle LED)</h3><p>LED <a href=\"ledON\"><button>ON</button></a>&nbsp;<a href=\"ledOFF\"><button>OFF</button></a></p>";
 
  pinMode(LED, OUTPUT);
  digitalWrite(LED, LOW);
  Serial.begin(115200);
  WiFi.begin(ssid, password);
  Serial.println("");
 
  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());
 
  if (MDNS.begin("esp8266", WiFi.localIP())) {
    Serial.println("MDNS responder started");
  }
 
  Webserver.on("/", [](){
    Webserver.send(200, "text/html", HTMLpage);
  });
  Webserver.on("/ledON", [](){
    Webserver.send(200, "text/html", HTMLpage+"<p>LED is ON</p>");
    digitalWrite(LED, HIGH);
    delay(1000);
  });
  Webserver.on("/ledOFF", [](){
    Webserver.send(200, "text/html", HTMLpage+"<p>LED is OFF</p>");
    digitalWrite(LED, LOW);
    delay(1000); 
  });
 
  Webserver.begin();
  Serial.println("HTTP Webserver started");
}
 
void loop(void){
  Webserver.handleClient();
}

Download Webserver Tutorial code

Output

After uploading the web server code posted above (make sure you typed in your network credentials), open a Serial Monitor window for the IP address assigned to your EasyESP-1 board. If the connection to the selected WiFi network is successful, you will see the following output on the Serial Monitor window. The IP address displayed here is the IP address of the ESP8266 web server.

Serial Monitor terminal

Serial Monitor terminal output

Now open a browser on any computer or tablet connected to the same WiFi network and type that IP address in the URL field and hit Go. You will see the web page served by the EasyESP-1 as follows.

WebServer1

Web server home page

Now if you press ON button, the browser will send that info to the server, and the ESP8266 will turn ON the LED connected to D1 pin. Similarly, clicking on OFF button will turn the LED OFF.

WebServer2 WebServer3

Toggling LED via web server

Toggling LED via web server

Buy EasyESP-1 board

More tutorials

EASYESP-1: A RAPID PROTOTYPING AND DEVELOPMENT BOARD FOR ESP8266
TUTORIAL 1: SETTING UP THE ARDUINO IDE FOR EASYESP-1
TUTORIAL 2: EASYESP-1 “HELLO WORLD” EXAMPLE
TUTORIAL 3: CONNECTING AN OLED DISPLAY TO ESP8266
TUTORIAL 4: WORKING WITH ESP8266 WIFI SCAN CLASS

The post Tutorial 5: Setting up an ESP8266 Web Server appeared first on Embedded Lab.

Tutorial 6: ESP8266 and BME280 make a local/remote weather station

$
0
0

In previous tutorials, we explored how to connect an SSD1306-based I2C OLED to ESP8266 for displaying texts and graphics, as well as to setup an ESP8266-based web server. This tutorial combines the knowledge gained before to make a standalone weather station that will display the local weather data on an OLED screen. In addition, the weather station will also run a web server that would allow a remote computer to access the weather data via web browser.

dsds

BME280 weather station

Hardware Setup

This project uses the EasyESP-1 board and the following hardware devices.

BME280 sensor module: BME280 is a fully integrated environmental unit from Bosch that combines sensors for pressure, humidity, and temperature in a tiny 8-pin metal-lid LGA package of size 2.5 x 2.5 x 0.93 mm³. Because of its compact size, ease of use (BME280 supports standard I2C and SPI interfaces), and availability of supporting open-source Arduino libraries, BME280 is very popular among weather enthusiasts. You can buy a BME280 sensor module in Grove form factor from Elecrow.

SSD1306 I2C OLED module: As described in Tutorial 3, the SSD1306 OLED controller supports both SPI and I2C interfaces. We will use an I2C version with a 0.96″ diagonal length and 128×64 monochrome pixels OLED Grove board. Despite its small size, the readability is pretty good due to its high contrast.

For this experiment, the 4-pin Grove connectors of BME280 and OLED modules are directly plugged into the two I2C ports on the EasyESP-1 board, as shown below. This connects the the SDA and SCK pins of BME280 and OLED modules to D2 and D1 pins of EasyESP-1, respectively.

Complete project setup

Complete project setup

BME280 and OLED connect to I2C Grove ports

BME280 and OLED connections to I2C Grove ports

Software

The ESP8266 firmware for this project is developed using Arduino IDE. You need to install the ESP8266 core to enable the Arduino IDE for ESP8266 programming. Instructions can be found here. You will also need the following Adafruit libraries for reading data from the BME280 sensor. The I2C address of BME280 sensor on Elecrow’s sensor board is 0x77, which is also the default address set in the Adafruit’s library.

Adafruit unified sensor library

Adafruit BME280 library

Besides, you also need Daniel Eichhorn‘s OLED library for ESP8266. Read Tutorial 3 for more details on this.

The complete code for this weather station project can be downloaded from the following link:

Download BME280 Weather Station Code

The code for a very basic HTML webpage with the BME280 sensor output and auto refresh meta tag is included in the code. Note that you need to edit the SSID name and password in the program to match with your WiFi network before uploading it to the EasyESP-1 board.

Output

After uploading the program to EasyESP-1, when the ESP8266 restarts it prints out on the serial monitor the local IP address that was allocated to it in the WiFi network. The BME280 sensor readings for temperature, pressure and humidity are displayed on the OLED screen. In order to access these data over the web server, you need to open a web browser on any computer, tablet, or smartphone connected to the same WiFi network and type in the ESP8266 IP address in the URL field and hit enter. On receiving a client request, the ESP8266 serves a webpage containing the BME sensor readings, as shown below.

BME280 local weather station

BME280 local weather station

Web

Weather data displayed on client’s browser

Buy EasyESP-1 board

Buy BME280 sensor module 

Buy SSD1306 I2C OLED module

More tutorials

EASYESP-1: A RAPID PROTOTYPING AND DEVELOPMENT BOARD FOR ESP8266
TUTORIAL 1: SETTING UP THE ARDUINO IDE FOR EASYESP-1
TUTORIAL 2: EASYESP-1 “HELLO WORLD” EXAMPLE
TUTORIAL 3: CONNECTING AN OLED DISPLAY TO ESP8266
TUTORIAL 4: WORKING WITH ESP8266 WIFI SCAN CLASS
TUTORIAL 5: SETTING UP AN ESP8266 WEB SERVER

The post Tutorial 6: ESP8266 and BME280 make a local/remote weather station appeared first on Embedded Lab.

PC stat monitor using ESP8266/Arduino

$
0
0

There are tons of PC applications you can install on your PC for monitoring essential stats for CPU, disk, memory, system temperature, etc. Here is a standalone hardware project that would receive the PC stat via USB port and display it on a dedicated 2.8″ TFT display. The project uses an ESP8266 hardware and a touchscreen-enabled ILI9341-based color LCD. On the PC side, a Python script gathers PC stats and send the data to the ESP8266 via USB-UART interface. With the built in WiFi capability of ESP8266, the PC stat can also be broadcasted over WiFi to a remote cloud server. The firmware is developed using Arduino IDE, so the standalone LCD version of this project would still be compatible with Arduino boards.

ESP8266 PC stat monitor

ESP8266 PC stat monitor

 

The post PC stat monitor using ESP8266/Arduino appeared first on Embedded Lab.

ESP8266 weather station with e-paper display

$
0
0

A very cool-looking weather station using the ESP8266 WiFi module chip and a high resolution 7.4″ a-Si TFT active matrix Electronic Paper Display (EPD) module from Pervasive Displays shared by . The weather data are gathered from OpenWeatherMap service.

ESP8266 weather station with e-Paper display

ESP8266 weather station with e-Paper display

Most of the time the device stays in deep sleep mode consuming only 18 µA. While updating the weather power consumption varies from 80 to 150 mA. Update operation takes a few seconds, depending on WiFi router, DHCP server and internet connection speed. With 30 minute update interval 3000 mAh battery should last for a few months on one charge.

The post ESP8266 weather station with e-paper display appeared first on Embedded Lab.

WiFi deauthentication attacker using ESP8266

$
0
0

The IEEE 802.11 (Wi-Fi) protocol contains a so-called deauthentication frame that are used as management frames to disconnect the links between stations and access points. Because management frames are often unencrypted, it is fairly easy to perform deauthentication attacks using a WiFi device by spoofing the MAC address of the access point. Alternatively, it can also be done by sending deauthentication frames to the access point with a clients’ MAC address as a destination. Spacehuhn has shared his ESP8266 based implementation of a deauthentication attacker on Github. It can disconnect any client from a network by repeatedly sending fake deauthentication frames. The attacker does not even need to be connected to the same network.

Deauthentication attacker using ESP8266

Deauthentication attacker using ESP8266

Basically it’s a device which performs a deauth attack. You select the clients you want to disconnect from their network and start the attack. As long as the attack is running, the selected devices are not able to connect to the network.

The post WiFi deauthentication attacker using ESP8266 appeared first on Embedded Lab.

Animated IoT clock that can’t be trusted

$
0
0

An animated IoT clock shared by Tobozo Tagada does not use any RTC module orconnect to a NTP server to retrieve the time. It rather scans the open WiFi access points in its surrounding and extract the date/time from the “Date” HTTP header, if sent out by some. Trust this clock’s accuracy at your own risk. It uses WeMOS ESP8266 board and an OLED screen to display the time along with a pong animation in the background to “cut on the boringness of the clock”, as he said.

Expecting unknown networks to provide a HTTP header value and relying on it to estimate time is like counting on other people’s wealth to survive, hence the Hobo name.

The exclusive use of open access points removes the hassle of hardcoding SSID/password into the sketch but also compensates its lack of auth plus the fact that the optional NTP connexion attempt will always fail, unless the AP acts as.

The Pong animation with a bouncing rotating cube is there to cut on the boringness of the clock but also to demonstrate how this tiny OLED can animate fast (nearly 60fps).

Since it has trust issues, don’t trust this clock more than you would trust a stranger’s watch! The available space and power consumption won’t let it run more than a couple of hours on the LiPo anyway.

Animated IoT clock

Animated IoT clock

The post Animated IoT clock that can’t be trusted appeared first on Embedded Lab.


Tutorial 7: ESP8266 and ILI9341 TFT LCD

$
0
0

In tutorial 3, we discussed how to use an SSD1306-driven I2C OLED screen with EasyESP-1 for displaying basic text and graphics. We used a 0.96″ (along the diagonal) 128×64 monochrome pixels OLED display for illustration. Despite its small size, the readability was pretty good due to its high contrast, which makes it a very good, compact size display for general applications. The excitement of having a display screen in an ESP8266 project can be further enhanced by upgrading the choice of display to colorful TFT LCD. One such screen that is readily available in the market at affordable price is ILI9341 based TFT LCDs. This tutorial describes the method to connect such displays with ESP8266 using Arduino IDE.

Interfacing an ILI9341 TFT LCD

Interfacing an ILI9341 TFT LCD

Hardware

The datasheet of ILI9341 driver chip states:

ILI9341 is a 262,144-color single-chip SOC driver for a-TFT liquid crystal display with resolution of 240RGBx320 dots, comprising a 720-channel source driver, a 320-channel gate driver, 172,800 bytes GRAM for graphic display data of 240RGBx320 dots, and power supply circuit. ILI9341 supports parallel 8-/9-/16-/18-bit data bus MCU interface, 6-/16-/18-bit data bus RGB interface and 3-/4-line serial peripheral interface (SPI). The moving picture area can be specified in internal GRAM by window address function. The specified window area can be updated selectively, so that moving picture can be displayed simultaneously independent of still picture area.

You can find ILI9341-based TFT displays in various sizes on eBay and Aliexpress. The one I chose for this tutorial is 2.2″ length along the diagonal, 240×320 pixels resolution, supports SPI interface, and can be purchased for less than $10.

2.2" TFT LCD used in this tutorial

2.2″ TFT LCD used in this tutorial is bought from a Chinese store on Aliexpress

The connections between the TFT display and EasyESP-1 pins are as follows.

Connections between ILI9341 SPI TFT module and EasyESP-1

Connections between ILI9341 SPI TFT module and EasyESP-1

Note that we will be using the hardware SPI module of the ESP8266 to drive the TFT LCD. The SPI communication pins are multiplexed with I/O pins D5 (SCK), D6 (MISO), and D7 (MOSI). The chip select (CS) and Data/Command (DC) signal lines are configurable through software.

Complete setup of LCD on the EasyESP-1 breadboard

Complete setup of LCD on the EasyESP-1 breadboard

Software

For ILI9341-based TFT displays, there are some options for choosing the library for your application. The most common one is using Adafruit’s library for ILI9341 display. You will also need their GFX-library with this. There’s another one that I recently discovered named TFT ILI9341 ESP, and is more versatile than the Adafruit’s library. This is shared on github by Bodmer. We will use this library in this tutorial. So go ahead and download the TFT ILI9341 ESP library, and install it in your Arduino/libraries folder.

About this library (in Author’s words):

An Arduino IDE compatible graphics and fonts library for ESP8266 processors with a driver for the ILI9341 based TFT displays.

The library contains proportional fonts, different sizes can be enabled/disabled at compile time to optimise the use of FLASH memory. The library has been tested with the NodeMCU (ESP8266 based).

The library is based on the Adafruit GFX and Adafruit ILI9341 libraries and the aim is to retain compatibility. Significant additions have been made to the library to boost the speed for ESP8266 processors (it is typically 3 to 10 times faster) and to add new features. The new graphics functions include different size proportional fonts and formatting features. There are a significant number of example sketches to demonstrate the different features.

Configuration of the library font selections, pins used to interface with the TFT and other features is made by editting the User_Setup.h file in the library folder. Fonts and features can easily be disabled by commenting out lines.

As mentioned by the author, you need to open the User_Setup.h file inside the main library folder and modify the following two lines to match with our setup.

#define TFT_CS D2 // Chip select control pin
#define TFT_DC D1 // Data Command control pin

Now you are all set to try out tons of really cool built-in examples that come with the library. The following output corresponds to the TFT_Pie_Chart example.

Drawing a colorful Pi Chart on TFT screen

Drawing a colorful Pi Chart on TFT screen

There is an example (TFT_Rainbow_one_lib.ino) for showing different size text fonts with rainbow colors in the background that looks pretty cool.

Rainbow colors demo

Rainbow colors demo

fonts

Another example of printing texts with different font sizes and colors

My favorite example is TFT terminal, which implements a simple “Arduino IDE Serial Monitor” like serial receive terminal for monitoring debugging messages from another Arduino or ESP8266 board.

serialterminal

Serial receive terminal example

Buy EasyESP-1 board

More tutorials

EASYESP-1: A RAPID PROTOTYPING AND DEVELOPMENT BOARD FOR ESP8266
TUTORIAL 1: SETTING UP THE ARDUINO IDE FOR EASYESP-1
TUTORIAL 2: EASYESP-1 “HELLO WORLD” EXAMPLE
TUTORIAL 3: CONNECTING AN OLED DISPLAY TO ESP8266
TUTORIAL 4: WORKING WITH ESP8266 WIFI SCAN CLASS
TUTORIAL 5: SETTING UP AN ESP8266 WEB SERVER
TUTORIAL 6: ESP8266 AND BME280 MAKE A LOCAL/REMOTE WEATHER STATION

The post Tutorial 7: ESP8266 and ILI9341 TFT LCD appeared first on Embedded Lab.

Tutorial 8: ESP8266 Internet clock

$
0
0

The National Institute of Standards and Technology (NIST) provides official time in the United States. NIST disseminates the time using several methods, including radio broadcasting over short-wave and long-wave frequencies, telephone dial-in services (ACTS), and Network Time Service (NTS) over the internet. This tutorial describes how to build an ESP8266-based internet clock that uses NIST’s NTS service to retrieve accurate time information. The time is displayed on a colorful TFT LCD (ILI9341 driven) in both analog clock dial and digital formats. The time is synchronized to the NIST server in every 2-minute interval.

ESP8266 Internet Clock

ESP8266 Internet Clock

Hardware

This project uses an ESP8266 module to connect to the NIST time server through a local home/office WiFi. I am using EasyESP-1 board for illustration. The time will be displayed on a 2.2″ ILI9341-driven TFT LCD. Please read Tutorial 7 for more details on how to interface the TFT LCD to EasyESP-1. The hardware setup for this project is same as for Tutorial 7.

Complete setup of LCD on the EasyESP-1 breadboard

Complete setup of LCD on the EasyESP-1 breadboard for Internet Clock

Software

As discussed in Tutorial 7, we will use the same TFT ILI9341 ESP library by Bodmer in this project too. The library comes with some really cool demo examples. This tutorial actually incorporates their TFT_Clock example for displaying time in an analog clock dial format. There are several examples available online showing how to implement Network Time Protocol (NTP) in Arduino to fetch time from NIST server. NIST operates several time servers for its Internet Time Service (ITS). The list of these time servers and their IP addresses can be found here. Note that NIST does not allow queries to any of their servers more frequently than once every 4 seconds. In this project, the queries are made once every two minutes. In between the queries, which is a 2-minute interval, the time is kept running locally using the delay() routine. You can download the complete ESP8266 Firmware for this project from the following link.

Download Internet Clock ILI9341 code

Important notes:

  • The time-fetching code was derived from Kev_MacD‘s instructables on Steampunk ESP8266 Internet connected Clock.
  • In the code, you need to change the network SSID and password to match to your network.
  • In addition, you also need to adjust the GMT offset for your location to get the correct local time. For example, the GMT offset for EST is -5 (int hours_Offset_From_GMT = -5;).
  • The display part of the code uses the TFT ILI9341 ESP library. You can read more about it in Tutorial 7.
  • The time is displayed in 12 hour format on analog dial as well as in 24 hour digital format .
Internet clock

ESP8266 Internet clock

Buy EasyESP-1 board

More tutorials

EASYESP-1: A RAPID PROTOTYPING AND DEVELOPMENT BOARD FOR ESP8266
TUTORIAL 1: SETTING UP THE ARDUINO IDE FOR EASYESP-1
TUTORIAL 2: EASYESP-1 “HELLO WORLD” EXAMPLE
TUTORIAL 3: CONNECTING AN OLED DISPLAY TO ESP8266
TUTORIAL 4: WORKING WITH ESP8266 WIFI SCAN CLASS
TUTORIAL 5: SETTING UP AN ESP8266 WEB SERVER
TUTORIAL 6: ESP8266 AND BME280 MAKE A LOCAL/REMOTE WEATHER STATION
TUTORIAL 7: ESP8266 AND ILI9341 TFT LCD

The post Tutorial 8: ESP8266 Internet clock appeared first on Embedded Lab.

Automatic candy sorter

$
0
0

Built by Willem Pennings from the Netherlands, this color candy sorting machine is robust and beautifully designed. It uses an Arduino controller, stepper motors, an RGB color sensor and several 3D-printed parts to perform sorting of colorful candies like M&M and Skittles. It can sort a 300 gram bag of mixed M&M in approximately 2-3 minutes.

Arduino candy sorter

Arduino candy sorter

Posted below is a video showing the machine in action.

The machine is able to sort M&M’s and Skittles by colour by performing optical measurements using the RGB sensor. It can be modified to sort any type of coloured object, as long as the individual pieces have a regular shape with even dimensions. It takes approximately 2-3 minutes to sort a 300 g bag of Skittles / M&M’s and sorts about 2 pieces per second. The machine is 250 mm in diameter and approximately 300 mm in height.

While in the hopper, candy pieces are constantly mixed to prevent clogging at the inlet of the upper scanner tube. The scanner consists of a small wheel with four slots which are 90 degrees apart. After a piece enters a slot, the wheel, which is powered by a stepper motor, rotates 90 degrees so a measurement can be performed. The RGB sensor takes three consecutive measurements, which take 30 milliseconds each. The Arduino controller then determines the item colour (based on reference data) and positions the exit tube (also using a stepper motor) to guide the piece to the correct container. Just before the exit tube reaches its target position, the wheel turns another 90 degrees to drop the piece. The process is then repeated. During the process, visual feedback is provided using the LED strip that encircles the machine.

The post Automatic candy sorter appeared first on Embedded Lab.

Arduino powered mini conveyor belt for training purpose

$
0
0

Belt conveyors are key components of industrial automation systems. This modular mini conveyor belt is designed to replicate a miniature version of an industrial automation process that can be used in educational environments for industrial automation illustration using microcontrollers. It consists of a speed controller to drive a stepper motor with up to 2 Amps, and an Arduino board for automating tasks. The speed can be varied from 0 to 300 RPM, and is displayed on a 3-digit seven segment display module.

Arduino powered mini conveyor belt

Arduino powered mini conveyor belt

The design was conceived to have the least amount of complex mechanical elements as possible, however, two special non trivial steps are required: cut and joint the timing belt that transfers rotation from the motor to the axle, and make the conveyor belt.

Video showing the conveyor belt in action.

The post Arduino powered mini conveyor belt for training purpose appeared first on Embedded Lab.

PolaPi: A Pi Zero based instant point, shoot, and print camera

$
0
0

Even in today’s age of smartphones, polaroid cameras are still very popular because it not only allows you to capture the moments instantly, but also let you hold the printed picture immediately after taking the shot. Muth’s PolaPi is a Raspberry Pi Zero powered DIY instant camera that can point, shoot, and print the pictures on thermal papers. It uses a Sharp memory LCD for ‘live-view’ (and for review after taking shots) and the Nano thermal printer from Adafruit for printing monochrome images.

PolaPi Zero: A Raspberry Pi Zero powered instant camera

PolaPi Zero: A Raspberry Pi Zero powered instant camera

Camera demo is shown in the following video.

The post PolaPi: A Pi Zero based instant point, shoot, and print camera appeared first on Embedded Lab.

Viewing all 713 articles
Browse latest View live