Week 12 - Networking and Communications
This week we went over a lot of different ways to send messages either through physical wires or with signal waves. This included standard communication protocols like SPI and I2C, but also touched upon other newer techniques like LoRa.
Assignments:- As a group send a message between two different projects
- Design, build, and connect wired or wireless node(s) with network or bus addresses and local input and/or output devices
Communicating Between Projects
Matti and Sun did a great job demonstrating the communicaiton capabilites between two projects. Matti has been working with e-ink displays and Sun had been useing wireless protocols for his final project, so the two of them teamed up to have Sun send a message to Matti's screen. Details of their efforts can be found on the class site.
Designing, Building, and Testing a Node
From machine building week, I had already done a lot of design work on making simple prototype boards for controlling the IMU and servos so that the software team could get started on code as soon as possible. But, once we had the boards made we passed them off and I did not participate in writing any of the code to talk to these devices. As such, I felt it would be a relatively low lift to play with some of the early boards we made to get familiar with the communication protocols involved.Since I had cut some of these boards with Ben last week, I found one that was floating around to use for this assigment. Details on the complete design and fabrication of the board can be found on the Week 11 page. I did have to replace the IMU because the breakout had a pin or two damaged, but once that was in place I ran the test code from the Arduino ICM20948 library. This program uses I2C as the communication protocol between the devices on the SDA and SCL lines. The beakout board even comes with the pullup resistors already implemented, so it is very plug and play. Everything worked perfectly and I was able to see the readout of the device in the serial monitor.
I also recently decided that I want to try and use the 2.8" touch screen for my final project, so I also used this week to work on the SPI communicaiton for the TFT module. In this instance though, I did not make a board so I instead wired it all up on a breadboard (sorry Professor...) by following the wiring guide. I did see some notes that the MISO and RST pins could potentially be omitted since there is no data output from the screen (into the XIAO) and I may not need to reset the device. This is particularly useful because I am getting low on XIAO outputs and I need two for my light source board.
In order to use this screen with Arduino, I had to start by including the Ucglib library in my IDE. It took me a few minutes to get the pin assignments correct coming off the XIAO board, but once those were setup properly I was able to test the TFT with the built in examples. In my case, I used the standard SCLK (pin 8) and data/SDI/MOSI (pin 10) pins, but then I set the CD, CS, and reset lines to A0, A2, and A1 respectively. I then started to place a few text lines to begin the layout of how I would like my UI to be setup, or at least to start getting familiar with how the shapes are written to the screen. An image of the graphics test example sketch is on the left and the beginnings of my UI is on the right.
I did try to then get the touch pad working, but for some reason this time I really struggled. I could not get the recommended library working, it kept coming up with errors that as far as I can tell are tied to the library files and I didn't want to start messing with those. I then found the chip used in the schematic, the XPT2046, and tried to use libraries the community had written for communicating with this chip. I tried a number of different packages, most of which I was able to simply update the screen communication pins and the screen worked first try. However the touch pad never did. I am going to try a different screen when I get into the electronics bay, but I realized that as a final worst case scenario I can control my user interface through commands with my laptop connected. This is not ideal, I would like to figure out the touchscreen, but I do have a backup plan at the very least.