Skip to main content

Posts

Showing posts from March, 2018

ESP8266 Mini Project: Digital Thermometer with Binary LED Display

In this post, I'll present another ESP8266 chip based IO project which is digital thermometer with binary display. This is again an GPIO project with temperature sensor being an input pin; LEDs being output pins. If you have OLED Display Module, you can use that component to display the temperature. Figure : Digital Thermometer Circuit and Temperature Sensor Temperature sensor I used is " DS18B20 Temperature Sensor" having 3 wires. Red wire is for VCC(voltage) line, Black wire is Ground (0) and yellow wire is for data line. Yellow wire should be connected to the input pin of the chip. These devices are called as 1-Wire Devices as only 1 wire carries information (temperature info in our case) [1] . I've used Temperature reading section of the code from [1] as is and modified according to this project requirements. Figure: Digital Thermometer vs my circuitry For complete code, see here =>  https://github.com/mdemiray/MicroPython-TempSe

Star Wars ASCIImation with Python - Windows

In this post, we'll watch a Star Wars movie in ASCII format. The only thing we need for this demo is Python-installed PC and internet connection. Figure : Screenshots from Python Command line while Star Wars is being streamed All credits gained in this demo will go to " blinkenlights.nl " [2] website, which broadcasts this ASCII movie using Telnet protocol on Port 23, and Python which makes socket implementation very easy for us. No authentication is needed for this broadcast. Anyone who is able to create a TCP socket and listens  blinkenlights.nl  on port 23 would be able to get this stream and display on their Python command line. CODE My main source for Python source code is [1]. What  code below does is simply importing Python "socket" library, create a socket, use " towel.blinkenlights.nl " address variable to create connection, receive data from socket and display it. While typing (copy/paste) code, be careful about indentatio

ESP8266 Mini Project: Binary Counter

In this post, another mini GPIO project will be presented by using only LEDs. I'll make LEDs count in binary format up to 64 using 6 of them. Main code will be put inside an infinite loop so that chip always goes on counting. Figure : Rightmost LED represents Least Significant Bit (LSB) whereas Leftmost LED represents Most Significant Bit (MSB) as depicted in the figure Setting Up Circuitry GPIO 16, GPIO 5, GPIO 4, GPIO 0, GPIO 2, GPIO 14  pins will be configured as Output pins being pin_D0, pin_D1, pin_D2, pin_D3, pin_D4, pin_D5 respectively. CODE Coding will be too easy for this project but only tricky part would be the function that gets a decimal number and converts that number into binary format. def DisplayBinary(decimalNumber):     # format given decimal...convert to binary..Total number of bits is 6...zero padding....     binaryString = '{0:06b}'.format(decimalNumber)     pin_D0.value(int(binaryString[5]))     pin_D1.value(in

ESP8266 Mini Project: GPIO with Button and LEDs

In this post, I'll be sharing a mini project of mine, again using ESP 8266 NodeMCU chip and MicroPython. This project mainly focuses on GPIO pins and methods for this chip. LEDs will be my output and I'll use a button as an Input. My input button will be used as a Start/Stop command for ongoing operation. Ongoing operation will be blinking of LEDs with varying frequency. I'll implement this project in two different methods: Using Asynchronous Polling Using Interrupt Request Setting Up Circuitry GPIO 16, GPIO 5, GPIO 4, GPIO 0, GPIO 2, GPIO 14 pins will be configured as Output pins being pin_D0, pin_D1, pin_D2, pin_D3, pin_D4, pin_D5 respectively. GPIO 12 will be configured as Input pin and will be connected to a small button circuitry. Button simply behaves as a switch and default position is OPEN (no contact between side pins). By default, logic LOW (0) is applied to input pin, when button is pressed (switch is closed) logic HIGH (1) is applied t

Talking to your ESP8266 Chip (Wired and Wireless Methods)

In my previous post, I mentioned how to setup our chip ESP8266 NodeMCU. As a convention throughout the industry, we should have our chip printed "Hello World!" for us. Firmware had already been installed on our chip. So, the only thing we need is to talk to our chip via Serial Communication Protocols. I'll categorize communication protocols in two groups: REPL and WebREPL .  REPL stands for Read Evaluate Print Loop. In the REPL section, I'll be talking about PuTTY and TeraTerm and in WebREPL section I'll  be talking about only WebREPL sw. 1- Wired REPL Methods i) PuTTY: Figure : A new Serial Session is opened thru PuTTY. Figure : Python Scrips (Hello World) ii) TeraTerm: Figure : TeraTerm Serial Connection Settings Figure : Python Scrips (Hello World) 2- Wireless REPL Methods:  i) WebREPL: Using any of the REPL options above (PuTTY or TeraTerm), first we need to install weprepl library onto chip. import w

How to Setup ESP8266 NodeMCU with MicroPython?

In this post, I'll be introducing the ESP8266 NodeMCU chip and programming it with MicroPython. First thing is first... How to get started with this device? Figure : ESP8266 Chip on breadboard PREREQUISITES Having a chip (ESP8266) A USB-to-micro-USB cable A PC (Windows preferably) 1- Power Up your chip Plug in USB-micro USB cable to both chip and PC. USB-microUSB cable will be used for both powering up the chip and data transferring over it. 2- Download Firmware Go to this URL (http://micropython.org/download#esp8266) [4] and download firmware. It is recommended to use latest and stable builds, not daily and experimental ones. Save the firmware file (.bin) that'll be flashed into the device to a known folder in your PC. Figure : Web Page that firmware resides. 3- Loading Firmware to the Device " esptool.py " will be used to write firmware to the device. This is also called as Flashing the firmware.  If you already know dif