PDA

View Full Version : Orientation Demo using H48C and HM55B



Travis_
01-10-2009, 07:00 AM
I'm a newbie to the microcontroller world and have struggled to get my PropStick USB communicating with the H48C Accelerometer and the HM55B Compass. I tried everything I could find on this forum to get it working and ended up using a little bit of everything I could find. Because this was my first project, I made sure to make it as comprehensive as possible. If you are new to the PropStick and are trying to establish communication with either the H48C or the HM55B, this code should help you.

I uploaded my work as 'Orientation Demo using H48C and HM55B' in OBEX (obex.parallax.com/objects/399/ (http://obex.parallax.com/objects/399/)). I commented the code thoroughly including PIN diagrams, links to relevant documentation and links to the required software. I included a photo of the breadboard with the circuit and a photo of the Parallax Serial Terminal output.

I also attached the ZIP file with the code and the two photos to this posting.

Hopefully this saves you some time trying to get these sensors working. Enjoy!

Objects used:


H48C : "Sensor.H48C.Accelerometer" 'custom SPIN file located in source folder
HM55B : "Sensor.HM55B.Compass" 'custom SPIN file located in source folder
Debug : "FullDuplexSerial" 'standard from propeller library


Components needed:

Breadboard w/ connector wire set
5-9V power supply (9v battery or 4 AA batteries)
PropStick USB
H48C Accelerometer
HM55B Compass
3 LEDs
1 270 Ohm resistor
1 - LM2940 5 volt regulator
1 - 1000uf capacitor


Software/Downloads needed:

Propeller Tool Software (used to program the Prop): www.parallax.com/Portals/0/Downloads/sw/propeller/Setup-Propeller-Tool-v1.2.5.exe (http://www.parallax.com/Portals/0/Downloads/sw/propeller/Setup-Propeller-Tool-v1.2.5.exe)
FTDI USB VCP Drivers (for WinXP): www.parallax.com/Portals/0/Downloads/sw/R9052151.zip (http://www.parallax.com/Portals/0/Downloads/sw/R9052151.zip)
Parallax Serial Terminal: www.parallax.com/Portals/0/Downloads/sw/propeller/PST.exe.zip (http://www.parallax.com/Portals/0/Downloads/sw/propeller/PST.exe.zip)


Relevant Documentation:

PE-Lab-Setup-for-PropStick USB v1.0.pdf (Simple LED Code and 5 volt power supply) - www.parallax.com/Portals/0/Downloads/docs/prod/prop/PE-Lab-Setup-PropStick-USB-v1.0.zip (http://www.parallax.com/Portals/0/Downloads/docs/prod/prop/PE-Lab-Setup-PropStick-USB-v1.0.zip)
32210-PropStickUSB-v1.1.pdf (Schematic of PropStick USB) - www.parallax.com/Portals/0/Downloads/docs/prod/prop/32210-PropStickUSB-v1.1.pdf (http://www.parallax.com/Portals/0/Downloads/docs/prod/prop/32210-PropStickUSB-v1.1.pdf)
HitachiH48C3AxisAcelerometer.pdf (Schematic of H48C Accelerometer) - www.parallax.com/Portals/0/Downloads/docs/prod/acc/HitachiH48C3AxisAccelerometer.pdf (http://www.parallax.com/Portals/0/Downloads/docs/prod/acc/HitachiH48C3AxisAccelerometer.pdf)
HM55BModDocs.pdf (Schematic of HM55B Compass) - www.parallax.com/Portals/0/Downloads/docs/prod/compshop/HM55BModDocs.pdf (http://www.parallax.com/Portals/0/Downloads/docs/prod/compshop/HM55BModDocs.pdf)
WebPM-v1.01.pdf (Detailed SPIN language documentation) - www.parallax.com/Portals/0/Downloads/docs/prod/prop/WebPM-v1.01.pdf (http://www.parallax.com/Portals/0/Downloads/docs/prod/prop/WebPM-v1.01.pdf)


Basic Build Instructions:

*1. Configure the components based on the PIN diagrams below. Use a breadboard for testing purposes.
*2. Download and install the required software (listed above).
*3. Open the Propeller Tool Software.
*4. From within the Propeller Tool Software, open this file (Orientation Demo using H48C and HM55B.spin).
*5. Connect the PropStick USB to the computer.
*6. Power on the PropStick USB with 5-9v.
*7. From within the Propeller Tool Software, hit F7 to confirm communication with PropStick USB.
*8. From within the Propeller Tool Softwere, hit F10 to compile and load program into the PropStick USB. Make sure this file (Orientation Demo using H48C and HM55B.spin) has the focus when you hit F10, otherwise the file with current focus is loaded onto the PropStick.
*9. Open the Parallax Serial Terminal.
*10. From within the Parallax Serial Terminal, make sure the COM Port is set to the COM port indicated when you hit F7 from the Propeller Tool Softwere and the Baud Rate is 19200 (unless you changed it in this file below).
*11. From within the Parallax Serial Terminal, click 'Enable' (which should be flashing anytime the PropStick USB is connected).
*12. Confirm the screen is output the readings from the sensors.


Diagrams Included:

*Pin Diagram for PropStick USB
*Pin Diagram for HM55B
*Pin Diagram for H48C
*Pin Diagram for 5V Power Supply


Post Edited (Travis_) : 1/9/2009 11:53:14 PM GMT