Environmental Sensor for a Science Classroom

by kmc123 in Teachers > Science

5821 Views, 103 Favorites, 0 Comments

Environmental Sensor for a Science Classroom

IMG_0829[1].JPG

My sister is a science teacher and was telling me how they were testing various environmental items with multiple devices, and many were not so accurate. (CO2 using strips and drops and looking for color change differences, etc...)

I immediately knew that I could make something much more accurate for her with all of the Arduino / Pi sensors out there, so I went to work looking for what I'd need to make this.

I found an Environmental Combo Breakout Sensor that will measure 7 items from 2 sensors combined on a 1" x 1" board!

She needed to be able to take it outside with students, so it needed a pretty rugged case and had to have a display to get the results (No reading results via serial monitor on a PC)

Supplies

Arduino Mega: https://www.amazon.com/gp/product/B016JWNYBE

RAMPS Controller Board: https://www.amazon.com/gp/product/B01E5K98C6

Display: https://www.amazon.com/gp/product/B01FH8KTZU

SparkFun Environmental Combo Breakout - CCS811 / BME280 Sensor: https://www.amazon.com/gp/product/B076955G5S

Qwiic cables: https://www.amazon.com/gp/product/B08HQ1VSVL

3d Printed Case: https://www.thingiverse.com/thing:3383359

(2) M3x8 Stainless steel hex socket head nuts and bolts for mounting the sensor to the sensor mounting plate

(4) M2x20 Stainless steel hex socket head bolts and washers for mounting the sensor mounting plate to the c

(4) M3x20 Black alloy steel hex socket head bolts - 2 for the top of the front panel, and 2 for the left side panel

(2) M3x30 Black alloy steel hex socket head bolts for the bottom of the front panel

3D Print the Case

IMG_0849.JPG
IMG_0850.JPG
IMG_0831.JPG
IMG_0851.JPG

The coolest case that I found that fits a nice 128x64 pixel display and an Arduino Mega was this one:

https://www.thingiverse.com/thing:3383359

It is mostly used for homemade 3D Printers but is perfect for this project.

Print the main body (CHACRAS-CarterPrincipal.STL) and the left side (CHACRAS-CapotLateral.STL) in black.

Then print the faceplate (Chacras_Capot_Ecran.STL) in whatever contrasting color you want.

You will also want to print at least 1 of the 40x40 fan blocks (Opturateur_Fan_40x40_avec_plots.STL) to use a a sensor mount.

To assemble the case later, you will need:

(4) M3x20 Black alloy steel hex socket head bolts - 2 for the top of the front panel, and 2 for the left side panel
(2) M3x30 Black alloy steel hex socket head bolts for the bottom of the front panel

Make the Sensor Mount

IMG_0833.JPG
IMG_0834.JPG
IMG_0835.JPG
IMG_0836.JPG

You will notice that the case has a nice large grill on the front with space to mount 2 fans behind the grill on the front.

We won't be adding fans because we aren't using this for it's intended use as a 3D printer controller which has up to 5 motor controllers and can get really hot.

For our use, fans would not only draw more power, but also mess up the readings, especially the temperature and air pressure readings.

  1. Place the sensor board on the fan block and mark the 2 holes.
  2. Remove the sensor board and place it somewhere safe. (It has tiny holes in the sensors that could easily get blocked by sawdust or plastic shavings)
  3. Drill the 2 holes, and mount the sensor as shown with 2 M3x8 Stainless steel hex socket head nuts and bolts.

Attach the Sensor to the RAMPS Board

IMG_0844.JPG
IMG_0845.JPG

Technically the RAMPS board is not needed in this project and if you want to save 12 bucks you can get away without using it, BUT:

  1. The case has pre-made slots to make the Arduino MEGA with the RAMPS board fit in without moving so if you remove the RAMPS board, you will have to hot glue the Arduino board in or figure out some way to make it stay in place.
  2. The RAMPS board has the pins laid out on the right side to accept the female connector of the display I'm using - If you remove the RAMPS board, you will have to jumper each pin from the display board to the Arduino.

So for those 2 reasons, I chose to use the RAMPS board.

The sensor board can be connected by soldering wires to the connection points, or by using a qwiic connector cable. I chose to use the qwiic cable because it allowed me to make an easy way to daisy chain sensors back to back in future updates to this project without having to have my sister return it to me for soldering other sensors on - She can simply plug in a new sensor into the string!

The RAMPS board has a 4 pin I2C pinout (See the bottom right of the first picture) - We can use the ground, SDA (20), and SCL (21) pins here, but can NOT use the 5v pin!

USING THE 5V PIN CAN RUIN THE 3.3V SENSOR

For ground, SDA, and SCL - I ended up soldering the ends of 3 female connectors to the ends of the ramps cable and then used heat shrink tubing on the joints to clean it up.

I then just pushed them on to the corresponding pins on the RAMPS board

For the 3.3v, I soldered the 3.3v wire to the 3.3v solder joint exposed through the RAMPS board.

Finally, Use a zip tie to shorten the cables.

Attach the Sensor Mount to the Case

IMG_0836.JPG
IMG_0853.JPG
IMG_0827.JPG

Now we need to connect the sensor mount to the case - THIS IS THE HARDEST PART OF THE PROJECT!

It is very tight getting your hands and an allen wrench inside of the case. Take our time and have patience.

Place the sensor mount into the left hand slot and use the (4) M2x20 Stainless steel hex socket head bolts and washers to secure it into place.

Try to start them in with your fingertips - Press in while turning because you are cutting threads into the plastic as you go.

DO NOT OVER TIGHTEN OR YOU WILL STRIP OUT THE PLASTIC.

Attach the 128x64 Display to the RAMPS Board

IMG_0839.JPG
IMG_0840.JPG
IMG_0848.JPG

First, plug in the cables from the 128x64 display to the daughterboard - EXP1 goes to the port farthest from the 8 pin SPI connector and EXP2 goes to the port closest to the 8 pin SPI connector.

Next, connect the display daughterboard to the RAMPS board.

Finally, Use a zip tie to shorten the cables.

Attach the RAMPS Board to the Arduino Board and Insert It Into the Case

IMG_0854.JPG
IMG_0855.JPG
IMG_0856.JPG

Attach the RAMPS board to the Arduino board by aligning the pins and pressing it down.

Then carefully slide the combined boards into the slots in the case as shown.

Route the wires away from the display mounts and side mounts and lay the display in place.

Attach the Faceplate

IMG_0857.JPG

Attach the faceplate on the right side using a M3x20 Black alloy steel hex socket head bolt for the top right and a M3x30 Black alloy steel hex socket head bolt for the bottom right.

Press down while turning because you are cutting threads into the plastic on the first time.

DO NOT OVER TIGHTEN OR YOU WILL STRIP OUT THE PLASTIC.

Attach Side Cover

IMG_0850.JPG
IMG_0859.JPG
IMG_0860.JPG

Attach the side cover using 2 M3x20 Black alloy steel hex socket head bolts.

Press down while turning because you are cutting threads into the plastic on the first time.

DO NOT OVER TIGHTEN OR YOU WILL STRIP OUT THE PLASTIC.

Unlike the faceplate, these bolts will not be visible when tightened all the way down.

Add the Last 2 Bolts to the Faceplate

IMG_0858.JPG

Attach the faceplate on the left side using a M3x20 Black alloy steel hex socket head bolt for the top left and a M3x30 Black alloy steel hex socket head bolt for the bottom left.

Press down while turning because you are cutting threads into the plastic on the first time.

DO NOT OVER TIGHTEN OR YOU WILL STRIP OUT THE PLASTIC.

Upload the Code to the Arduino Mega Board

Upload the code to the Arduino Mega board.

If you have never done this before, look on YouTube for tutorials, but here are the basic steps.

  1. Open the file in the Arduino IDE
  2. It will ask to make a directory - Say Yes
  3. Go to "Tools", "Board", and select "Arduino Mega or Mega 2560"
  4. Go to "Tools", "Port", and select the comm port that you are using.
  5. Click on the 2nd circle icon with an arrow pointing to the right - This is the "Upload" button and will compile the code and send it to the Arduino and then run it.

From this point forward, whenever the Arduino is powered up, that code will automatically run.

Note:

I made a splash screen with the logo of my sisters school and a message to her on it - you'll probably want to comment that part out altogether or make your own logo and message to replace mine.

To make a new bitmap logo for the screen, use this cool online tool:

https://marlinfw.org/tools/u8glib/converter.html

Marlin 2.x, ASCII Art, and Bitmap should be selected.

Finished!

IMG_0825.JPG
IMG_0826.JPG
IMG_0829.JPG
IMG_0830.JPG

It should now power up and show the splash screen for 10 seconds and then default to the metric readout.

If you prefer imperial, just press the knob button in and it will switch over to imperial.

One accuracy note that I've found is that the board contains 2 sensors on 1 board - 1 for the Carbon Dioxide and Total Volatile Organic Compounds, and 1 for the Temperature, Air Pressure, Humidity, Dew Point, and Altitude.

They are too close together and the heater element in the CO2 / TVOC sensor quickly makes the Temp reading on the other sensor many degrees off.

Currently the workaround for this is to have her students record the temperature as soon as it's turned on, but I hope to update my code with some sort of fix where I do something like store the temp at turn on and then subtract the difference from turn on temp and later readout temps to make it more accurate - Still thinking about this one...