View Full Version : bs2 "hangs up"

11-12-2009, 04:36 AM
I have a project which utilizes the melexis 90614 infrared thermometer, the ds1620 thermometer·chip and a CdS photocell.· A 433 MHz transmitter allows wireless capability. data is collected to Plx-daq

All components are wired as recommended by parallax literature (with any caps and resistors as specified).
Currently, I am using a benchtop regulated power supply (inside) with about 10 feet of wire to supply the equipment (which is outside) at 9 volts, 500mamps. All components are connect to a bs2 carrier (not super carrier) board.

Everything works great for about 48 to 72 hours, than the system "hangs up" and I have to reset by either
cutting and restarting power (if running wireless) or disconnecting and reconnecting Plx-daq (if the serial cable is connected).·

I thought initially it was a problem related to having the serial cable connected, however, the same thing happens with the cable disconnected with the data being sent via wireless transmitter.

Also, I initially had a tsl230 chip to evaluate ambient light.· I had more frequent episodes and initially thought it was related either the tsl230 chip or the CNT command... I have removed this from the system and still have issues.

So, my questions are as follows:

What am I doing wrong? would a super carrier board help?

Is there a way to automatically or periodically reset the system to avoid a persistent hang up?
Can I use another BS2 to monitor and reset the system if needed ?
I would like to use this remotely and relatively unattended, so I would like some way of having the system restart or be restarted should it hang up.

Thanks for any suggestions


11-12-2009, 04:47 AM
I've had some systems running continuously for nearly 10 years so I'd suspect either a power supply problem or a programming problem. First, is the voltage at the stamp holding at 5 volts after a long period of operation?

Programming wise, if you use a SERIN and the data never arrives, the program will wait forever. Or, if you are waiting for a specific set of characters and they never arrive, the system will appear to hang.

If your serial connection isn't configured with the capacitors, as in later versions, the PC serial port can hold the Stamp in reset under certain conditions.

Can you show us your code?

Tom Sisk


11-12-2009, 11:29 AM

Thanks for your input.· I am assuming the voltage at the stamp has held at 5 volts, but I don't really have a way to monitor it continuously.· I could switch power supplies and see·what happens.·

I've attached the code as well.


Mike Green
11-12-2009, 11:39 AM
There's nothing at first glance at your program that would cause it to reset periodically (like GOSUBs without RETURNs or RETURNs without GOSUBs). You probably have an intermittent power supply problem. One way to protect against that is to use a large electrolytic capacitor (1000uF 16V) across the supply wires at the Stamp board and a diode (like 1N4001) in series with the power supply (+) lead near the Stamp board. The power supply continually charges the capacitor. If there's a "glitch" in the supply voltage, the diode prevents the capacitor from discharging through the power supply and it'll power the Stamp and peripherals for a fraction of a second, probably long enough to keep things functioning.

11-12-2009, 09:56 PM
Its a long shot, but in your "getTemperature" routine, put in a timeout value in the SERIN command (see the Help file ) so if nothing comes from the temp chip
the program will eventually timeout and you can recover.

What I'm thinking is that for some reason the temp chip either doesn't respond at all or only partially responds which will leave the Stamp waiting indefinitely.

getTemperature: 'SECOND SUBROUTINE: IR temperature sensor
SEROUT Sensor,baud,[0,"!TEMR",xslave,$07]
SERIN Sensor,baud,[tempL,tempH]

GOTO convertTemperatures


Tom Sisk


11-14-2009, 02:03 AM
Thanks for your advice.

I have added a diode and a cap as suggested

I have modified the serin command as suggested.

We'll see what happens!

Thanks again


11-30-2009, 11:08 PM
Thanks for everyones help.

Everything works great. No problems for two weeks.·