As an educational experiment, I decided to build a small temperature sensor.
Since I have little experience with direct Analog to Digital (A->D) converters, I decided to start out with a little more “meaty” hardware.
I used a Basic Stamp II (BOE) BS2-IC microcontroller to capture temperature using a Sensirion Temperature and Humidity Sensor, and display using a 2×16 Serial Display.
But back up for a second…
What is a PIC?
In my book, PIC stands for “Programmable Interrupt Controller”. The latest line extends from a long history, more of which one can read about on Wikipedia.
Essentially it is a small computer, a class which is arguably defined class of “embedded” computers. These are the unseen workhorses of modern living; found in cell phones, GPS devices, even microwaves!
A microcontroller is a smaller, less computationally powerful version of conventional personal computer, but expressed on a very economical hardware. It also requires substantially less electrical power.
This is advantageous because it can do (simple) routine tasks. Many routine tasks require some intelligence in sampling, but applications are limited in space, power, or cost.
A microcontroller leverages similar abstractions from direct hardware to its larger counterparts, while utilizing processing power without the high power needs.
So PICs are cool, but how does one get into these things without a degree in electrical engineering? Parallax has an interesting Board of Education Basic Stamp II, which is designed as a teaching aid to students.
I’m just a grown up student, so I picked one up at Radio Shack, but they can be had online as well.
Parts List:
- Board Of Education (serial) – Full Kit ~($100 USD) from Radio Shack
- Power Supply for the BoE board (I think I had one in the Scary Wire box)
- Parallax 2×16 Serial LCD (backlit) ~(30 USD) from Parallax
- Sensirion Temperature and Humidity Sensor ~(30 USD) from Parallax
- Jon Williams Stub Code, and a few schematics (used to live here: http://nutsvolts.com/~downloads/SHT1x.BS2)
- 1 Mocha for the morning
- 1 Pizza for the evening
- misc other small items, batteries, wires.. etc
Procedures:
I started by plugging in the LCD panel to the board, and then writing some simple scripts to understand how to push words to the display.
This turned out to be easier than I previously thought. The PBASIC has built in language functions, such as [function], which allow for direct printing of strings to the display. No Scary Pixel Math (Someone else worked hard on that for me!). Parallax has written an entire application which translates into the characters to be displayed, and I’m all to happy to leverage it.
For example.. Here is an example of printing Hello World on the LCD display:
SEROUT TxPin, Baud19200, ["Hello World"]
Which looks strikingly similar to how its shoved onto the Serial Out line:
DEBUG "Hello World", CR
So essentially the screen acts as a serial device to its internal driver. Simple. Cool.
Then I looked at the spec sheet for the temp sensor, and for the cousin chip, the SHT11.
For this, I found a link to some code, which once upon a time lived here: [http://nutsvolts.com/~downloads/SHT1x.BS2] on the Parallax site which demonstrated the sensor.
At first, I uploaded this bit of code to the sensor to see if it worked. Surprisingly, it did! It output the temp to the BS’s serial port. I then isolated the portion of code which outputs the information and copied it to the LCD screen.
I simply wrapped this up into a text file, uploaded it to the PIC’s code cache again, and away it goes! It now spews data to both the LCD display and the serial port!
Here is my code: [link to code]
Happy Stamping!


