Raspberry Pi + PIC18F4550 TC74 USB

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:

<html>
<head>
<meta http-equiv="Refresh" content="4">
</head>
<body style="margin:0px;" background="background.png" text="#000000"  bgcolor="#E0E0E0" link="#0000FF" vlink="#800080" alink="#FF0000">

<center>
<h1>Test : Raspberry Pi Debian GNU/Linux + PIC18F4550 TC74 USB</h1>
</center>
<hr>

<center>
<h2>The temperature is now <b><script type="text/javascript" src="/cgi-bin/temp"></script><noscript>No JavaScript support!</noscript></b>C.</h2>
</center>

</body>
</html>

And cgi-bin/temp looks like this:

#!/bin/bash
echo Content-type: text/html
echo
echo "document.write(\"`/home/pi/usb/temp`\");"

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 😉

3 comments for “Raspberry Pi + PIC18F4550 TC74 USB

  1. Peter
    August 26, 2013 at 9:22 pm

    Hi Jan, I’m looking for some source code examples to read/write data from/to a PIC18F4550 with connected relais. The device is a ‘USB Powered Relay Controller Board Basic Stamp BS2’. I want to control it from my RaspberryPi B. Your temp.c might be a first step in the right direction, but unfortunately I can’t find a download link …
    Regards, Peter

  2. August 26, 2013 at 9:51 pm

    Hi,

    “temp.c” is available at http://www.janwagemakers.be/PIC18F4550_TC74/pc/

  3. oscar
    January 24, 2014 at 6:42 am

    hi, good project, sorry my bad english, i want to know , what is the transfer speed between the pic and the raspberry,i need a data trasfer of 500 Kbps… thanks

Leave a Reply

Your email address will not be published. Required fields are marked *