davidbuckley.net
home  >  Hextor  >  8 April 2024

Hextor - Sonar Upgrade
2015 - 2023
  • PicAxe 14m2 program USarrayTL.bas
  • PicAxe 14m2 program USarrayTR.bas
    See the Manual Upgrades-page for the full set of commands

    The original Polaroid Ultrasonic sensor worked very well but using a servo to point it in different directions slowed things down a lot as the servo moved from one position to another. The Polaroid Sonar circuit was based on an existing Milford kit and back in 2001 the sensor was too expensive to use more than one on Hextor.

    I had used less expensive sensors from Devantech and Parallax on other robots then started to use the very cheap HC-SR04 on Bambinos and Aesir. They didn't have the long range of the Polaroid sensor but for obstacle avoidance that wasn't necessary. There was some talk on the Seattle Robotics Society's forum that the HC-SR04 was useless and you couldn't use more then one and I knew that was nonsense so I decided to make a sonar array for Hextor, using the HC-SR04.
    I wanted each sonar module to have an LED which would glow brighter as an object came into range and decided that a PicAxe 14m2 with its four PWM pins could drive three LEDs and three sonars and could receive the BS2sx commands into its two byte hardware serial buffer, hence two could be used for the six sensors. The array was going to be a plug in replacement for the Polaroid circuit and use the same comunication protocol from Hextor's BS2sx, however I had to modify the Ultrasonic Sensor program (BS2sx program page 2) because although the servo could point the sensor straight ahead the array had no straight ahead sensor. The Polaroid circuit received "T"<direction> where <direction> was a single byte, the new array receives "Tx" where x is "1" - "6" with the sonars numbered "1" to "6" from right to left. I introduced an AND rule into the BS2sx program so a rule only fires if 'this sensor AND 'that sensor' see something.
    The two 14m2 are connected to each other by 'ready' and'busy' lines so only one sensor is active at a time and the sonar signals don't interfere with each other. The sensors can be driven in a Round Robin fashion where one 14m2 pings its three sensors in turn then the other 14m2 does the same. In that mode I can always see by the LEDs what Hextor could see. The array, by a jumper option, can also wait until it receives a command before activating the relevant sensor but I prefer the Round Robin mode.
    Each 14m2 listens to the same BS2sx port and transmits its result to the BS2sx same port and the 14m2 serial outputs are diode ORed so they don't fight.
    Each sensor is mounted on a swivel so its direction can be changed and is held by thick copper wire so its vertical direction can be altered.