So, now that I have a Raspberry Pi and I can read the temperature with a TC74 over USB, I thought it would be nice to combine them together.
Because the Raspberry Pi makes use of the ARM architecture, a re-compilation of temp.c is necessary.
(click for larger image)
After compiling temp.c, everything just works™ like on a normal PC… Great! 🙂
As a test, I have then installed a webserver (boa) on the Raspberry Pi and created a little webpage that displays the current temperature.
The index.html of this simple webpage looks like this:
<meta http-equiv="Refresh" content="4">
<body style="margin:0px;" background="background.png" text="#000000" bgcolor="#E0E0E0" link="#0000FF" vlink="#800080" alink="#FF0000">
<h1>Test : Raspberry Pi Debian GNU/Linux + PIC18F4550 TC74 USB</h1>
And cgi-bin/temp looks like this:
echo Content-type: text/html
When I connect with a normal web browser to the Raspberry Pi, I get a simple webpage that displays the temperature:
It should also be possible to connect a TC74 directly (via I²C) to the GPIO pins of the Raspberry Pi, mmmm,… maybe something for a next post 😉
After doing my first USB experiments, I have connected a TC74 I²C temperature sensor to the PIC18F4550.
The PIC18F4550 reads the temperature of the TC74 via I²C and makes it available through the USB port.
When connected to a PC, it is possible to read the current temperature with the program ./pc/temp.
The source is available here, or you can download a tar.gz with all the files.
Serial and Parallel ports are becoming less and less common on modern PC’s. Especially, the parallel port was very handy to control something with a PC.
Because of this, I’m now experimenting with USB and a Microchip PIC18F4550, using a 4Mhz crystal.
Problem with USB is that writing USB firmware is rather complex. Microchip has published an USB stack which is written in C. But I prefer USB firmware where (1) I can understand how it works and (2) I can create an HEX file by using my Debian GNU/Linux PC.
I’ve found very interesting firmware written in assembler, but trying to assemble it with gpasm gives a lot of errors 🙁
Lucky enough, I found this thread where Ben Dugan has ported lab2.asm to work with gpasm. After a few modifications, it worked perfectly with the PIC18F4550/4Mhz 🙂 Thanks Ben!
You can download my lab2/PIC18F4550/4Mhz/gpasm source here.
I have also modified the original lab4 found at http://pe.ece.olin.edu/ece/projects.html to work with gpasm. You can download this modified lab4 here. You can compile the pc-files of the original lab4 with “gcc -l usb“.