Skip to content

Latest commit

 

History

History
259 lines (155 loc) · 12 KB

Hackathon 2021.md

File metadata and controls

259 lines (155 loc) · 12 KB

Hackathon 2021

This was created as part of Microsoft's 2021 Hackathon.

See a video of it in action to the right.

Parts List

Parts are chosen to be plug and play, with no soldering required. This build uses the Qwiic I2C wiring system to be very easy to piece together.

Sensors can be left off if uninterested in their measurements.

Part Description Sparkfun Link Adafruit Link
Raspberry Pi 4 Model B 2GB Main board. SF Pi 4 AF Pi 4
Sensirion SCD40 CO2, Relative Humidity, and Temperature sensor. SF SCD40 AF SCD40
TE MS5637 Barometric Pressure and Temperature sensor. Used to calibrate the SDC40. SF MS5637
Sensirion SGP40 VOC change sensor. SF SGP40 AF SGP40
Sensirion SPS30 PM0.5, PM1.0, PM2.5, PM4, and PM10 sensor. SF SPS30
Waveshare 2.9" E-ink A display to show measurements.

Addressable RGB

To wire the LEDs, some breadboarding or soldering will be required.

Other than the LEDs themselves, these parts do not require software support. Feel free to mix and match.

Part Description Mouser Link Adafruit Link
SK9822 / APA102C Addressable RGB LEDs. SF APA102C AF SK9822
3.3v to 5v level shifter, min two inputs Converts signals from Pi's 3.3v to the LED's 5v. Mouser SN74AHCT125N AF SN74AHCT125N
Capacitor, min 5V 1000μF To smooth out power demand of LEDs. Mouser ESW108M6R3AH1AA

Operating System Setup

Raspberry Pi logo

Before wiring everything up, lets setup the software.

1. Flash Raspberry Pi OS to a MicroSD card.

I recommend using the Lite (32-bit) image, though the full Desktop image will work as well.

2. Enable I2C and SPI.

Each GPIO on the Raspberry Pi can have many different functions. We need to enable the I2C1, SPI0, and SPI1 interfaces.

Open config.txt file from the boot partition of the MicroSD card, and find this section of the file:

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

And change that section to look like:

# Uncomment some or all of these to enable the optional hardware interfaces
dtparam=i2c_arm=on
#dtparam=i2s=on
dtparam=spi=on

dtoverlay=spi1-1cs,cs0_pin=23

3. Configure SSH.

To run headless and/or allow you to login to your Pi via SSH, create an empty file with the name "ssh" in the same directory as config.txt.

4. Configure WiFi (Optional).

If you want to connect to the Pi via WiFi, configure it now by adding a file wpa_supplicant.conf to the same directory as config.txt:

country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
ssid="your ssid"
psk="your psk"
key_mgmt=WPA-PSK
}

Wiring Instructions

If this is your first time putting together an IoT project with a Raspberry Pi, take some time to get familiar with its GPIO pins:

I<sup>2</sup>C, SPI, and other pins

It's not as intimidating as it looks, but please take it easy. It's very possible you'll fry your hardware if you hook things up incorrectly.

The Hackathon 2021 build makes use of large number of these pins, such as:

  • 3V3, 5V, and Ground (the black pins), to power things.
  • I2C1, to connect Qwiic devices.
  • SPI0, to connect the screen.
  • SPI1, to connect addressable RGB LEDs.
  • Several of the digital pins.

Lets wire things up step by step. You'll want to have several Qwiic cables and some jumper cables available.

SCD40

Qwiic cable with GPIO pin connectors and a JST connector

1. Grab a Qwiic to Female Jumper cable. The SCD40 runs over I2C, and will be connected to I2C1, 3V3, and Ground.

Proceed to the next step to plug it in.


Qwiic cable connecting to device via JST

2. Connect the JST end of the Qwiic cable to the SCD40.


Qwiic cable female jumpbers to connect to Raspberry Pi

3. Connect the female jumper end of the Qwiic cable to the Raspberry Pi.

The wire is color coded to know which hookup to make:

  • Black = GND (any)
  • Red = 3V3 (any)
  • Blue = I2C1 SDA
  • Yellow = I2C1 SCL

MS5637

Qwiic cable to connect SCD40 to MS5637 via JST

4. Time to connect your MS5637. Now grab a Qwiic JST-to-JST cable.

Proceed to the next step to plug it in.


Qwiic cable connecting a SCD40 to a MS5637 via JST

5. Plug one end of the cable into the remaining empty JST header on the SCD40.


Qwiic cable connecting to device via JST

6. Connect the other end of the cable into the MS5637.

Qwiic is designed to be easily chained together, and it doesn't matter which device is connected first or last.


SGP40

Qwiic cable connecting a MS5637 to a SGP40 via JST

7. Repeat the MS5637 instructions, this time chaining the MS5637 to the SGP40.

SPS30

Cable to connect SPS30 to Raspberry Pi via a JST ZHR-5 connector

8. Grab the SPS30 cable.

On one side, you have a JST ZHR-5 connector that goes into the SPS30. On the other side are male jumper pins.


Qwiic cable with GPIO pin connectors and a JST connector

9. Grab a Qwiic to Female Jumper cable. Connect three of the female jumpers to the SPS30 cable.

The wire is color coded to know which hookup to make:

  • Black (Qwiic cable) = Black (SPS30 cable)
  • Blue (Qwiic cable) = White (SPS30 cable)
  • Yellow (Qwiic cable) = Purple (SPS30 cable)

A bundle of female to female jumper wires

10. Grab two short Female to Female Jumper cables.

These will be used to connect the remaining two SPS30 wires to the Raspberry Pi. The wire is color coded to know which hookup to make.

  • Red = 5V (any)
  • Green = GND (any)

The JST ZHR-5 header on the SPS30

11. Connect the JST ZHR-5 connector from your SPS30 cable to the header on the SPS30.

If the connector seems loose, it may not be plugged in all the way.


The intake of the SPS30

When mounting the SPS30, take care to give the intake (with its fibrous filter) good access to air.


The outtake of the SPS30

When mounting the SPS30, take care to give four outtake holes good access to air.

Important: The metal sides of the SPS30 are connected to ground. Be sure it is not touching any conductors, or a short circuit may destroy your devices.


2.9" E-Paper Display

The Waveshare 2.9" E-Paper Display

12. Lets install the 2.9" E-Paper Display.

Observe the ordering of the pins on the rear left header of the 2.9" E-Paper Display:

The connectors of the 2.9" E-Paper Display


The cable used to connect the 2.9" E-Paper Display to the Raspberry Pi

13. Grab the SPS30 cable.

Connect the cable to the 2.9" E-Paper Display module. Connect the other end to the Raspberry Pi. The wire is color coded to know which hookup to make, but double check with the labels on the back in case they change the colors:

  • VCC = 5V (any)
  • GND = GND (any)
  • DIN = SPI0 MOSI
  • CLK = SPI0 SCK
  • CS = CE0
  • DC = 25
  • RST = 17
  • BUSY = 24

LEDs

To connect LEDs, soldering a protoboard is recommended. A breadboard may not be able to handle the power requirements.

TODO

Aether Software Setup

Raspberry Pi logo

1. Connect to your Raspberry Pi.

If you're running headless, SSH into the Pi remotely. Otherwise, connect a screen/keyboard, login, and open a terminal.

The default username and password for a Raspberry Pi are "pi" and "raspberry".


2. Install .NET 6

Follow the .NET 6 Install instructions.

3. Clone Aether

git clone https://github.com/scalablecory/aether.git
cd aether/src/Aether

4. Edit Program.cs

Modify the main command handler based on the hardware you installed. You may need to tweak pin numbers if you didn't wire things exactly the same, or set a different pixel count if you installed addressable RGB.

TODO: replace this step with modifying a config file?

5. Run Aether

dotnet run -c Release -- run-device

Copyright Notice

Images © their respective owners. Images © SparkFun are CC BY 2.0.