Monochron Temperature Sensor

For RTC breakouts, etc., use the Other Products from Adafruit forum

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
edc1591
 
Posts: 40
Joined: Sat Jul 14, 2012 11:12 am

Monochron Temperature Sensor

Post by edc1591 »

I'm thinking of adding a temperature sensor to my Monochron clock. I was thinking of using the DHT22. Would this be possible? Where would I connect the sensor, and would I need any other components? Also, would I be able to adapt the Arduino code that is provided for the DHTxx sensors to work on the monochron clock?

Thanks for any help

User avatar
adafruit_support_bill
 
Posts: 88087
Joined: Sat Feb 07, 2009 10:11 am

Re: Monochron Temperature Sensor

Post by adafruit_support_bill »

There is a good-sized prototyping area to the right of the processor. You should have plenty of room for DHT22.
Also, would I be able to adapt the Arduino code that is provided for the DHTxx sensors to work on the monochron clock?
Some customers have adapted the Monochron project so that it can be programmed like an Arduino:
http://forums.adafruit.com/viewtopic.ph ... 3&p=113194

edc1591
 
Posts: 40
Joined: Sat Jul 14, 2012 11:12 am

Re: Monochron Temperature Sensor

Post by edc1591 »

Great! Thanks.

I'm sure I'll be able to figure out the programming on my own, however, I'm pretty new to the circuit part. Where exactly would I connect the sensor to the PCB?

User avatar
adafruit_support_bill
 
Posts: 88087
Joined: Sat Feb 07, 2009 10:11 am

Re: Monochron Temperature Sensor

Post by adafruit_support_bill »

Anywhere on the prototyping area is fine (that grid of unconnected holes to the right of the processor). You will need to choose an unused pin on the processor to talk to the sensor, and run jumpers for power and ground as well. Note that all of the processor pins have breakout holes next to them for easy soldering of jumpers.
Image
I recommend that you read through the entire tutorial - with special focus on the design documents to familiarize yourself with which pins are used for what.

edc1591
 
Posts: 40
Joined: Sat Jul 14, 2012 11:12 am

Re: Monochron Temperature Sensor

Post by edc1591 »

OK, thanks. Do you think I would be better of using the AM2302 and keeping it outside of the casing to get a more accurate temperature reading, or would the DHT22 be sufficient?

User avatar
adafruit_support_bill
 
Posts: 88087
Joined: Sat Feb 07, 2009 10:11 am

Re: Monochron Temperature Sensor

Post by adafruit_support_bill »

There will be some heat buildup inside the case. An outside mounted sensor will give you a more accurate reading.

edc1591
 
Posts: 40
Joined: Sat Jul 14, 2012 11:12 am

Re: Monochron Temperature Sensor

Post by edc1591 »

I'm having some trouble getting a reading from the sensor. I'm using the AM2302. I'm using pin 24 to talk to the sensor, pin 8 for ground and pin 7 for power. I just get a temperature reading of 0 degrees from the sensor. I had it connected to my Arduino and it was working, so it's not the sensor.

Here are some pictures of the setup:

http://f.cl.ly/items/2w2C2v343N1U0b3t2m3l/IMG_0254.jpg

http://f.cl.ly/items/2w2C2v343N1U0b3t2m3l/IMG_0255.jpg

User avatar
adafruit_support_bill
 
Posts: 88087
Joined: Sat Feb 07, 2009 10:11 am

Re: Monochron Temperature Sensor

Post by adafruit_support_bill »

I had it connected to my Arduino and it was working,
Are you able to talk to it using the same code you used on the Arduino?

edc1591
 
Posts: 40
Joined: Sat Jul 14, 2012 11:12 am

Re: Monochron Temperature Sensor

Post by edc1591 »

Yeah, the code is the same. Just had to change the pin number to 24.

User avatar
adafruit_support_bill
 
Posts: 88087
Joined: Sat Feb 07, 2009 10:11 am

Re: Monochron Temperature Sensor

Post by adafruit_support_bill »

Ah. You are confusing the chip pin numbering with the Arduino pin numbering. Below is the pin mapping. Pin 24 is analog pin A1. This can also be addressed as digital pin 15.

Image

edc1591
 
Posts: 40
Joined: Sat Jul 14, 2012 11:12 am

Re: Monochron Temperature Sensor

Post by edc1591 »

OK, one step closer. Before the temperature and humidity were flashing on the screen, and humidity was switching between 0 and NaN. Now, they aren't flashing anymore and the humidity is staying at 0, and temperature is also staying at 0 (obviously it's not 0% humidity and 0 degrees in here).

Here's the code that I'm using. I'm programming the clock using the Arduino IDE as described in the thread you posted earlier.

Code: Select all

#include <DHT.h>
#include <Time.h>  
#include <Wire.h>  
#include <DS1307RTC.h>
#include <glcd.h>
#include <fonts/allFonts.h>

#define DISPLAY_HEIGHT 64
#define DISPLAY_WIDTH 128
#define TimeY 0
#define DateY TimeY+30
#define DHTPIN 15
#define DHTTYPE DHT22

DHT dht(DHTPIN, DHTTYPE);

void setup()  {
  Serial.begin(9600);
  setSyncProvider(RTC.get);   // the function to get the time from the RTC  
  analogWrite(3, 75); //enable the backlight 0-255
  GLCD.Init(); 
  dht.begin();
}

void loop()
{
   drawText();  
   delay(1000);
}

void drawText(){
  // digital clock display of the time
  GLCD.SelectFont(CalBlk36);
  int minInt = minute();
  String minString;
  if(minInt < 10) {
    minString = String("0"+String(minInt));
  } else {
    minString = String(minInt);
  }
  String timeString = String(String(hourFormat12())+":"+minString);
  char timeChar[timeString.length()+1];
  timeString.toCharArray(timeChar,(timeString.length())+1);
  int x = (DISPLAY_WIDTH - GLCD.StringWidth(timeChar)) / 2;
  GLCD.GotoXY(x, TimeY);
  GLCD.print(timeString);
  
  //date
  GLCD.SelectFont(SystemFont5x7);
  String dateString = String(String(month())+"/"+String(day())+"/")+String(year());
  char dateChar[dateString.length()+1];
  dateString.toCharArray(dateChar,(dateString.length())+1);
  x = (DISPLAY_WIDTH - GLCD.StringWidth(dateChar)) - 2;
  GLCD.GotoXY(x, DateY);
  GLCD.print(dateString);
  
  GLCD.SelectFont(Arial_bold_14);
  float h = dht.readHumidity();
  float t = dht.readTemperature();
  Serial.print(t);
  char buffer[10];
  String temp = dtostrf(t, 5, 2, buffer);
  String humid = dtostrf(h, 5, 2, buffer);
  String tempString = String(humid+"% "+temp+"*");
  char tempChar[tempString.length()+1];
  tempString.toCharArray(tempChar,(tempString.length())+1);
  x = (DISPLAY_WIDTH - GLCD.StringWidth(tempChar)) - 2;
  int y = DISPLAY_HEIGHT - 14;
  GLCD.GotoXY(0, y);
  GLCD.print(tempString);
}

User avatar
adafruit_support_bill
 
Posts: 88087
Joined: Sat Feb 07, 2009 10:11 am

Re: Monochron Temperature Sensor

Post by adafruit_support_bill »

Not sure what to suggest. If you have access to a scope, you could confirm whether or not the processor is initiating the read cycle on the sensor on the right pin. (High for 250ms, low for 20ms then high again for 40ms)

edc1591
 
Posts: 40
Joined: Sat Jul 14, 2012 11:12 am

Re: Monochron Temperature Sensor

Post by edc1591 »

I don't have an oscilloscope, unfortunately. Is there anything I can do with just my multimeter to test it?

User avatar
adafruit_support_bill
 
Posts: 88087
Joined: Sat Feb 07, 2009 10:11 am

Re: Monochron Temperature Sensor

Post by adafruit_support_bill »

I don't think you could get much useful info from a multimeter. You could make a primitive 'logic probe' from an led and a 1K resistor. Solder the resistor to the anode (long leg) of the led.

Touch the cathode (short leg) to ground. Test the probe by touching the other end to +5v - it should light. Now probe pin 24. You should see a periodic flickering as the controller tries to read the sensor.

edc1591
 
Posts: 40
Joined: Sat Jul 14, 2012 11:12 am

Re: Monochron Temperature Sensor

Post by edc1591 »

Yeah, it does flicker. Does that mean the sensor is actually reporting 0? Is there any way to connect the sensor to my Arduino to test it without having to remove it from the Monochron PCB? Could I just use a jumper to connect the yellow wire to a pin on the Arduino?

Locked
Please be positive and constructive with your questions and comments.

Return to “Clock Kits (discontinued)”