14. Networking and communications

Weekly Assignment Requirement

Individual assignments

  • design, build, and connect wired or wireless node(s) with network or bus addresses

Group assignment

  • send a message between two projects

Description of Assignment Work

I’m going to use ESP32 for the MCU of my final project. So it was nice timing to design my board with it for this week’s assignment. Our instructor sent me class kit based on ESP32 since we couldn’t have access to the lab yet. I used it to test programs for weekly assignment.

Barduino 2.0

Barduino 2.0 is a ESP32 based board which was designed by Eduardo Chamorro Martin with the help of Josep Marti and Oscar Gonzalez in FabLab Barcelona. I was given the parts and the board already cut for assembling it from my instructor. I soldered it firstly and then tried some sample code for checking its operation.

soldering

class kit for assembling Barduino. literary posted to my flat on Sunday morning. the parts were listed neatly thankfully.


to fix the position of the MCU part, used masking tape and soldered some legs of it firstly

soldering legs was an irritating work at first. but gradually got used to do it and liked to do it at the end of the day.

soldered all the legs of the MCU and did pre-soldering for all the parts

Later, I found that doing pre-soldering was better for only one side of the pad because it was faster and parts would be stable while putting the parts on pads.

set pin holder for preparing to solder (using pliers to hold to solder)


soldered from the gap



done!

test programing

I tried some sample programs for checking wether the board working properly or not.

how to load a program

  • Installing an additional core for ESP32 by board manager. I’ve already got it on week11 actually.


  • Connecting the board to the computer via FTDI cable
  • Setting for the board as the following image


  • Uploading program with program mode(switch left)

  • then press reset button after “Connecting…” being indicated on Arduino IDE


  • When finish uploading, turn the switch to the right (run mode) and press reset button again



[TEST1] echo hello
there was a sample program for ESP32 on FabAcademy week06.

  1. put a character or string data on serial monitor and send it
  2. MCU returns characters you typed one by one


[TEST2] blink
tried simple blink program.
pin13 was a built-in LED on Barduino. so I set it on the program.



[TEST3] Blink via HTTP request
library for ESP32 had sample programs. I tried one of them named SimpleWifiServer.

select the program from
Arduino IDE > File > Examples > Examples for ESP32 Dev Module > Wifi > SimpleWifiServer


and I had to do was to set id and password for wifi to the following part.

const char* ssid     = "yourssid";
const char* password = "yourpasswd";

the program enable us to turn LED on and off via the web. using web browser, access to the generated web page which had two links to control LED.


I had done 3 programs the board worked properly. so now the time to try the program I wanted to use for my final project.

painlessMesh

painlessMesh is a library for Mesh networking on Arduino.
Mesh networking does not need router. it enables every node communicate each other.

I think this is suitable for my final project because I want to control Lots of LED at a time without wired connection. So I tried this library with the sample code firstly. then I tried to create my original code for my final project especially to use for Neopixels.

Sample code

I tried the sample code “Basic”.

[1] sends a message to every node on the mesh at a random time between 1 and 5 seconds
[2] prints anything it receives to Serial.print

I used 3 MCUs (Barduino, ESP32 dev board, and ESP8266) and changed the text-part of the program as each sends hello and its name (like msg-Hello from Barduino).


the video shows serial monitor for ESP8266. I connected ESP8266 to my laptop and the two other boards connected to power supplier (AC adapter and mac mini(only for power supplying)). you can see it received messages from Barduino and ESP32 at random time.



serial monitor for Barduino. in the first part, sent message to the other boards and started receiving messages from ESP32 and ESP8266 a little later. their log showed up in turns.



Next plan

Based on the testing above, I planed the program for my final project.
——
PainlessMesh with Neopixel
I prepare 3 devices including Barduino inside.
the person walk through like Device 1 → Device 2 → Device 3.

  1. phase 1
    Device 1 : Sense the person coming closer and light 100% on. then send message to Device 2
    Device 2 : receive a message from Device 1, then light 50% on
    Device 3 : just waiting for a message (receive message from Device 1 and keep light off)

  2. phase 2
    Device 1 : the person head to Device 2. receive a message from Device 2. then light 50% on
    Device 2 : Sense the person coming closer and light 100% on. then send message to Device 3 and Device 1
    Device 3 : receive a message from Device 2, then light 50% on

  3. phase 3
    Device 1 : receive message from Device 3 then turn light off
    Device 2 :the person head to Device 3. receive a message from Device 3. then light 50% on
    Device 3 : Sense the person coming closer and light 100% on. then send message to Device 2 and Device 1

Group Assignment

In the group page for this week, it is written about network communication using MQTT for the machine design week mainly.
Please see the link below.

Kamakura Group assignment week14

Description of Important Weekly Learning Outcome

By doing the assignment of this week, I could imagine the networking system of my final project. I had already known that ESP32 was designed to connect to the internet easily. This time, I’ve leant that a number of ESP32 could organize the network by themselves. It seemed quite useful to collect data using sensors from anywhere. Unfortunately, I didn’t try the wired connection this time so I want to try it another time.

Appendix

Barduino 2.0 (Japanese introduction)