Using Java ME 3.3 on Raspberry Pi to read the temp in my office Part #1

This will be a pretty long entry, but I'd like to get this blog post out. I think it is really cool and I am hoping that other people think so too. 

On my previous blog I have documented how I was trying to read the temperature in my office using a TMP36 sensor and a MCP3008 A/D converter with no success. But after posting my problem to the Java Embedded OTN Forum I got some really good help from a colleague and now I think I got it working properly (what's missing is that I need to bring in a regular thermometer to verify my results).

The first thing I learned was that there is a problem with the current SPI implementation on the Raspberry Pi, so I needed to move the MCP3008 CS to GPIO18 (instead of GPIO8 which is the CE in the documentation) and then control the CS manually. 

Secondly I needed to decrease the clock frequency and change the mode of the SPI interface. I am not 100% sure why I need to do this (read: I am no HW expert but I am trying to read up why I needed to do this).

So now is the system wired up like this:

  • MCP3008 VDD --> 3.3V
  • MCP3008 VREF --> 3.3V
  • MCP3008 AGND --> GND
  • MCP3008 CLK --> SCLK (GPIO11)
  • MCP3008 DOUT --> MISO (GPIO9)
  • MCP3008 DIN --> MOSI (GPIO10)
  • MCP3008 CS --> CE0 (GPIO18)
  • MCP3008 DGND --> GND

And there is no change to the TMP36 sensor:

The TMP36 sensor is very easy to wire up, with the flat side upwards:

  • Pin 1: 2.7-5.5V In -> 3.3V
  • Pin 2: Analog Voltage Out  -> CH0 on MCP3008
  • Pin 3: Ground -> GND

That's all for now folks, next post will give you the source code for this little but extremely cool project.

 <<Andy>> 

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Andy's blog about the world of embedded Java

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today