Home About Me Weekly Assigments Final Project


Networking and Communications

Fab Academy 2018


Week #13



By the end of this week we should be able to communicate between two devices wired or wireless. I'm so disappointed because nothing works with me whatever I tried. I worked with WIFI, Bluetooth but there is no success until now :'( .


WIFI ESP8266 07


I used ESP8266_07 WiFi module. Chip pinout shown below. For more detiales about connections, modes and AT command read THIS DATASHEET

esp7

I imitated the hello.ESP8266-12E board by Neil but I changed the required connection due to the difference in the chip pin out making sure the chip will connect at Normal Bootloader Mode shown in the table. This is my EAgle design:


espModes

This is my Eagle schematic design:


wifischm

This is my Eagle board layout after routing:


wifiBoard

This is the ready exported image from eagle, which will be transferred to Fabmodules to set milling settings.


WIFIinside

Then I followed the procedure which I did in Electronics Design week to fabricate my board and solder it My final results:


MyBoard

Now I should connect ESP 07 chip to my laptop USB port using 3.3V FTDI because ESP 07 should be connected to 3.3V not 5V. But unfortunately this cable wasn't in the lap when I star working so I tried to use a simple voltage divieder circuit shown below. Unluckily nothing works


voltagedivider
connect

So I just try to connect ESP 07 directly with 5V FTDI cable without voltage divider as shown:


FTDI

I know it is a stupid decision, but I just tried and it worked!!!!!!!!
. I open Arduino IDE serial monitor and change baud rate to 115200 which is the default for this ESP chip. Then I started sending AT commands through it. The first command was AT and the response OK which mean that it recognized ESP chip.


1resp

Check the WiFi mode using AT+CWMODE? there is three modes 1 is client. 2 is host and 3 is dual mode. My chip is in host mode now.


2resp

Try to create a network using AT+CWJAP="NAME","Password" first several tries failed because of wrong in typing the commands.

Finally, it works and connected to my phone this is default name


net1

Change the name and set a password using this command:


creatisra

My phone connected to my network:


netisra

Now I will try to use my chip as a client so I changed the mode to 1 using AT+CWMODE=1 then used AT+CWLAP to list avliable networks


wifiList

After several tries I could finaly connect to a network :)


conweb

Now I tried to use Blynk app to control Arduino using ESP board. I found this useful Tutorial on YouTube to help me using my WIFI board to control Arduino pins through Blynk application. I started as I did in the previous week with blynk settings. After some steps while I'm trying to upload the code Suddenly my chip stop response to anything it seems that it burned due to 5V FTDI connection :( I need to replace the chip then repeat everything. Unfortunately, there no more chips in the lab.

Blynk Application with ESP8266 LoLin NodeMCU V3



As I mentioned before, I burned my ESP board so I used ESP8266 LoLin NodeMCU V3 board.


lolin

The board's pin out:


nodemcu_pins

From pin out you can see the board has many GPIO: General Purpose Input Output pins which can be used as Arduino's digital pins. I want to use my smart phone to control RGB led connected with three GPIO pins. I used common Anode RGB as I did in Output Devices Week.

I started with installing the necessary libraries on Arduino IDE. Firstly, I installed Blynk application on my smart phone from App Store. Secondly, I installed latest blynk library from HERE and added it to an Arduino libraries folder.

After that I followed steps in < a href=" http://henrysbench.capnfatz.com/henrys-bench/arduino-projects-tips-and-more/arduino-esp8266-lolin-nodemcu-getting-started/">This Tutorial to instal ESP8266 library, then I could choose this board in Arduino IDE.


nodemcu_pins

After that, I connect RGB LED with the board and connect ESP board to my laptop using USB cable.


hardwareConn

In my phone I built a new project in Blynk App. I chose device and connection type as shown:


create

After I pressed Creat New Project, I recived the auth token code in my email

The next step was to find example from Blynk example generator page. Start by adding the received Auth Token and choose suitable example as show:


blynkexample

Afterwards, I simply pasted the code in Arduino IDE and carefully type the name and password of the network ( it should be the same as the network connected with the smart phone). Then upload this code to the ESP Board.


codeBlynk

Back to Blynk App. I added a button named it RED and connect it to GP14 and change it's color to red.


RedButton

Then, I repeated the previous step to to add three more buttons: Green, Blue and Button (connected to the board build-in LED). Final interface screen:


interface

The last thing was pressing on the start button and start playing :) . IMPORTANT NOTE: I used common anode RGB which will light when button off (LOW logic), also I discovered that the build-in LED works at the same logic. To start with off leds I pressed all button as shown:


off

See result in this vedio





How Blynk Works?

Blynk is a platform with iOS and Android apps to control Arduino, ESP8266, Raspberry Pi and the likes over the Internet. You can easily build graphic interfaces for all your projects by simply dragging and dropping widgets. To know how it is work I read refer to This web Page. Also for more details you can read This Page. After that I designed this picture to briefly summarize everything.


off





Software Serial

ATtiny 44 Hello board with Arduino UNO


I want to let my ATtiny44 Hello board to 'talk' with Arduino UNO board using serial communication. Unfortunately, there is no hardware serial in ATtiny44 board, so I decided to use SoftwareSerial.h which is a library enables any two digital pins to behave as RX and TX Serial pins.
To do this task I wrote two codes. First one of ATtiny to send a string to Arduino UNO and lights an LED when I pressed the button. The second code of Arduino to print the string received from ATtiny on Arduino IDE serial monitor.

This is ATtiny code with explnation comments:


AttinySerial

And this is Arduino UNO code with explnation comments:


ArduinoSerial

After I uploaded my code to ATtiny board as I did in Electronics Design week. I made this connection:

The connection shown in this figure:


serialcon

watch this video to show my results:




BLUETOOTH Technology

HM-11 Board design


I tried to design a board of HM-11 Bluetooth module chip. This is my schematic:


schemBlue

This is the board layout after routing:


layoutBlue

This is the traces in exported image from Eagle:


BLUEinside

This is my board after soldaring:


blueBoard

After I finished my board I connect it to my laptop with FTDI cable as I did with my WiFi board. I opened the serial monitor and tried to write AT commands without any response :( .



HC-05 Bluetooth Module

Using HC-05 to control LED on ATtiny Hello Board



Due to time limitations I decided to use a HC-0C Bluetooth module instead of fixing my board problems. The connection of this module is super easy I just have to connect GND and VCC to power the module and connect Bluetooth TX to Arduino RX, but to connect Bluetooth RX to Arduino TX I used a voltage divider because the voltage must be 3.3V not 5. The connection shown below:


blueConn

To write a code for ATtiny 44 I defined software serial as I did in a previous interface week. In my code if ATtiny serial receives 'Y' character the LED will lights and If 'N' is received the LED will off. This is my code with explanation comments:


BlueLEDcontrol

To connect with Bluetooth module and send desired data to it, I used Bluetooth Terminal HC-05 Android app on my phone. After upload the code to my AT/tiny Hello board and I connected the module to the ATtiny I could find the Bluetooth HC-05 device and connect to them to be able to sendthe required data to control the LED:


blueTerm1 blueTerm2

Watch the results in this vedio:




Controlling DC motor by HC-05 with& ARDUINO UNO



I controlled DC motor rotation direction using two buttons in output devices week. In this week I wnat to control motor rotation direction with bluetooth instead of buttons. This is my code:


DCblueCode

Watch the results in this vedio:






Problems

As I mentioned before, I faced these problems with my designed board:

Downlaod files