Author Archives: R-B

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

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.

Arduino powered mini conveyor belt for training purpose

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.

Automatic candy sorter

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.

Tutorial 8: ESP8266 Internet clock

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

Tutorial 7: ESP8266 and ILI9341 TFT LCD

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
« Older Entries Recent Entries »