Let's get started creating our Internet of Things temperature monitor!
FAQ: Are there two versions of the Electric Imp?
Yes. Pictured below are the imp001 on the left, and the imp002 on the right. The imp001 fits into most SD card sockets and contains all of the hardware to "Blink-Up" or connect to your wireless network. The imp002 is a solder down version and allows the developer to create a custom "Blink-Up" circuit. All 12 pins are available with the imp002. We will be using the imp001 for this tutorial, since it contains all of the circuitry to get us going.

microcontrollers_electric_imps.png

This tutorial assumes that your Electric Imp is connected to your WiFi network, (Blinked-Up), and that you have access to the Electric Imp Web IDE, which is currently in open beta. If you haven't, head on over to www.electricimp.com, sign up and follow the commissioning process directions. Alternatively, check out this really nice Instructable by Matt Haines from Electric Imp. 

http://www.instructables.com/id/Getting-Started-with-Electric-Imp/

When your Electric Imp is connected and happily blinking green, you are ready to get started.
If for some reason you have trouble getting connected, the best way to get help is to post on the Electric Imp forums from your developer account. Electric Imp staff and forum members post and reply day and night, so you'll get help right away.

microcontrollers_max31855_unassembled.jpg

First we need to assemble the thermocouple breakout board.  From the strip of 0.1" male header provided, snip a piece with 6 pins, and insert it into the board. An easy way to holder the header into place is to use a piece of masking tape. From one edge of the board, tape up and over the pins and back to the other edge. Then solder each one to the board.  Then insert the screw terminals into the board, flip it over and solder those two pins, and your done!

IMPORTANT! You can solder the pins to these boards facing either up or down. If you want to plug or solder it directly into a breadboard, solder the pins facing down. If you want to lay it flat, and connect it to another device with jumpers, solder it with the pins facing up.

microcontrollers_april_breakout_unassembled.png

If you haven't already assembled your Electric Imp "April" impee, do it now. You can either snip two pieces of header, one of them 9 pins, and one of them 2 pins, or a single piece that is 12 pins wide, and then remove the third pin. The latter is easier for soldering. To solder, either use masking tape to hold the pins in place, or flip it over and place a similarly sized object under the other side of the board. With the pins at 90 degrees to the board, solder them in place.

We will power the board with USB, so cover the USB pins with the jumper provided.
FAQ: What is an impee?
Any device or breakout board that is powered by an Electric Imp is called an "impee". The April impee is one of the reference designs created by Electric Imp for developer use. You can check out the other designs here:

http://devwiki.electricimp.com/doku.php?id=boards:start

These designs also include a Bill of Materials (BOM) and Gerber files, in case you want to try your hand at printing and assembling the boards yourself.

microcontrollers_max31855_breadboarded_768.jpg

We are now ready to connect the Electric Imp April board to the MAX31855 breakout board. This tutorial will use a breadboard, but you can just as easily use a solder down breadboard, or use wire jumpers to make connections without the board. 

The first thing we will wire up is power. We will be powering the April board with 5.0V from a USB power supply, and so we will have 5.0V available at the VIN pin. However, the Electric Imp itself runs at 3.3V, so we will also have 3.3V available at the 3V3 pin. The MAX31855 breakout has an onboard voltage regulator, and can be powered by either 3.3v at the 3Vo pin, or higher voltages at the Vin pin. Only connect power to one pin. For this circuit, we will use 3.3V from the April. As shown in the image, connect the 3V3 pin on the April to the 3Vo Pin on the MAX31855 breakout, then connect the GND pins on each board.

The Electric Imp has two sets of pins for SPI. Those sets are pins 1,8 & 9, and pins 2,5 & 7. For this tutorial we will be using SPI189 as it is referred to in hardware configuration. When you configure SPI189 you get the following pin configuration in the Electric Imp.

  • PIN 1 - CLK or Clock
  • PIN 8 - MOSI (Microcontroller Out/Sensor In)
  • PIN 9 - MISO (Microcontroller In/Sensor Out) or Data Out

This line of code configures SPI189 in the device:

hardware.spi189.configure(MSB_FIRST | CLOCK_IDLE_LOW , 1000);

Since we will only be reading data from the MAX31855 board (sensor), we only need to connect the MISO pin, which is pin 9, and not MOSI. We also need Pin 1 to provide a clock signal, and one more pin to act as a Chip Select (CS) pin. In order to tell the MAX31855 that we want to read SPI data, we pull the CS pin LOW, read the data, and then set the pin back to HIGH. We can configure any of the other pins as a CS pin, so we will use Pin 2, since it is directly across from the CS pin.

This code reads SPI data from the chip that is connected to Pin 2:

hardware.pin2.write(0); //pull CS LOW to start the transmission of temp data
local temp32=hardware.spi189.readblob(4);//SPI read is totally completed here
hardware.pin2.write(1); // pull CS HIGH

Note: You can read as many chips as you like from a single SPI bus, as long as you have a Chip Select Pin for each. Using just the April board, you could read up to four MAX31855 chips. This is very handy for a project with multiple thermocouples.

To complete the wiring, connect these pins as shown above.

April - MAX31855
PIN1 - CLK
PIN2 - CS
PIN9 - DO
3V3 - 3Vo
GND - GND

microcontrollers_attach_thermocouple.jpg

Now loosen the screws on the MAX31855 breakout and insert the thermocouple probe wires into the correct terminal. Hold them in place and tighten the terminal screws. 

The thermocouple leads should be color coded red and yellow, and the breakout board is labeled as such. Sometimes the leads are reversed, but don't worry, if they are we will sort that out when we test the board.

Our circuit is complete, and we are ready to write some code. Plug in your USB power and fire up the Electric Imp!

This guide was first published on Sep 11, 2013. It was last updated on Sep 11, 2013.

This page (Breadboarding the circuit) was last updated on Apr 20, 2021.

Text editor powered by tinymce.