Network programming

group assignment

#1 - Send a message between two projects

There are many ways to communicate between MCUs/CPUs:

Learnings

A simple Tx/Rx link

Here is what I want to achieve:

  • At startup, LED is Off and the MCU is waiting for commands from the terminal
  • When a "S" (start) command is sent, the MCU will turn the LED On
  • When user press on the button, the MCU will turn the LED off and send a message (user acknowledge) to the terminal.

The LED is connected to port number 5 and to the GND through a resistor. To turn the LED On, the MCU has to set the port number 5 to HIGH

The button is connected to port number 6 and there is an HW pull-up to force it to HIGH unless someone push on the button (then it goes to LOW until the button is depressed)

I already have a working board (from week 7) and I know the FTDI communication works. I will start from there and add the missing use cases:

Here is how the code looks like once everything is in place

Finally, let's wrap all this and implement the required features. Note: the SoftwareSerial library is conflicting with the Interrupt library, this is a known problem I don't want to investigate now. My fallback plan is to use the SW debouncing method

Click here for a detailed documentation and to get the source code
A wireless link over BLE (Bluetooth Low Energy)

The SKB369 is a highly integrated Bluetooth 4.2 BLE module, designed for high data rate, short-range wireless communication in the 2.4GHz ISM band. Also, SKB369 support ANT Protocol. The module is based on Nordic nRF52832 radio Transceiver IC, has a 32 bit ARM Cortex-M4F CPU, Flash memory and analog and digital peripherals. The SKB369 provides a low power and ultra-low cost BLE solution for wireless transmission applications. The SKB369 also has a NFC-A tag interface for OOB pairing.

For this demo, my board is on one side and my iPhone on the other side. The nRF Toolbox (from Nordic) runs on the iPhone and my code runs on the ATMEGA328P. At startup, my board will set a unique name (based on SKB369 MAC address) and start advertising

Then I select the advertising device and I press on Connect button on the iPhone. My code continues with a peering confirmation

From there, messages are trasmitted from my code to the iPhone App. Here is the app log

If I kill the iPhone app, my code with resume advertising

Click here for a detailed documentation and to get the source code