Skip to content

Part 2. Reading from a Sensor

Rachel edited this page Sep 20, 2017 · 2 revisions

Step 1: Wire up the sensor

If you're following along with a DHT22 sensor, here's a way you can wire it up to the Cactus Micro to read from it:

  • Using female-female tie lines, connect the sensor’s + port to the Arduino’s VCC
  • Connect the sensor’s - port to the Arduino’s GND
  • Connect the sensor’s OUT to the Arduino’s 7 (any digital port will do, but this is the one I reference in the sketch)

Step 2: Run the sketch to read from it

  • The sketch is called CMTempTest.ino in this repository. Copy it into a new sketch window.
  • Make sure that the selected Board and Port reads “LilyPad Arduino USB on /dev/tty.usbmodem****”
  • Upload the sketch
  • Wait until it says “Done Uploading”, then open the Serial Monitor and you should see temperature in F and C, humidity, and heat index.

Note: If you skipped the previous section, make sure you have the DHT library installed

Now that we know we can read from sensors, it's time to connect to the internet!

<< Part 2: Installing the Arduino IDE and Libraries - Part 3: Connecting to the Hub >>

Clone this wiki locally