BS2 random resets
ryborg
Posts: 2
Hello everyone,
I have been trying to use my BS2 to monitor a washing machine, and let me know via serial I/O when the wash cycle has completed. The circuit is very simple, and consists only of two open or closed states (Power On, and Timer Pulled) read on IN7 and IN5. (much like the whisker code from the boebot)
I can post the code if needed, but first here's a summary of how it works.
If the timer knob on the washing machine is pulled out, the program starts "listening". The power line, which I am monitoring via a closed or open relay, turns on and off a couple of times throughout the process of washing. A variable stores whether power has been detected on the washing machine, and then begins waiting for the power to go off for about 6 minutes before considering the wash done and then finally sending a serial message.
When the basic stamp unexpectedly resets during this process it loses track of whether or not it had seen the power on the washing machine before.
I have my serial cable connected to pins 1,2, and 4 on the stamp, but I do not use pin3 (ATN), as I read that shouldn't be used and can cause resets.
I have also checked my power source, and I believe it is okay as it is plugged in. However, just to exhaust all options I will be trying with a battery soon.
Can anyone offer some advice to a newbie wanting very much to master these great chips?
Thanks,
- Ryan
I have been trying to use my BS2 to monitor a washing machine, and let me know via serial I/O when the wash cycle has completed. The circuit is very simple, and consists only of two open or closed states (Power On, and Timer Pulled) read on IN7 and IN5. (much like the whisker code from the boebot)
I can post the code if needed, but first here's a summary of how it works.
If the timer knob on the washing machine is pulled out, the program starts "listening". The power line, which I am monitoring via a closed or open relay, turns on and off a couple of times throughout the process of washing. A variable stores whether power has been detected on the washing machine, and then begins waiting for the power to go off for about 6 minutes before considering the wash done and then finally sending a serial message.
When the basic stamp unexpectedly resets during this process it loses track of whether or not it had seen the power on the washing machine before.
I have my serial cable connected to pins 1,2, and 4 on the stamp, but I do not use pin3 (ATN), as I read that shouldn't be used and can cause resets.
I have also checked my power source, and I believe it is okay as it is plugged in. However, just to exhaust all options I will be trying with a battery soon.
Can anyone offer some advice to a newbie wanting very much to master these great chips?
Thanks,
- Ryan
Comments
Are you using a board setup that you made? If possible, you might want to try the setup on a known good board (BOE, HW Board, or PDB)
Please post you schematic, however.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Running while connected to a PC, with debug active, can determine with certainty whether it's resetting (put a DEBUG in as the first statement in the program).
I'm not doubting your word about the resets, but in problem-solving I always question every assumption.
If it is resetting, you have two options: (1) fix the reset problem so it doesn't reset, or (2) program around the resetting problem so it does what you want even if it resets. I would try to do both.
(1) is best addressed with good test equipment, to examine all the things that can cause resets.
(2) is more fun. You can, for example, store your counts in nonvolatile storage such as the EEPROM, so they will survive a reset. Use READ and WRITE for this. Clear these counts only after a long time with no changes at the inputs (indicating the washer is not in use), or on command from a pushbutton on some currently unused input.
There are many ways to skin a washing mach -- er, skin a cat.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
· -- Carl, nn5i
·
A quick way to determine if the BS2 is resetting is to place a DEBUG statement before the command(s) that you think it's resetting at; if the BS2 is resetting you will see the DEBUG statement each time around. Once you have determined if it is resetting you can tackle how to fix it. If you post your code, I will try to suggest here to place a DEBUG statement to be most effective in troubleshooting the issue, but here is a small example of what I'm referring to.
·
Code Example:
·
DEBUG “ Basic Stamp Test Message ”
·
DO
· MAIN PROGRAM
LOOP
·
In this example, the debug will display Basic Stamp Test Message” and then run a DO…LOOP continuously. This way, the DEBUG message should only display once, but would display each time the BS2 is reset.
·
·
I hope this helps,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Joshua Donelson
www.parallax.com
I had·a similar problem years ago with an industrial blower/vacuum system where I left a long (25ft) programming cable connected to the BS2. The long cable acts like an antenna and can pick up enough of a signal from the large equipment to cause a reset. My solution was relatively simple and it did not affect the BS2's ability to be re-programmed when necessary. I placed a 1K resistor between VSS and the ATN pins directly on the BS2.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
In theory, this was a pretty simple setup. Hook up two sensors (switches), read their states, and send back a message via serial.
In practice though, there were far more things to potentially go wrong -- I think I stumbled on to every one of them
I had already put some debug code and a blinking led loop before everything else in my code so I was sure that this was a reset problem.
I wasn't sure why it was resetting though. I put a 1000uF cap accross Vss and Vin as Kye suggested, and that at least made me confident that power surges could no longer be the cause of my resetting. What I finally discovered though, was that the resets were cause by a poor connection on my serial line.
I'm running the serial over twisted pair Cat6 via existing wiring in my house and I ended up putting a TPE wall jack on the back of my washing machine. It was my connection betwen the wall jack and the serial cable that was really poor. The slightest virbration must have been causing it to reset. Most of you probably know that those TPE wall jacks are just a push down mechanism to wire up, but I ended up using solder on that as well -- not as it was designed, but it works well.
Anyway, so far all is working well with it. I'll keep my fingers crossed, because troubleshooting this stuff really tests my limits of electronic knowledge [noparse]:)[/noparse]
Thank you all for the suggestions.