Welcome to Synthiam!

The easiest way to program the most powerful robots. Use technologies by leading industry experts. ARC is a free-to-use robot programming software that makes servo automation, computer vision, autonomous navigation, and artificial intelligence easy.

Get Started
Asked — Edited

Compass Compatibility With Ez Builder

Hi , I have been shopping for sensors and reading about 2d mapping using.radar.extra.and I also read on some random sites that a good electronic compass is a good addition to get your robot correct orientation if it deviated from a original path avoiding a object or if the little guy.just.just drive perfectly straight. are these compass modules useful.to.tell your.robot which.direction to.go.or slightly correct.itself? I apologize for all the random periods because I just bought a new Samsung galaxy note and IM still getting use to it. The auto correct is changing words to what it thinks I should have said I guess lol


Upgrade to ARC Pro

Synthiam ARC Pro is a cool new tool that will help unleash your creativity with programming robots in just seconds!

AI Support Bot
Related Content
Hi all, great insight on having a compass but are they accurate enough to navigate with ?

Bob is basically a metal cage full of wires which to me seems a compass nightmare. Short wires ? have it situated away from metal ? Seriously - can they help or are they more a hindrance ?
JOSH the compass you posted a photo of is serial connection, it needs transmit and received
transmit is need on most compass to calibrate it and other setups,received is to get the compass reading,a nd EZB only has a one wire rs232 serial ,i think transmit
so the olny one that will work are ones with true 12C connection
i wish DJ wound add a received command ,good for getting info on roomba sensors and serial communication to other sensors

HAZBOT wires are not the problem as metal too,problem is magnetic fields,compass picks up magnetic fields,so anything thats a magnet ,motors,servo's fans and hard drives will give a wrong reading
most data sheets on compass will tell you how much to set them apart of them,mostly 6 inches,compass are fairly accurate ,depend on the company who makes them and calibrates them

here is info from a company that makes the best one
Q. Is the Compass affected by Motors, Magnets, Ferrous objects etc?
A. Yes. Anything that affects the local magnetic field will affect the Compass module. Motors in particular contain strong magnets. The only solution is to mount the compass as far away from magnetic/ferrous objects as is practicable

here is info on compass on another post i reply too
should not need shielded cables on the compass on a robot ,i have it 6 inches away using a pic processor and normal wires,I2C buss you can run long wires thats whats good about it
can post the photo of it
should be able to run long wires on I2C buss,so 2 problems it may have one is the pull up resistors on the 2 lines or a cheap compass having a week signal
So, I finaly hooked the compass up with my EZ-b.
It seems to be working, but after 5 seconds I lose connection and ARC sort of
stops working...

Any ideas on whats happening?
might be a reset problem,from noise,did you restart it again
in a few weeks mmaybe more looking to do some testing on why the wires need to be short on only SURE compass its very strange,you get long run wire from I2C buss,can post my seeker robot design that i have a I2C compass about 2 feet away from the control board and working fine
but i am using CMPS-03,also DAVES SHINSEL SEEKER robot has it too and there where i made mine from with some changes
SO thinking the signal is very week form a china made compass or the pull up resistors and some how noises are causing a reset on EZB

also BRUDEL0 do you have a O-SCOPE,best tool for checking noise in the system
United Kingdom
Talking to brother who knows about this sort of thing the edges produced by the MCU (or EZ-B in this case) can be too fast for the I2C device so if you put a 100 ohm resistor in the 2 signal lines in series with them. This will take the edge off so to speak as it acts like a small low pass filter with the capacitance of the input stage of the I2C device.

It may not solve the problem of course and I can't try it as my compass module hasn't arrived yet. But its a known solution to intergrating I2C devices with an MCU controller
they may work too,i seen that on another forum
but it will also divide the voltage down,since there is a pull up of 10 k and in series adding 100 ohm
thats a voltage divider
the EZB uses near the same processor thats on my SEEKER robot that uses a CMPS03 that does have that problem at all and using it at 24 inches away from the board

i think on BUDEL0 case is different,seem a noise problem ,not a compass problem ,since others have it working
BUDEL0 he is a try ,remove compass and see if you are having same problem ,if you still do ,then not the compass, ,can be noise on the lins (hard to find without a scope)
or drawaing to much current from other stuff or on the digital or I2C lines
what do you have hook up and where

1. No I don't have a scope.

2. My robot works fine when I don't have the compass connected.
When I connect the compass while its connected to my pc it stops working again...

3. I have connected to my EZ-B:
- 2x 20A ESC
- 7x servo
- Synapse RF100 module
- 2x 7.2V 20C 4000mah lipo battery (soon to be 3x)
- 1x Ping sensor
- 1x ADC voltage sensor

I think I covered it all.

I will try it. I hope it works, because I'm working on something special for navigation ^^.
ok,so it is the compass.first do you have pull up resistors on each line,very important
second adding that 100ohms might help like winstn60 said
United Kingdom

Sounds interesting keep us posted hope you get the compass working ))
No succes with the 100 ohm resistors...

Any other ideas?
what pull up resestor do you have on each line,should be 10 k.it seems if you dont have any when the signal or data line with stay low.its only needed if using one if more are hook up to I2C port still only need the 2 10 k resistors,one is SCL other is CLK ,then you have GND and V+ make shore all the wire are connected correctly

sorry another edit
here is info on the resistors needed
The value of the resistors is not critical. I have seen anything from 1k8 (1800 ohms) to 47k (47000 ohms) used. 1k8, 4k7 and 10k are common values, but anything in this range should work OK. I recommend 1k8 as this gives you the best performance. If the resistors are missing, the SCL and SDA lines will always be low - nearly 0 volts - and the I2C bus will not work

WINSTN60 you sad this
The device I like is SparkFun Compass Module - HMC6352 Product Code: SEN-07915 which has I2C and all the documentation perhaps someone on here has already added it to EZB or has another opinion

a lot better choice thats used in robotics a lot is CMPS10 HIGHER ACCURACY .1 DEGREE compare to SPARKFUN compass at .5 degree
and at the same cost $34.95 from dfrobots both have I2C interface and replaced the very popular CMPS03 compass used in robotics alot ,whats added is tilt compensated

i have CMPS03 compass and one from china ,HOPE SOON to do some testing and make a I2C code for it,should work with the CMPS10 witch i am going to have on order too

JOSH that compass from SHURE electronics that DJ is using has very bad accuracy
Accuracy1 2 to 5 deg compare to .5 deg on sparkfun and .1 deg on CMPS10
ITS LITTLE MORE PRICE FOR THEM but worth the extra cost for better navigation

here is some great info on using the I2C buss i found awhile back
I2C BUSS tutorial
United Kingdom
Hi budeI0

Thats frustrating hopefully I will have the same compass module as you delivered in a few days and I do have a scope. Also worth trying pull up resistors as robotmaker states

Read this from DJ in I2C help on this site

" i2c Wire Length and Pull Up Resistors

If you modify or extend the wire on the i2c device, keep the individual wires (GND, +5, SDA, SCL) from being twisted together. You will notice i2c cables are flat, much like an older IDE Hard Drive Cable. Building your own i2c extension cable is not easy with regular wire. You can try different pull-up resistors, which decreases the sensitivity of your communication, but also removes noise. Ideally you should be using a special i2c cable.

Pull-Up resistors are connected between +5 to SDA and +5 to SCL. They are required for i2c device communication. The EZ-B has 2 pull-up resistors on board for the i2c. If a long thick wire is used (specifically if twisted), you may need to add 2 more resistors. The pull-ups range from 1k ohm to 10k ohm. You may need to expirement with a variety of resistors to find your ideal value"
i would read the IC2 page i put a link too it tell you all info on using I2C buss ,from clock pluses to how to write a code for it
another update on compass boards testing,i got a free gauss meter (magnetic field meter) from work
,since i am in the design and test lab at work where i build high precision test equipment for the tester we make
so will be able to do tests on the magnetic compasses fairly soon,as soon as i get the CMPS10 from china,can test all 3 of them,accuracy i cant check but specs tell you the accuracy
mostly only checking how far from magnetic fields it needs to be away and I2C distance problem
Hey RobotMaker,

I enjoy your well thought out posts.

Have you received your compass yet? When you do please post your i2c code here on your procedure for reading from it. I'm trying to read the I2C port of an IMU 6050 but I'm not understanding the EZ script code for that yet. The specs say it's address is 0x69 or 0x68 but with some sample code from someone reading another device would enable me to change it to this device.

I am using 4.7K pull up resisters and under 3 inch untwisted wires with the EZ-B 3.3 volts.

Here's one thing I've tried but not sure how far off I am:

I2CWrite( 0x68, 0, 1)

I2CRead( auto,11)


The output of my script is:
I2C Poll Response: False
I2C Response: 255 255 255 255 255 255 255 255 255 255 255


its on backorder,and i may not get before i leave on a 3 week vacation trip leaving in 2 weeks
Finally got my compass sort of working, well it doesn't give of it's standard direction of 45 degrees it used to give of.
It actually changes, its giving of the actual direction its facing, but it only works for a very short time. After that it sort of crashes ARC... It stays stuck in "connected" while the LED on the EZ-b is pulsating, like it's not connected.
So I think it's browning out my EZ-b... I'll try powering it from an alternative powersource.

I'm using 2k resistors. And made a board for it.
User-inserted image
Hi all, does anyone have a update to this thread? I have my sure electronics compass working, but it is less then I hoped it would be. North never seems to be quite right and west and east will sometimes switch. I'm guessing interference is the problem, but I have also read in other post that I can try either a pull up resistor to ground or +5 volts. My robot is fairly compacts so I'm hoping to find something that will be a little less sensitive to the interference and have better accuracy.
@Robotmaker did you have any luck with your test on the other 3 compass modules?
United Kingdom
Try the pull-up resistors, I've read in other topics that some sensors which were not working at all start working when pull-ups are installed.

Compass modules will be susceptible to interference so relocating it may be an idea.

@RobotMaker no longer frequents the forum. @MovieMaker and a few others are in contact with him still I believe, perhaps they could ask?
Thanks for the update Rich, I will give the resistors a shot. I've been out of the scene for over a year as well. The new V4 board and EZ-bit robots got my attention back though. My little guy is starting to get interested in robots too so that helps:)