Fab Academy 2025 - David Fernandez Week 11 - Embedded Networking and Communications

Week 11 - Embedded Networking and Communications

WEEKLY PLAN

Group assignment:

  • Send a message between two projects

Individual assignment:

  • Design, build and connect wired or wireless node(s) with network or bus addresses and a local input and/or output devices

GROUP ASSIGNMENT

This is the link to the Fab Lab León Group Assignments page. Since I am completing the group assignment on my own I left the documentation on this page.

MULTIMETER

Text here

Text here

Text here

Text here


Top

INDIVIDUAL ASSIGNMENT

Bluetooth Low Energy (BLE) sensor data exchange

Bluetooth Low Energy (BLE) is a wireless communication technology designed for short-range data exchange with very low power consumption.  BLE is optimized for short distance (typically up to 100m) transmission of small amounts of data (low bandwidth). To save energy, BLE remains in sleep mode constantly except for when a connection is initiated. Some applications of BLE are wearables, smart homes, smart appliances, and tracking beacons.

An application of BLE is the possibility of connecting and sending data between two microcontrollers ESP32. This involves setting up one as a BLE server and the other as a BLE client. The server advertises services and characteristics; the client connects and reads/writes data.

The XIAO ESP32C6 can act either as a client or as a server. I have purchased 2 of these micro-controllers so I am going to set up one as server and the other as client. The client will have a light sensor connected, so it will send the readings to the server. The server will display the data on an OLED screen.

For the server I start with the code from the Seed Studio wiki  for the XIAO ESP32C6

I remove the libraries and parts of the code that were not needed, as I am not using the same modules. Next, I define the pin where the phototransistor is connected on the XIAO (D2) and I set the phototransistor pin as input.

After uploading the program to the XIAO working as Server, I use the nRF Connect App to search for the Bluetooth device and checking if sending the sensor data.

Next, I take the other XIAOESP32 C6, which acts as client and I connect the OLED screen.

I connect SCL to pin D5 and SDA to pin D4.

The Bluetooth communication works and the server is sending data to the client. Unfortunately, the data displayed is always 1.

TROUBLESHOOTING

Initially I was using a FabXIAO with XIAO ESP32C3 and a XIAO ESP32C6 on my development board.

Although I didn't have an additional development board, I decided to use two XIAO ESP32C6 from now on. The photo-transistor sensor is now connected to the XIAO board with jumper wires.

I began by checking the connections and pins, and everything appeared to be in order.

Thanks to my instructor Nuria, I realised that I had mistakenly used `digitalRead()` in the server program instead of `analogRead()`. After correcting the program, I started receiving new readings; however, they seemed inconsistent, providing erratic measurements from the light sensor.

Pablo guided me in the right direction, indicating that I needed to re-map the voltage readings from the phototransistor pin to a specific range of values.

First, I used the serial monitor to observe the voltage input on the D2 pin, measuring it both in low-light conditions and under direct light. I obtained values ranging from 100 to 3300.

The syntax for the `map()` function is as follows:

  • map(value, fromLow, fromHigh, toLow, toHigh)

Consequently, the modified code for the server looks like this:

Finally, the BLE data transfer works well, and the system displays accurate values that responds to changes in light intensity.

CIRCUIT SIMULATION

Text here

  • Printer: BambuLab X1 Carbon

Text here

Text here

CASE DESIGN

Text here

Text here



FILES

CAD model of screwdriver base design: CAD_screwdriver_base_design.step


Top