My parts finally arrived. I ordered a GPS logger from Adafruit and a uBlox5 GPS from DIY drones. Ublox has a program uCenter used to configure the uBlox5 GPS. The uCenter user guide is here. The GPS comes with an adapter so that it is compatible with the EM-406 type cable. So it works with the data logger which was designed for the EM-406.
Wednesday, March 30, 2011
GPS Logger + uBlox5 GPS
My parts finally arrived. I ordered a GPS logger from Adafruit and a uBlox5 GPS from DIY drones. Ublox has a program uCenter used to configure the uBlox5 GPS. The uCenter user guide is here. The GPS comes with an adapter so that it is compatible with the EM-406 type cable. So it works with the data logger which was designed for the EM-406.
Saturday, March 26, 2011
I2C sensors - Compass
- LSM303, $30, I2C, no internal calculations, accuracy depends...
- HMC6343, $150, I2C, tilt compensation calculated internally, accuracy of 2 degrees
- OS5000-s, $260, RS232, tilt compensation calculated internally, accuracy of 0.5 degrees
- I2C uses pins A4 for SDA (data) and A5 for SCL (clock)
- I2C needs Arduino librarywire.h>
- The default (factory) HMC6343 7-bit slave address is 0x32 for write operations, or 0x33 for read operations.
- The compass requres pull-up resisters on SDA and SCL to 3.3v and supply voltage of 3.3v
- The Arduino has built in pull-up resisters on A4, A5, but it is to 5v...
Tuesday, March 22, 2011
Paddlewheel Speed Sensor + Wind Vane Question
Sunday, March 20, 2011
Anemometer Nearly Done
Saturday, March 19, 2011
Finally got the photo interrupter working!
- look at the datasheet and see which side is the emitter and which is the collector.
- start by setting up the phototransistor as an analog input analogread() will output values from 0-1023
- look at the datasheet to see how much voltage and current the LED can handle. Mine was 50mA
- Hook up the LED to that output. In my case digital I/O gives 5V and 40mA.
- watch the serial monitor I started off getting values that ranged from 0 to 3, then after fiddling with resistors (taking away the resistor to the emitter and adding a 10K to the transistor).
- Got to the point where I read 10-20 when the gate was blocked and 1010-1020 when the gate is open. (my Photo interrupter took a 10K resistor, my Photo Reflective Sensor will take a 100k or 1m resistor all I have is 10K resistors and 5 of them in series brought the reading up to 400)
- Now change the code from analogRead() to digitalRead() (and switch the input wire) see if you get 111100001110001111 when you move something between the gate.
- Helpful forum post on troubleshooting a photogate
- Code and schematic on testing a photogate
- basic setup and pictures of a photogate, and code using attachinterrupt()
int val;
void setup()
{
pinMode(13, OUTPUT);
pinMode(2, INPUT);
Serial.begin(9600); // sets the serial port to 9600
digitalWrite(13, HIGH);
}
void loop()
{
val = digitalRead(2); // read digital input pin 2
//val = analogRead(0); // read analog input pin 0
Serial.print(val); // prints the value read
Serial.print(" "); // prints a space between the numbers
delay(100); // wait 10ms for next reading
}
Friday, March 18, 2011
SiRFIII GPS Logger Shield
The output from the EM-406a is in NMEA sentences. Each sentence starts with a '$'. There are a bunch of sentences that it can spit out, but only a few that we are interested in. For example sentences look at the EM-406a Manual.
- RMC-Recommended Minimum Specific GNSS Data, message 103,04
- - this has all the basic data that you'd want for a boat; lat, long, speed (in knots)
- VTG-Course Over Ground and Ground Speed, message 103,05
- - this will give us the heading relative to magnetic north. That way we can directly compare the reading from the compass
Telemetry Using Xbee Modules
Compass With Tilt Compensation
// I2C related constants and variables
// Library includes
#include
#define HMC6343Address 0x32
// Shift the device's documented slave address (0x32) 1 bit right
// This compensates for how the TWI library only wants the
// 7 most significant bits (with the high bit padded with 0)
int slaveAddress = HMC6343Address >> 1; // This results in the 7 bit address to pass to TWI
// Compass measurement related constants and variables
byte headingData[6];
void init_compass(void)
{
Wire.begin(); // Open I2C to HMC6343
}
void getCompassData(void)
{
int i;
Wire.beginTransmission(slaveAddress);
Wire.send(0x50); // Send a "Get Data" (0x50) command to the HMC6343
Wire.endTransmission();
delay(2); // The HMC6343 needs at least a 1ms (microsecond) delay
// after this command. Using 2ms just makes it safe
// Read the 6 heading bytes, MSB first
// The resulting 3 16bit words are the compass heading, the tilt and roll in 10th's of a degree
// For example: a heading of 1345 would be 134.5 degrees
Wire.requestFrom(slaveAddress, 6); // Request the 6 bytes of data (MSB comes first)
i = 0;
while(Wire.available() && i < headingvalue =" headingData[0]*256" tiltvalue =" headingData[2]*256" rollvalue =" headingData[4]*256" vbthetac="headingValue/10;">
Saturday, March 12, 2011
Sailing the Soling with a GPS onboard
View Soling in a larger map
- Top Speed: 3.5 knots
- Average Speed: 1 knot (included pre and post race)
Photogate RPM sensor
My next problem to solve is the implementation of a photogate as a paddlewheel boat speed sensor and a second photogate to count RPM on the anemometer. I found this great little project in instructables.com that uses the attachInterrupt() arduino function. I'll use the same thing.
Sunday, March 6, 2011
Current Plan of Attack
Arduino + GPS Data Logger
V0.1 - (done)
- GPS -measures at 1Hz to within 5m
- Position
- Vg - ground velocity
- time stamp
V1.0
logs:
- Arduino
- Vs - boat speed
- Va - apparent wind velocity
- Ba - Apparent wind angle (without correction)
- time stamp
- GPS
- Position
- Vg - ground velocity
- time stamp
V2.0
Logs:
- Arduino
- Vs - boat speed
- Va - apparent wind velocity
- Ba - Apparent wind angle (without correction)
- Ta - Apparent wind angle wi
- Phi - Heel angle
- C - course of the boat
- GPS
- Position
- Vg - ground velocity
- time stamp
V3.0
sends data to a computer via xBees
- Arduino
- Vs - boat speed
- Va - apparent wind velocity
- Ba - Apparent wind angle (without correction)
- Ta - Apparent wind angle wi
- Phi - Heel angle
- C - course of the boat
- GPS
- Position
- Vg - ground velocity
- time stamp
Apparent Wind Parameters
Data Logging
- apparent wind angle
- apparent wind speed
- boat speed
- GPS coordinates
Friday, March 4, 2011
Velocity Made Good Calculation
- Yacht speed -- Vs
- Apparent wind direction -- (B - lambda)
- Apparent wind speed -- Va
- Leeway Angle -- lambda
"Vmg is given by Vs cos gamma. The angle between the yacht's track and her fore-and-aft axis is the leeway angle lambda"
I think that the tiny 1/2 looking like sym
bol exponent position under the devision sign is 1/lambda.
Electronic Instruments and Computers for Sailing Yachts
I've found that reading really old research is often more interesting than the cutting edge stuff. To see how ideas develop and in just a few minutes cover decades of development is really the essence of the information age. Here is just such a paper. Gatehouse suggest measuring true position by sighting known markers to triangulate your position which was considered unfeasible . Well a GPS is a whole lot easier, but wasn't around 1970.
Gleaned Points of Importance to ArduSkipper:
- where to put the speedometer - "the boundary layer beneath the hull of a typical racing yacht was nowhere more than 1 in. thick and was only about 1/2 in. thick at a position 5 ft. aft of the forefoot, the position finally chosen for the sensor [on a 24ft boat]."
- "The leeway angle, which is the angle between the yacht's fore-and-aft axis and the direction of motion through the water, reaches a maximum value when the yacht is close-hauled, this value varying between about 2° and about io°"
- Wind Vane Error - the error of measurement of wind direction due to sail deviation seldom exceeds 3 degrees and is independent of wind velocity.,, [other researchers], indicated that the error was about + 7 degrees.... [Moreover] The error is such as to make the apparent wind angle greater than it really is.
- Anemometer - The diameter of each cup is 1 in. and the length of its supporting arm is 1 1/2 in. Departures from linearity did not exceed 0.5 per cent within the speed range 2-60 knots.
Commenting Code
- The latest Aurdpilot Mega
- Harald Molle's Modified Ardupilot v1.o
- Glenn's Wind Vane
- Robbie Edwards' code for their autonomous sailboat based on Aurdpilot Mega
- Code for the Adafruit data logger
Wednesday, March 2, 2011
The Servos Arrived
------------------------------
1 (37950S10) HS-7950TH Servo $149.99 $149.99
* Quantity Modifier $-37.50 $-37.50
* Option: Rotation is 180° (5445) $10.00 $10.00
1 (31085S00) HS-85BB Servo $19.99 $19.99
* Quantity Modifier $-5.00 $-5.00