page created : April 3rd, 2010 | updated : May 5th, 2011 | |
1. Motivation: We started a new robot project. A small boat should autonomously sail over the Luxembourg reservoir lake from Lultzhausen to Liefrange. The idea has been in our mind for a long time, at least since we met Riccardo Rocca's great site in 1999, which already had inspired us to work with the Pewatron 6100 (Dinsmore1655) compass sensor years ago !! By contrast to Riccardo's project, we want to realize a LEGO NXT controlled version using as much as possible LEGO parts and a homebrew NXT compatible GPS module. The boat and the NXT programs will be made by a group of students and the GPS-NXT interface prototype by CB. The realization of the PCboard, the soldering and testing will be executed by students. The whole team will do the debugging. We got some inspiration from www.bartneck.de/wp.../02/project-report-martijn-ten-bhomer.pdf.. 2. GPS module We acquired a SkyTraq Venus 6 GPS Module ST22 from www.perthold.de. This is a quite impressive and also cheap part. Key features:
The factory settings output has four messages, starting with the $GPGGA message. We want to have positional, but also directional, timing and speed data, so the first thing to program is to reconfigure the module to send out the $GPRMC message. Then we want to have a possibility to switch down the power consumption. Everything should be done over a single NXT sensor port. Through the serial output it sends the following string of ASCII data, according to the NMEA format, once every second, at a rate of 9600 bps: (some data may have variable character number) 0 1 2 3 4 5 6 7 01234567890123456789012345678901234567890123456789012345678901234567890 ======================================================================== $GPRMC,145055,V,4453.6083,N,00944.9533,E,000.0,000.0,070399,,,N*7F The individual elements of this string are: $GPRMC NMEA sentence type 145055 GPS time of position fix (seconds) V data quality: A = valid position, V = receiver warning 4453.6083 latitude "ddMM.mmnn" N latitude N or S hemisphere 00944.9533 longitude "DddMM.mmnn" E longitude E or W hemisphere 000.0 speed over ground (knots) 000.0 course over ground (0-359.9 degrees) 070399 date of position fix "ddmmyy" - not used - not used N N = Data not valid; A = Autonomous mode etc. * delimiter 7F checksum byte (= byte1 eor byte2 eor byte3 eor … byte62) The string is terminated by the ASCII codes "13" (carriage return) and "10" (line feed). |
||
3. GPS to NXT interface
The test circuitry on the breadboard has the GPS module, the PIC, the 18.432MHz crystal plus two 22pF capacitors, two LEDs and a handful resistors, finally a few decoupling capacitors. For survey of the serial traffic with the PC, we added a MAX232 and its usual capacitors, and eventually a hacked NXT cable. Note: we chose a 18.432MHz crystal, because this frequency divides: usual baud rates 38400, 19200, 9600, 4800, 2400 and the PIC baud-generator has 0% error.
|
||
4. The
interface firmware
<0xA0,0xA1><payload length><payload#ID (=08)><payload body><checksum (XOR)><0x0D,0x0A> Normally we should wait for an acknowledgment from the GPS. This is not implemented in the first firmware version. Instead we are waiting for a serial timeout interrupt. A timer generates an interrupt, if during 100ms there has been no signal on the serial line. Because at start the module sends messages during no more than 500ms, this timeout is perfect to detect the GPS serial silence. The PIC serial buffer is reset and the configuration message is sent to the GPS module. There should be no problem with cold start, since nothing else happens then. Warm start has not been tested yet. Now the GPS module sends nothing but $GPRMC messages, which are very short (70*10/9600=73ms). Each second we have 927ms time for perfect I2C interrupt replies to the NXT. In order to tell the NXT that we are in this pause, a LED is switched on, as soon as the RX interrupt detects the CR LF termination of the $GPRMC packet. This LED pin of the PIC is connected to the white wire (analog input) of the NXT cable. The second LED is used to indicate that there is activity on the serial channel between the GPS and the NXT. The logic of the Ultimate ROBOLAB programs are intuitively comprehensive: |
||
5. The NXT program
|
||
15/04/2010
6. The schematics Here the rough-and-ready schematics of the interface. After a discussion with Philippe Hurbain we added the BS250 to the device, in order to have the possibility to completely switch off the main power supply. The The back-up power supply of the GPS-module and the PIC are directly connected to NXT 4.3V. Hence, it will be possible that the NXT programically wakes up the GPS module.
|
||
21/04/2010
7. The layout Stéphan realized this nice layout of the PCboard. Etching will be done tomorrow, because the device didn't work. |
||
8. The boat project In fact this year we had been interested in participating in the ESA CanSat contest. However, because of timing issues, this was not possible. So, we had to seek a new project, and here it is: the LEGO boat project. Two years ago, a team had worked on a submarine, but finally abandoned, because of the many difficulties. Brainstorming the LEGO boat:
|
||
05/05/2010
Brian Davis wrote the following lines: (thanks Brian)
|
||
|
||
06/05/2010 Yesterday evening we succeeded in making the PCboard, soldering the parts, and testing the device: plugged in... and it worked. Wow, excellent job, guys!!! The transistor was not placed yet, because the current PIC firmware doesn't support its control. A new PIC firmware will include the feature of switching on and off the GPS module. Here a few shots of what happened: 1. Philippe studying Brian's email, taking notes. Everything was discussed so far, but no decision has been taken. We will wait until the LEGO sets arrive. 2. Stéphan realized a new layout. Here he is preparing the PCboard for the exposure device: 3. Developing the exposed board in an NaOH solution (7g/l): 4. Etching the board with FeCl3; copper is dissolved: (Amateur radio method !!!) 5. Drilling the holes: 6. Soldering the parts: 7. Testing the GPS interface in the rain, just waiting for a valid fix (just 4 satellites): True position: 49.606988googlemap = 4936.41928deg*100+min=49° 36' 25.16'' 6.122184googlemap=607.33104deg*100+min=6° 7' 19.86'' GPS estimated position (+-30m deviation): 4936.391gps=49.606567googlemap 607.3227gps=6.122045googlemap 8. Indoor test:
|
||
06/05/2010
10. Test of the GPS module New layout: First free-land test. The robot was moved over the sports field for about 2 minutes, after having intercepted at least 4 satellites and the data was written in a log-file. Then the longitude and latitude have been extracted. The GPS needed to be protected against rain. Because of the rain, we aborted the experiments. No speed data and orientation data have been read yet.
Extracting the robot positions:
|
||
07/05/2010
Steve Hussenplug wrote this email (thanks Steve):
|
||
10/05/2010
Kml-files not yet studied!! A longer test with the module. The GPS was placed behind the windscreen of a car. The following LVEE VI was run on the NXT, logging the $GPRMC string every 5 seconds. No failure!!!
|
||
21/05/2010
The LEGO boats: Another test with the GPS: a bicycle tour: |
||
25/05/2010
The GPS module was placed on a fixed position, in order to estimate the precision and accuracy. (Precision expressed in standard deviation [m] from mean; accuracy expressed in deviation of the mean from true position)
very good!
|
||
05/06/2010
|
||
15/06/2010
|
||
16/06/2010
We proceeded to test the power of the boat motors and the burden of the vessel. Therefore the boat was packed with old 1.5V batteries with a total weight 700g. We tried to have the boat cross the little pond of the Luxembourg City-parc. The ducks don't like it. Gras embroiled around the propeller. Eric wants to catch the boat, but the boat capers! Floating on a wide circle.
Next missions:
|
||
Academic year 2010/2011
03/10/2010 The project continues, where we left it for the summer holidays. The first activities are related to the boat design. It is not that simple to connect the studless motor to the boat structure with studs. Well, not perfect yet, but this will help. Stay tuned. |
||
07/10/2010
|
||
07/10/2010 Test of the compass-sensor. The boat was manually moved up, down and sidewise, and the compass-sensor data was logged. Because of the discontinuities around 0 and 360°, the data was adjusted. The method is very simple. If the derivate is greater than 200°, we may suppose that we had a zero- or 360°-crossing. Depending on the sign, we add or subtract 360, and get a continuous signal, which is passed through an averaging filter. In fact, we applied a scalar Kalman Filter, in order to eliminate the fine ondulations. |
||
14/10/2010 The boat corpus is sealed with silicone, in order to make it water-proof. |
||
15/10/2010 First test on the park-pond: the boat swims!! But, as Fred Martin said in a paper: "Real robots don't drive straight." ==> The boat didn't float straight. It took about 15 seconds to turn around and it was trapped in the reeds. However, the GPS and the compass do work correctly. |
||
20/10/2010 This is the first working control of the rudder. A few interesting links: |
||
18/11/2010
The previous program obviously was incomplete, because it only works for one direction. Also, bizarrely, the values "distance" for the NXT motor control icon could exceed 36°! A first text program that includes the GPS follows now. It took a long development time, because we messed up compass angles with heading etc. Note that the compass points +90°. Therefore the current heading is (180-compass value).
|
||
25/11/2010 The following video shows the reaction of the rudder regulation in function of the bearing.
|
||
7/3/2011
We have fixed a date for the first real-world test on the Lac de la Haute-Sûre: Thursday, 28th of April 2011, 15h00. To do:
Material to organize:
|
||
28/4/2011
Because at program start, Stéphan noticed that the rudder was not correctly aligned, he stopped the NXT program, then restarted it. However, because the first instance of the program execution had created the GPS data files, and they had been made write protected, the second call didn't write any data. So, the NXT holds only the first 12 seconds in the datalog. Fortunately we had the handheld GPS on-board with us that had its trace function switched on. Since we followed Serendipity, we can retrace the whole trajectory. We could extract the data from the Garmin GPS. See the video:
|
||
5/5/2011 Sorry! The datalog didn't work for another reason! In fact, it was a program bug. We erroneously had wired the integer division oputput of a modulo function instead of the real modulo value. The program should have logged new GPS data, each time the modulo of a loop index was zero. Because of the bug, only the first 10 seconds were logged. Bummer!!!!
|