Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

willgeorge

Member Since 09 Jul 2011
Offline Last Active Jul 19 2015 10:51 AM
-----

Topics I've Started

Netduino and the HMC6343 Compass

29 January 2012 - 03:15 PM

Another demo Windows Form from me... This project uses the HMC6343 Tilt compensated compass.
I got mine at http://www.sparkfun.com/products/8656

CREDITS:
My code started with the HMC6343 driver code I found in here.
The driver was developed by Greg Oberfield and works very well.
See: http://forums.netdui...ch__1#entry1568
I have changed his code so it is not original. Not that there was anything wrong with it in the first place.
(I just change everything?).. Well, not really. I change things so they fit my needs/ideas.

I am also using the SerialPort (RS-232 Serial COM Port) in C# .NET by Noah Coad.
I have made the serial terminal into a Windows Form User Control that you can 'pop' onto a form.
The serial port original code has been modified to 'read' the command structure sent by the Netduino application.

http://msmvps.com/bl...2300_-.NET.aspx

The Form App has a User Control that will display the compass headings along with Pitch and Roll.

Be warned! I am NOT( in any way) an expert about the HMC6343.
In fact I know little about some of the setting that can be used.
As in the proper way to use the Variation Angle, Hard-Iron Calibration Offsets and IIRF filters.

That said, My application is very 'busy' with controls because I have tried to implement reading and writing
all of compass EEProm registers. NOTE: The application will NOT write to the EEProm without the user
sending the write to register commands by clicking the serial terminal SEND button.

I have read and written to my compass EEProm many times without any issues.
However, I cannot be responsible for any damage to your compass.
(As far as I know there is no way to 'factory reset' the compass by the end user.)

If we have an EXPERT out there I sure would like to know more about using the Variation, Hard Iron and filters.

I can write values to change the registers but I have no idea what I am doing. (NOT a math wizzard here).
If the math does not include the 'rules memorized' during school, I'm lost!

The code is written using an XBee serial device at the Netduino.
If you use a different serial device for your Netduino you will need to modify your serial device
code to use and return the commands sent and received by the windows form.
Reading and writing the commands are specific to my code and must have
the correct structure or it will not work.

Update: I have added a non-XBee Netduino application that uses the Netduino serial port pins D0 and D1.
The serial port driver IS NOT A COMPLETE SERIAL PORT TERMINAL PROGRAM.
The code was made for reading and writing unique command strings between the Netduino and
the FormCompassHMC6343_Netduino application.

There is a minor error in the original FormCompassHMC6343_Netduino application. Nothing serious but
I have replaced the zip with corrected code. The error was that a command was sent twice. Caused no
harm but I still wanted to correct the issue.

**************************************************************************************************************************

I have Revised and Updated the applications to include using all of the HMC6343 functions/registers

Items like User Calibration, Magnetometer Offsets, setting the IIR Filter value, Run modes and clearing the Magnetometer registers.
I 'think' I got everything?...

Seems that nobody uses the compass but I will share my code anyway. There is no copyright on any portion of my code. Use as you want to.

I have to state again that I am far from being an expert on this device. My code is based on what I 'think' is correct usage and probably NOT what the manufacturer intended.

HAVE FUN!

Why Not?

28 January 2012 - 05:11 PM

Why is there not ONE place in this form to find ALL of the code necessary to update ALL of the Netduino versions? Seems like this would better serve the community. Maybe it is just me, but hopping around collecting parts here and there, makes be wonder if I am using the correct software and if have everything I need to fix, upgrade or downgrade. Not that I'm lazy.. But it makes sense to me! Thanks for letting me rant.....

XbeeUserControl

26 December 2011 - 01:30 AM

I made a Windows Form User Control for a Serial Port that I can use with my Netduino's and XBee's and for other projects. OK, so I love my little XBee's... I did some limited testing of the user control on a loopback and using with some old applications I have that are serial based. All seemed to work OK. The user control is a no frills generic serial port that I can put on a Windows Form and then use with limited coding. Currently there is no support for handshake. Mainly because, with modern devices, I never need to use it. The attached code has the serial port user control in a Windows Form test application. The application contains sample code for using the control and coding for the control 'events'... There is also a small Netduino application that you can use to test the communication between the Netduino and the user control/form. If all goes well uploading the Zip files, you should have the full source code and Exe files to run the applications. If you need to modify the code for the UserControl/Form begin with using (FormsXBeeUserControl folder) FormsXBeeUserControl.sln. This solution contains both the Windows Form and the UserControl projects. NOTE; When modifying the code for the serial port user control.. FIRST; Build/rebuild the user control project. THEN; build/rebuild the solution. This way, the dll reference for the form will have a updated dll to use when rebuilding the solution. EDIT: OK, so I'm gettin' old.. I forgot to post images of the user control. I am also posting a Windows Form that is a has tabs so that the user control is in the second tab. Makes the control hidden away so you have room for your main project. The main tab has a text box that will display the serial port messages. The textbox on the main tab is made the same size as the one in the user control. It does not have to be the same size, but... just the way I do things... OH! My granddaughter gave me a FEZ Spider as a gift! Nice little gadget. (Yes I know,, It's not a Netduino but.....) Have Fun!

Netduino XBee and SparkFun SEN-10530

16 December 2011 - 02:48 PM

First.. This code is based upon code I found here and code found at Love Electronics (UK)

http://forums.netdui...-netduino-code/
https://www.loveelec...arduino-library

The code does not have tilt compensation at the moment but may be of use to those that want to play with it. I need a ADXL 345 to do the tilt which is on order.

Please see the notes in the application code when using this app. If the onboard switch is pressed too soon.. The netduino will hang in in a state that will require
you to power off - on to reset. The netduino sends compass data over the XBee serial port. (The program could be modified to use any serial port you have).

Included in the code are ( //commented out " data strings of different types " ) that you could send by serial or Debug.Print if you need/want it.


Anyway.. Have fun!



I'm not sure this is allowed in here but I found some really cool stuff I ordered.. Well, I thought it would be fun to play with..
http://www.gabotroni...ll-products.htm // I have nothing to do with this vendor. I only use them for what they are intended for (limits).

I have the AVR XMEGA Development Board and the Xprotolab.. NO... they are NOT $10,000, 8 channel oscilloscopes but are fun to use.
At least they can give you some visual indication of what you are doing.

Phony Scope

30 November 2011 - 11:23 AM

My gift for the holidays.. I call this project Phony Scope because traces drawn in the windows form are not by sampling of data from the Netduino. Traces are drawn from textBox(s), preset data, and trackBar values. The application is, in a way, pointless (never stopped me!) but the code may have some value to others to 'play with'. I was using a 'basic' Netduino with XBee's for communication. As to pointless.. The windows form sends messages to the Netduino telling it what to do such as set two PWM ports from the data messages sent. I already know what the data is but I have the Netduino return the message sent to it. At the form, the returned message is parsed for the Period and Duration data of the PWM signal. This returned data is then scaled for display in a pictureBox on the form. The code is far from 'perfect' but seems to work OK. There is one known issue. On rare occasions, the message string sent to the Netduino for setting the PWM has missing data. The Netduino will return a message informing you of the problem. To be blunt, I have no idea why, but at least it does not happen very often. I live near the BIG Chicago airport and I have issues with electronic items in the home at times. I 'think' it is from aircraft transmissions of some sort. Anyway, a plane is usually flying over and then have strange thing happen around here. Like hear voices on the TV and FM radio. There are some additional methods such as reading the XBee RSSI values (Now if I only knew which XBee I'm reading the RSSI from?) and for sending a 'test' square wave over the XBee serial port. The 'test square wave' is the ASCII upper case character 'U' which is binary 01010101... Yes, a square wave! (adjustable interval). Setting the PWM is provided by several options on the form. Be aware that, while some error checking is performed in the code, I did not attempt to make it 'bullet proof'. EDIT: I forgot.. I had to remove the EXE files from the form so the zip was small enought to download. You will have to compile the Form code.. Have a GREAT holiday ALL!

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.