Help! Need Suicide Prevention Programming BRAT

Yesterday my BRAT committed suicide while my grandson was trying to show off his work to his parents. :cry:

How, you may ask,could this happen? And why am I writing here instead of in the BRAT forum?

Since my grandson and I built it, I had been experimenting with some programming - most recently sound from the BB 2. Since sound commands cause no movement, I had forgotten that programs which include movement commands cause violent movement while they are being downloaded to the BAP 28. :blush: Comes time for the family demonstration: We need a program with movement. So I load abrat1.bas into Basic Micro Studio, hook everything up, power up the BRAT, and press the program button in Studio.

[size=150]Instantly the BRAT lurched into motion and COMMITTED SUICIDE by diving off the work table to the hardwood floor below![/size]

It was decapitated when the sensor panning mount broke off, disembowelled when the electronics board broke free, and had a myocardial infarction when the power switch broke internally! :cry: :cry: :cry:

[size=150]How can motion while programming be prevented?[/size]

I can see that it could be prevented by separating the logic voltage from the servo voltage. But the small weight saving obtained by removing the VL/VS jumper would be lost to the additional battery and switch required. The BRAT is already getting too heavy for the HS-422s. [size=85][Note to self: Buy the upgrade servos next time - Stupid][/size]

Is there a programming way to solve the problem? Is there perhaps a code fragment that could be added to the front of programms which would supress all movement until programming is complete and the power has been cycled off and on again?

The only good news out of this misadventure is that my grandson was less mortified in front of his family than I was.

Thanks to anyone who can help. In lieu of flowers, please send servos and SES parts to my home address. :stuck_out_tongue:

Ted

You could try using an unused I/O line to switch power going to the servos. As long as the line is low, the switch is off, and the servos are unpowered. Bring the line high, a switch is closed (small relay, or FET type would probably work fine), and juice flows to the bus feeding the servos. Only pull that control line high in programs that require servo motion, and at all other times they will be dead and lifeless.

Just a quick thought on the subject…

If you are using the same battery for both electronics and servos you don’t necessarily need an extra battery, only add an extra power-switch for the VS. A single switch shouldn’t be a trouble when it comes to total weight…

The switch idea for powering the servos is good, bu take it a littler further. program a “heartbeat” on the processor, that sends a pulse every 1 second to a R/C (resistor/capacitor) circuit that keeps the power applied as long as it receives a pulse to keep the cap charged, an the switch turned on. A “FAIL SAVE” circuit. Adjust the pulse rate as desired.

Alan KM6VV

Thank you to Seamus, Zenta, and KM6VV for your responses. There is much food for thought here, and I wish I understood it all. :open_mouth:

Seamus and Alan, I fear you may have missed what the reference to my grandson necessarily states about me: I am ancient. :frowning: My understanding of modern electronic circuitry and control programming lags way behind what you were kindly trying to tell me. I think I understand your concepts, but I am unable to translate concept to application. :blush: In fact, I am still having a terrible time trying to jam all these vacuum tubes and tuning capacitors onto my BRAT. :laughing: Still, your ideas intrigue me, and I expect I will keep referring back to them as I learn more.

Kare, you win the prize for suggesting a solution so elegantly simple that I can understand it immediately! :smiley: I am in the process of installing two power switches to supply separate logic and servo voltages from the same battery. (I am also using this opportunity to make some configuration changes to BRAT’s structure, so I am progressing slowly.) But, Zenta, I fear you too give me too much credit: You forgot to warn me to remove the VS-VL jumper. :stuck_out_tongue:

[size=150]Since I have heard nothing from the purely coding side, am I right that there are no lines of code that can be inserted in the programs to solve the original problem?[/size]

Thank you all again, Ted

Hi,

There are lots of options available to you, which include:
a) build a simple stand for the brat. I have used 1/2" PVC pipe with elbows and Ts and then use wire or string to hang the brat up while testing the program. This is good for testing out the walking movements or the like without having to worry about it actually moving.

b) switch like Zenta mentioned.

c) If your brat is controlled by PS2, have the code in the brat not do anything until the start button (or any other button of your choice) is pressed.

d) If your brat has no external controller, use one of the Atom Bot Board 2 Buttons (IO Pins 12, 13, 14) as a start button. That is have a loop at the start of the program that waits until you press one of these buttons, before doing anything. For this to work, you need to make sure the appropriate jumpers are in place on the BB2.

e) If your brat has external sensors, like a sharp sensor, you could experiment with you have to move your hand in front of a sensor in some defined way, like the distance has to start off > X1 and then distance has to be < X2 and then > X3 before the robot starts.

…

Hope that gives you some ideas.

Kurt

Thank you, Kurt,

These are lots of good ideas. Although I won’t need all of them at the same time, I will experiment with each of them as I expand my toolbox of programming tricks and options. I do have some sensors, and I will be switching back and forth between autonomous and PS-2 control on various projects.

Great, thanks again, Ted

:laughing:
I didn’t see the point of warning you about the VS-VL jumper since you already mentioned it in your first post…