tilt sensor
Wednesday, July 28, 2010 at 12:43PM I've began adding the Hitec Robonova Tilt Sensor. Installing the sensor itself is very easy and the directions are very clear. In addition the robonbasic templates already have a subroutine added for the sensor. In theory all you would have to do is uncomment the call for the tilt sensor which is found just below the call for the voltage routine call. The reason I say "in theory" is because I found that the template code doesn't work with my sensor! When I first downloaded the script to the controller the robot stayed in a loop of the backward_standup move. This is the code that came as an example with the included tilt sensor directions and is identical to the code which is found in the robobasic template:
robot_tilt:
A = AD(0)
IF A > 250 THEN RETURN
IF A < 30 THEN GOTO tilt_low
IF A > 200 THEN GOTO tilt_high
RETURN
tilt_low:
A = AD(0)
‘IF A < 30 THEN GOTO forward_standup
IF A < 30 THEN GOTO backward_standup
RETURN
tilt_high:
A = AD(0)
‘IF A > 200 THEN GOTO backward_standup
IF A > 200 THEN GOTO forward_standup
RETURN
In my case, I'm using AD port 1 instead of zero, but you can use any of the AD ports you wish.
After some fiddling around with the code I found out that the sensor was working but that it appears to have MUCH higher sensitivity. For instance, I had to change the line of IF A > 200 THEN GOTO tilt_high to read IF A > 50 THEN GOTO tilt_high which seems to work fine. However, finding the tilt_low setting is harder. It's a lot of just trial and error. It's also important to note that this line is in the code twice. If you are tweaking this you have to tweak it in both places.
Finally after much struggling I have come to the conclusion that the sensor is bad. After looking at some posts on the RoboSavvy forum it seems that there have been other people that have has sensors go bad by storing them in a hot car. Since this was shipped to me in July and took a week to get here from the UK I can see this is probably the case with this.
I have notified Robosavvy and waiting to hear back from them. In the mean time I've also ordered an Hitec accelerometer which is a newer product and seems to be better.
To be continued........
One last thought, after all the trial and error with the robot i've decided to order a Hitec Robot Stand. Not only will it be much easier to code and not hold the robot, it will also be a LOT easier on my fingers. The servos and brackets are really hard on your fingers for the forward_standup move when your trying to hold on to the robot.

Robb |
Post a Comment |
accelemometer,
robot stand,
robot_tilt,
sensors,
tilt in
sensors 

