Our local instructor this week was Juha-Pekka Mäkelä. He did an overview of our possibilities for the network and communication. Then, he said something like: as we are in Oulu (you know, 5G, 6G...) it would make sense to go wireless. And I thought he was right. I borrowed from him some XBee modules. XBee is a radio communication module from Digi. If I have the time, I also want to test one of the serial bus communications
To Do
What would it do? I want to switch on/off the LED at board from week 7, Electronics design when one of the hall effect sensor at board from week 11, Input devices detect the magnet is very close to it. This will allow to switch off the LEDs of the thermometer when the wardrobe doors are closed, for the final project- Understanding XBee modules
- Wireless communication between boards
- Try one serial bus
The "Doing"
Understanding XBee modules
- PAN Id: identification of the network. Every component of a networks shares this
- My address: own address of 16 bit, assigned by coordinator. The value for the coordinator is 0
- Destination address: determines which node(s) in the network will receive the data you send (it is in DL (low) and DH (high)).
- each node's address can be found in the reverse of the board
- If you want to broadcast, use DL =FFFF
- Operation channel
Wireless communication between boards
To configure the network, you need to download XCTU. First time you open the application, you get the following:

Add devices
or Discover radio modules connected to your PC
. When pressing discovering, you will need to select the COM ports where your XBees are plugged.



Serial bus
The parts of the code for the actual sending/reading are shown bellow. I have connected the two boards using one 4 pin header in the hall/effect board that was put there for that purpose and the FTDI connector from the other board. I have done two tests: first, sending from the hall-effect with the address of the the other board and second, with another address. The code was working as expected.
Resources
- XBee datasheet
- Pages from Juha-Pekka Mäkelä and Antti Mäntyniemi
- Neil´s code from here and there
Once done
Summary
- I have managed to build a wireless communication network with 2 Xbee modules with addressing
- I have managed to build a serial communication network with 2 modules with addressing
Difficulties
- Main issues came from me: At some point I commented the code t needed for the initialization of the registers, so the code was not working; and it took a while to notice that code was commented. Once I put it back, everything went smoothly
Learnings
- Double check all the code, even those parts you think were working properly previously
Files
- main.c file for sender ( hall effect board)
- main.c file for receiver ( led board)