NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Support Forum » sporadic crazy characters in temp project

October 09, 2010
by esc
esc's Avatar

I have gone through the temperature project with my nerdkit and have been polling the serial port from my MAC every minute and recording the temp. It seems that sometimes the info that is coming across the cable is garbled up.....see below for an example. Anyone have any ideas? This actually happens frequently. I never see these types of characters on the LCD.

Thanks in advance

esc

2010-10-09 15:06:00 82.80 degrees F

2010-10-09 15:07:00 82.96 degrees F

2010-10-09 15:08:00 83.01 degrees F

2010-10-09 15:09:00 ́F

2010-10-09 15:10:00 83.01 degrees F

2010-10-09 15:11:00 83.01 degrees F

2010-10-09 15:12:00 ÿ83.01 degrees F

2010-10-09 15:13:00 83.01 degrees F

2010-10-09 15:14:00 83.01 deg••ÍF

2010-10-09 15:15:00 ý83.03 degrees F

2010-10-09 15:16:00 83.01 degrees F

2010-10-09 15:17:00 01 degr•ÍF

2010-10-09 15:18:00 83.01VÖ–••ÍF ø83.02 degrees F

October 09, 2010
by Ralphxyz
Ralphxyz's Avatar

Well first question is what are you using to do the polling?

Ralph

October 09, 2010
by esc
esc's Avatar

I have a python poll reading from the serial....see below for some snips. One thing I noticed is when I ran screen on my MAC against the serial I would see the temp being written then all of a sudden i would see these random characters thrown across. So I can see if I happen to poll when the random characters are being generated getting what I do...just don't understand why. One other thing to note is the nerdkit code is essentially what was downloadable.

from python poll

mytime = datetime.datetime.now() strime = mytime.strftime("%Y-%m-%d %H:%M:%S")

s = serial.Serial("/dev/cu.PL2303-0000201A", 115200) f = open('/Users/escooley/project/egg/tempworkfile', 'a')

temp = s.readline()

f.write(strime) f.write(" , ") f.write(temp) f.write("n") f.close()

#from Makefile

GCCFLAGS=-g -Os -Wall -mmcu=atmega168 LINKFLAGS=-Wl,-u,vfprintf -lprintf_flt -Wl,-u,vfscanf -lscanf_flt -lm AVRDUDEFLAGS=-c avr109 -p m168 -b 115200 -P /dev/cu.PL2303-0000201A LINKOBJECTS=../libnerdkits/delay.o ../libnerdkits/lcd.o ../libnerdkits/uart.o

write portion uploaded to nerdkit

// write message to LCD lcd_home(); lcd_write_string(PSTR("ADC: ")); lcd_write_int16(last_sample); lcd_write_string(PSTR(" of 1024 ")); lcd_line_two(); fprintf_P(&lcd_stream, PSTR("Temperature: %.2f"), temp_avg); lcd_write_data(0xdf); lcd_write_string(PSTR("F "));

// write message to serial port
printf_P(PSTR("%.2f degrees F\r\n"), temp_avg);

Post a Reply

Please log in to post a reply.

Did you know that 20 LEDs can be controlled from 11 microcontroller pins, to make a twinkling heart outline? Learn more...