Week 8

 Synchronous Serial Labs

Lab: OLED Screen Display using I2C

From the lab: I2C is another popular synchronous serial protocol. It also uses a bus configuration like SPI, but there are only two connections between the controller device and the peripheral devices as shown in Figure 4:

  • a Serial Clock (SCL) connection, on which the controller sends the clock signal, just as in SPI

  • a Serial Data (SDA) connection, on which the controller and peripherals exchange data in both directions.

Here’s the board setup. The four pins on the OLED display module are ground, power, serial clock, and serial data.

I put the code in, but the dimensions of the OLED were set to a height of 64 and a width of 128 in the original code. So I changed it to a width of 32 and a height of 128 because that’s what the OLED package described. It felt more intuitive to me that the values of height and width would be based on how the object is oriented with the text reading left to right. You can see on the left what happened when the dimensions are flipped and once I had corrected it on the right. I also changed the font after these pics were taken so the second line wouldn’t be cut off.

I believe because I wasn’t using the exact OLED, I wasn’t able to get the QR code on the display. I fiddled around with the code trying to figure out what aspect in particular might not work for this OLED model but couldn’t figure it out.

Link to lab here.

Got the larger screen and it worked!


Lab: Playing .WAV Files from an Arduino using I2S and SPI

Definition from the lab

I2S, the Inter-IC Sound protocol, is a serial protocol used for connecting digital audio devices. I2S allows you to transmit Pulse-Code Modulated (PCM) audio data between integrated circuits, like a microcontroller and a digital amplifier.

Serial Data In (SDI), on which the controller sends data to the peripheral devices.

  • a Serial Data Out (SDO), on which the peripheral devices send data to the controller.

  • a Clock (SCLK) connection, on which the controller sends a regular clock signal to the peripheral devices.

  • one or more Chip Select (CS) connections, which the controller uses to signal the peripheral devices when to listen to incoming data and when to ignore it.

Couldn’t get this one to work. I think something is wrong with the speaker because there’s nowhere to put the wires.

Previous
Previous

Week 7

Next
Next

Week 10