Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 of 20 How to use the Compass A. Compass. 2 Compass: - Provides heading relative to Magnetic North, not true North HMC5883L - 3.3 V input - I2C (not.

Similar presentations


Presentation on theme: "1 of 20 How to use the Compass A. Compass. 2 Compass: - Provides heading relative to Magnetic North, not true North HMC5883L - 3.3 V input - I2C (not."— Presentation transcript:

1 1 of 20 How to use the Compass A. Compass

2 2 Compass: - Provides heading relative to Magnetic North, not true North HMC5883L - 3.3 V input - I2C (not analog)

3 3 Compass: -I 2 C (i-squared-c or i-2-c) is a way of communication between the Arduino and external devices -It uses two wires, a clock line (SCL) and a data line (SDL) -There is a Host (Arduino) and a device(s) (our sensors)

4 4 Compass: -I 2 C allows more complex data to be sent/received -Bits are sent along the data line and can represent a wide range of data -Multiple sensors can be tied to the same data bus, allowing for great expansion -Analog sensors in comparison can only send a continuous voltage with a limited meaning -Analog sensors are also limited to one sensor per pin so there is no room for expansion

5 5 Compass: -When the Arduino wants to get a sensor’s information, it sends out that sensor’s address on the data line -All of the sensors look at this address and compare it to their personal address built in their hardware. If it is a match, then the sensor knows it will be used soon and the other sensors do not react, much like a queue at the DMV

6 6 Compass: - How it works…

7 7 Compass: - Let’s wire it up… - Connect 3.3V to Vcc from 3.3 V on Arduino (Cyan Wire) - Connect GND to GND rail - Do NOT remove previous wiring. We are building up steps. Shown for clarity.

8 8 Compass: - Arduino Uno has its SDA and SCL on its analog input header - Connect SDA to A4 on Arduino (Blue wire) - Connect SCL to A5 on Arduino (Green Wire)

9 9 Compass: - Final setup

10 10 Compass: - Modifying the Sketch is different because of the I2C Compass - Need to call upon some libraries (code previously written). Your Big tool box.

11 11 Compass: Load the Library HMC5883L How to work with Libraries http://arduino.cc/en/Guide/Libraries - Searching the internet for HMC5883L we find: http://www.electrodragon.com/w/index.php?title=HMC5883L_Three- Axis_Compass_Magneticfield_Module#source_demo_code

12 12 Compass: -Importing a Library. MUST have Arduino IDE 1.0.5 or higher. -Sketch -> Import Library..->Add Library -Select the HMC5883L.zip

13 13 Compass: -Library was added to the right location for the IDE to use it. Should see this at the bottom status window. -Insure everything is saved -Restart Arduino IDE. Close it and restart to reload the example files.

14 14 Compass: -Open the new Example file for the HMC5883L -Insure everything is saved -Restart Arduino IDE. Close it and restart to reload the example files.

15 15 Compass: -Open the Example file -Verify it compiles -Upload to the Arduino

16 16 Compass: - What do you see when you open the Serial Monitor?

17 17 Compass: - Why doesn’t it give us nice clean accurate data? - Point the compass East and tilt it? - Noise from the environment such as metal will distort the readings. This is one of the challenges of engineering and science problems. Understanding Error and their sources!

18 18 Compass: We now have all the sensors working individually!!

19 19 of 20 Great Job! A. Soldering B. Accelerometers C. Compass

20 v Arduino Uno PC/MacMonitor LEDs Infrared End of Core Arduino: Compass 20

21 v Arduino Uno PC/MacMonitor LEDs Infrared Robotics Track: Compass H-Bridge Shield Motors Wheels 21


Download ppt "1 of 20 How to use the Compass A. Compass. 2 Compass: - Provides heading relative to Magnetic North, not true North HMC5883L - 3.3 V input - I2C (not."

Similar presentations


Ads by Google