Ultrasonic sensor placement to calculate location

Hi everyone!

For a school project we need to make a robot than can draw a drawing in a square box (2,44 m by 2,44 m). It needs to do so by driving automatically to given coordinates while holding down a pencil. What we are struggling with the most at the moment is the placement for the ultrasonic sensors. We use these sensor so the robot can calculate it’s own position in the box. At the moment the sensors are located at the front and 1 on each side (and the pencil at the back) but we are still finding it pretty difficult to write code so the robot can locate itself. We’ve seen other groups placing 3 sensors at the front: 1 looking straight ahead and 1 on each side at an angle of 45 degrees, but I don’t see the benefit of that (probably because we are pretty damn frustrated with this project). We are using 1 Atmega328p to process the sensor data and to control the SN754410E (a double H bridge) which is used to power and move the tracks. We’ve also got a Sparksfun 9DoF stick but the initial drift changes while driving so I don’t see a way we can use that…

We’ve been struggling with this for a long time and the project needs to be done in 2 weeks… Do you guys have any suggestions on placing the sensors so we can calculate the position and the angle the robot is looking at more easily?
Thanks in advance.

Using ultrasonic sensors alone does not really give you orientation, unless you constantly calculate where the robot is with respect to the origin. What would help is a magnetic compass (assuming the paper is flat).
Take a look at the sample code used in the Parallax Scribbler and perhaps adapt it:
robotshop.com/en/parallax-s … robot.html
parallax.com/product/28333
Note that for the most part, you only need encoders for relative motion. External sensors can certainly help, but are often not used.
Using tracks might cause issues - most drawing robots are 2WD with casters for more precise motion.
How far have you gotten so far?

Well for starters I’ve got the Sparkfun 9dof stick to work, so we now know the relative heading of the robot using the gyroscope. Encoders would certainly help but it’s a school project and can’t really ask for encoders because I don’t think they have any. It’s more or less the same for the chassis, they gave us one with tracks so that’s what we have to use. Anyway, we’ve got the heading in respect to the origin now but we are still deciding how we would place the 3 sensors. The default placement we had in mind was: 1 on the front and 1 on each side. Or we could place 3 on the front, 1 straight ahead and 2 on a 45 degree angle… We really need to make a decision tho, cause the robot needs to be done in about a week.

Both sensor configurations are valid, and it will come down to programming. Might come down to finding existing code which you can use.