tag:blogger.com,1999:blog-68718154401691581882024-02-02T07:28:28.221+02:00The Ship Computersdfzsdfgsdfsdfhttp://www.blogger.com/profile/09402169675605441952noreply@blogger.comBlogger13125tag:blogger.com,1999:blog-6871815440169158188.post-76881332945749675342014-03-07T22:03:00.002+02:002014-03-07T22:03:33.899+02:00Battery Monitor as a probe of the Ship Computer!I had complains!<br />
<br />
It may not show here, but I had a few friends calling and sending emails, disappointed I diverted from the initial idea and instead of working to the Ship Computer, I wasted time on a battery monitor...<br />
<br />
Well, rejoice!<br />
<br />
I changed a couple bits and now, the Battery Monitor can get connected to the Ship Computer (when it will be build that is...) and will be used as a probe for suppling data on current and voltage.<br />
<br />
How about that?<br />
<br />
<br /><br />
<br />sdfzsdfgsdfsdfhttp://www.blogger.com/profile/09402169675605441952noreply@blogger.com0tag:blogger.com,1999:blog-6871815440169158188.post-60436229286657134472014-03-03T04:12:00.003+02:002014-03-04T00:51:02.459+02:00Arduino-based battery monitorHello again!<br />
<br />
I started with the Ship Computer last October but had to stop working on it for a couple of months and hoped to start over again in January.<br />
<br />
Which, unfortunately I didn't.<br />
<br />
The same time I am setting up a<b><span style="color: blue;"><u> <a href="http://westcoastexpedition2014.blogspot.gr/" target="_blank">trip around Ionian</a></u></span></b> for which I am planning to get going by mid May, that is, less than 2 and a half months away, and I have to prepare the boat and everything.<br />
<br />
Which means that probably there won't be much time for software development...<br />
<br />
Nevertheless, I absolutely need some of the functionality the ship computer was going to give me, and knowing that probably I won't have the Ship Computer ready for this trip, I started thinking of alternatives.<br />
<br />
One thing that I have to have is a battery monitor.<br />
<br />
On the boat I have a 120W solar panel for charging a 65AH battery and, if absolutely necessary, I can also use the outboard alternator for additional 60W of battery charging power. As far as consumption goes, I have installed led-based navigation and cabin lights so that will keep the consumption down. Other source of power consumption include the instruments and the autohelm, for which I am particularly worried.<br />
<br />
Anyway, since I only carry a single battery, I need to know how much consumption is there, what is the charging current when applicable and the battery voltage.<br />
<br />
In order to get this functionality, I used an arduino Pro Mini, a current sensor (similar to <a href="http://r.ebay.com/TJplli" target="_blank">this</a>), a voltage divider set up with two resistors and a 16x2 LCD screen connected to I2C.<br />
<br />
For powering I used a low cost 6V UBEC like this one: <a href="http://r.ebay.com/NQZ0ne">http://r.ebay.com/NQZ0ne</a><br />
<br />
The finished project looks like this:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtErb4ei3gzJkVOF7v5hJr5iYxQr3hHAAedj7dA9ebRBtfDVbAr6_fur8p4vgZAi9TAgBd6iexV4ArvylxpzEj1HthPPc6x_XwTs5_QALzRRtFFtzGVX93Z16aOezUtg2PXJ4gmslhtH_4/s1600/battery-monitor-arduino.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtErb4ei3gzJkVOF7v5hJr5iYxQr3hHAAedj7dA9ebRBtfDVbAr6_fur8p4vgZAi9TAgBd6iexV4ArvylxpzEj1HthPPc6x_XwTs5_QALzRRtFFtzGVX93Z16aOezUtg2PXJ4gmslhtH_4/s1600/battery-monitor-arduino.jpg" height="300" width="400" /> </a></div>
<div class="separator" style="clear: both; text-align: left;">
In this picture:</div>
<ul>
<li>#1 is the current sensor</li>
<li>#2 if the arduino Pro Mini</li>
<li>#3 is the insulation for the arduino</li>
<li>#4 is the UBEC with the insulattion sleeve in place</li>
<li>#5 is the 16x2 LCD screen</li>
</ul>
I have also prepared a youtube video that shows the system working:<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/1TLS5N9OZlw?feature=player_embedded' frameborder='0'></iframe></div>
The source code for the project is very simple and has as following:<br />
<span style="font-family: "Courier New",Courier,monospace;"><br /></span>
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;">#include <Wire.h> <br />#include <LiquidCrystal_I2C.h><br /><br />float amperes=0;<br />float volts=0;<br /><br />LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);<br /><br />void setup()<br />{<br /> // initialize the lcd <br /> lcd.begin(16,2); <br /> lcd.clear();<br /> lcd.print("Amps=");<br /> lcd.setCursor ( 0, 1 );<br /> lcd.print("Volts=");<br />}<br />void clearValues(){<br /> lcd.setCursor ( 6, 0 );<br /> lcd.print(" ");<br /> lcd.setCursor ( 7, 1 );<br /> lcd.print(" ");<br />}<br />void showValues(float Amps,float Volts){<br /> clearValues();<br /> lcd.setCursor ( 6, 0 );<br /> lcd.print(Amps,3);<br /> lcd.setCursor ( 7, 1 );<br /> lcd.print(Volts);<br />}<br /><br />void loop()<br />{<br /> // MEASURE CURRENT <br /> // ampere sensor connected to A3<br /> amperes=0;<br /> long temp=0;<br /> //150 reads, 15 usec delay = total 2.25msec <br /> for(int i = 0; i < 150; i++) { <br /> temp+=analogRead(A7);<br /> amperes = amperes + (.0264 * analogRead(A3) -13.51) / 150; <br /> //function calibrated for 5A sensor<br /> delayMicroseconds(15); //15 usec delay for the A2D to "reset"<br /> }<br /> temp/=150;<br /> amperes=(0.0049*(temp-512))/0.185;<br /> //negative on discharge, positive on charge<br /> amperes*= (-1); <br /> //<br /> // MEASURE VOLTAGE<br /> // voltage divider (1/5) conected at pin A2<br /> temp=0;<br /> //150 reads, 15 usec delay = total 2.25msec delay for a measurement<br /> for(int i = 0; i < 150; i++) {<br /> temp+=analogRead(A3);<br /> delayMicroseconds(15); //15 usec delay for the A2D to "reset"<br /> }<br /> temp/=150; // get the average value<br /> volts=temp*5.01*((19.93+6.8)/6.8)/1024.0; // calculate actual voltage<br /> showValues(amperes,volts);<br /> delay(300);<br />}</span></span><br />
<span style="font-size: x-small;"><br /></span>
<span style="font-size: x-small;"><span style="font-size: small;">The whole setup is simple, works like a charm and is a way to get some limited but needed functionality even if the Ship Computer is not ready in time for the trip.</span></span><br />
<br />
<span style="font-size: x-small;"><span style="font-size: small;">That said, I hope to be back soon with a post about the ship computer itself!</span></span><br />
<br />
<span style="font-size: x-small;"><span style="font-size: small;">Thanks for reading,</span></span><br />
<span style="font-size: x-small;"><span style="font-size: small;">G. </span></span>sdfzsdfgsdfsdfhttp://www.blogger.com/profile/09402169675605441952noreply@blogger.com0tag:blogger.com,1999:blog-6871815440169158188.post-89501803081352522302014-01-17T01:12:00.000+02:002014-01-26T11:00:04.829+02:00The Wind Sensor<div dir="ltr" style="text-align: left;" trbidi="on">
Hello again!<br />
<br />
it's almost 2 months since my last post and believe it or not, I have not abandoned the project.<br />
To say the truth I have been tempted to "postpone" developments and start a couple new ones and actually I have started working on a drone BUT I have to go on with this "Ship Computer" project -if not for anything else- for the simple reason that I need to have it!<br />
<br />
So, on my last post I was putting a draft version of the system together using a Raspberry PI as the heart of the system.<br />
<br />
I had also mentioned that I was going to use an I2C Analog to Digital converter and I had actually bought a couple -pretty expensive- ones.<br />
<br />
The thing is, I thought it over a bit and decided to use a Arduino Pro Mini for interfacing with the Wind Sensor.<br />
<br />
The Arduno Pro Mini is this one:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjm0rI-UkreBWwCv-BrAmXc8GF4Az8g_5_zWRttIxkQA44APjcdCXRZMecqWrQZdjhvNkwMUbT_hMiFfcD1PdDRAycDx-Tp_l-eZKj018weEyPCwofwiSoNl82-voyrWaNW_Kfuh4OWiYnO/s1600/ProMini.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjm0rI-UkreBWwCv-BrAmXc8GF4Az8g_5_zWRttIxkQA44APjcdCXRZMecqWrQZdjhvNkwMUbT_hMiFfcD1PdDRAycDx-Tp_l-eZKj018weEyPCwofwiSoNl82-voyrWaNW_Kfuh4OWiYnO/s1600/ProMini.png" height="451" width="640" /></a></div>
It is a full-fledged <a href="http://en.wikipedia.org/wiki/Arduino" target="_blank">Arduino</a> in a tiny package.<br />
How tiny is tiny?<br />
Tiny enough to look small next to a credit-card sized Raspberry:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhj_EH2cdpcK5Y0IYgAnZq8cM4VBaBDVpVUyqgv30slVHuRy1UljeASKlUS5t6ibpmpCD80hMlnx3KDmZc0el7OZqiARMILdS2seh2LDdDDE1khy_PyImbqDvsiuRUpTUjjZrq4sPJU0FjT/s1600/photo+5.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhj_EH2cdpcK5Y0IYgAnZq8cM4VBaBDVpVUyqgv30slVHuRy1UljeASKlUS5t6ibpmpCD80hMlnx3KDmZc0el7OZqiARMILdS2seh2LDdDDE1khy_PyImbqDvsiuRUpTUjjZrq4sPJU0FjT/s1600/photo+5.JPG" height="320" width="314" /></a></div>
The same time it can be bought from ebay for just a couple euros, making it extremely more cost effective compared to the ADC I was thinking of using while still far more versatile.<br />
<br />
So, it was not much of a question really, I was going to use the Arduino in order to get measurements for wind speed and direction.<br />
<br />
The actual transducer for getting this measurements was a low cost NASA MARINE masthead unit as shown <a href="http://www.nasamarine.com/proddetail.php?prod=01_Mast_Head_Unit&cat=25" target="_blank">here</a>.<br />
<br />
Two months and something ago I had tried to get in contact with Nasa Marine in order to get some info on this unit but there was not a reply.<br />
So, I had to do a bit of reverse engineering.<br />
The unit terminates on a <a href="http://en.wikipedia.org/wiki/File:DIN-5_Diagram.svg" target="_blank">5-pin DIN connector</a>, same as the one of the old (pre-nineties) PC keyboard, whose pin layout is as follows:<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnG6FaZI0xPUEN4FnodY97Q8O0Vdt_VQPk9ld-vDXJ6IAhaXgaUwpfznHheMXT135cXBMIRJYSIoVDC6oLhwK2ecYtXPvlWlDdyRbCatxIXoUnKLOjQvxRlKZPfE46O1ZlLEPUbVhtfPbS/s1600/5pinsocket.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnG6FaZI0xPUEN4FnodY97Q8O0Vdt_VQPk9ld-vDXJ6IAhaXgaUwpfznHheMXT135cXBMIRJYSIoVDC6oLhwK2ecYtXPvlWlDdyRbCatxIXoUnKLOjQvxRlKZPfE46O1ZlLEPUbVhtfPbS/s1600/5pinsocket.gif" /></a></div>
Playing a bit with a multimeter, I decoded the signals:<br />
<ol style="text-align: left;">
<li>Pin 1:Pulse per Wind Cups rotation</li>
<li>Pin 2:GND</li>
<li>Pin 3:+5V</li>
<li>Pin 4:Analog output 1</li>
<li>Pin 5:Analog output 2</li>
</ol>
The values of the two analog signals somehow indicated the wind direction and I had to decode that.<br />
The wind speed would be almost proportional to the rotating speed of the cup rotor, which produced a pulse for a full turn.<br />
<br />
Next I attached the masthead unit to a bookcase next to my desk so that I could rotate the windex and the cup rotor:<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjf-iNbZrpLyJJNFecfkonl0iCWfFWjOQbG-SBDN_uwGDqT2VDUIYchuApIxMeaKg7njmffg3J4e44Ll4VbwJrvSNWJN7RQDPPM7veXi89MIiuMUMQI0PyfKoDPVDlDIDciTLjzhje919qm/s1600/photo+3.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjf-iNbZrpLyJJNFecfkonl0iCWfFWjOQbG-SBDN_uwGDqT2VDUIYchuApIxMeaKg7njmffg3J4e44Ll4VbwJrvSNWJN7RQDPPM7veXi89MIiuMUMQI0PyfKoDPVDlDIDciTLjzhje919qm/s1600/photo+3.JPG" height="240" width="320" /></a></div>
<br />
<br />
...and I fed the signals to the Arduino:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiedjio_T3-Jnmgv5cHKfh7f9l2tVHKuHvP5eu02sTGLeCTAAXDaBEce_E_-xdWq6oUcSxOBtZSF0oEpeFseJB0KenViUWjevlzotUsfRX4dlIMt_8gyPQXKCw831nBEi-6Poffsiu8dAlr/s1600/photo+4.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiedjio_T3-Jnmgv5cHKfh7f9l2tVHKuHvP5eu02sTGLeCTAAXDaBEce_E_-xdWq6oUcSxOBtZSF0oEpeFseJB0KenViUWjevlzotUsfRX4dlIMt_8gyPQXKCw831nBEi-6Poffsiu8dAlr/s1600/photo+4.JPG" height="240" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhe1dm340-Md6LkMD3FePOlB7dsKEC9gC0EfHEIpYUosVE19eX-MVhY-WegHk7OJN32G2ptmFgMMwwEw_0PvuBaMl5soFPvurs_hl85NOwjW6z0WYY7G6rYxCfrF3DCtuBgPObpuBWzcHi1/s1600/photo+2.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhe1dm340-Md6LkMD3FePOlB7dsKEC9gC0EfHEIpYUosVE19eX-MVhY-WegHk7OJN32G2ptmFgMMwwEw_0PvuBaMl5soFPvurs_hl85NOwjW6z0WYY7G6rYxCfrF3DCtuBgPObpuBWzcHi1/s1600/photo+2.JPG" height="640" width="480" /></a></div>
...and also connected an LCD display so that I would have a quick way to see what was going on.<br />
<br />
All I needed was a bit of software, the soul that would make it tick.<br />
<br />
I spent a couple of nights and here it is:<br />
<blockquote class="tr_bq">
<span style="font-size: x-small;"><b><span style="font-family: "Courier New",Courier,monospace;">#define bsize 10</span><br /><span style="font-family: "Courier New",Courier,monospace;">#include <LiquidCrystal.h></span><br /><span style="font-family: "Courier New",Courier,monospace;">#include <FlexiTimer2.h></span><br /><span style="font-family: "Courier New",Courier,monospace;">LiquidCrystal lcd(4, 5, 6, 7, 8, 9);</span><br /><span style="font-family: "Courier New",Courier,monospace;"></span><br /><span style="font-family: "Courier New",Courier,monospace;">const int APin2 = A1;</span><br /><span style="font-family: "Courier New",Courier,monospace;">const int APin4 = A0; //Connector PIN4, Wire color BROWN</span><br /><span style="font-family: "Courier New",Courier,monospace;">const int led = 13; //Built-in led</span><br /><span style="font-family: "Courier New",Courier,monospace;">const int PulsePin = 3; //The wind rotor, PI5, color ORANGE</span><br /><span style="font-family: "Courier New",Courier,monospace;"></span><br /><span style="font-family: "Courier New",Courier,monospace;">struct buffer {</span><br /><span style="font-family: "Courier New",Courier,monospace;"> int data[bsize];</span><br /><span style="font-family: "Courier New",Courier,monospace;"> byte bptr;</span><br /><span style="font-family: "Courier New",Courier,monospace;"> int total;</span><br /><span style="font-family: "Courier New",Courier,monospace;"> int average;</span><br /><span style="font-family: "Courier New",Courier,monospace;">};</span><br /><span style="font-family: "Courier New",Courier,monospace;"></span><br /><span style="font-family: "Courier New",Courier,monospace;">struct buffer V2bf, V4bf;</span><br /><span style="font-family: "Courier New",Courier,monospace;">int heading = 0;</span><br /><span style="font-family: "Courier New",Courier,monospace;">int V2 = 0;</span><br /><span style="font-family: "Courier New",Courier,monospace;">int V4 = 0;</span><br /><span style="font-family: "Courier New",Courier,monospace;">int period=0;</span><br /><span style="font-family: "Courier New",Courier,monospace;"></span><br /><span style="font-family: "Courier New",Courier,monospace;">void getHeading(){</span><br /><span style="font-family: "Courier New",Courier,monospace;"> V2= analogRead(APin2);</span><br /><span style="font-family: "Courier New",Courier,monospace;"> V4= analogRead(APin4);</span><br /><span style="font-family: "Courier New",Courier,monospace;"></span><br /><span style="font-family: "Courier New",Courier,monospace;"> V2bf.total-=V2bf.data[V2bf.bptr];</span><br /><span style="font-family: "Courier New",Courier,monospace;"> V2bf.data[V2bf.bptr]=V2;</span><br /><span style="font-family: "Courier New",Courier,monospace;"> V2bf.total+=V2bf.data[V2bf.bptr];</span><br /><span style="font-family: "Courier New",Courier,monospace;"> V2bf.average=V2bf.total/bsize;</span><br /><span style="font-family: "Courier New",Courier,monospace;"> V2bf.bptr++;</span><br /><span style="font-family: "Courier New",Courier,monospace;"> if (V2bf.bptr>=bsize) V2bf.bptr=0;</span><br /><span style="font-family: "Courier New",Courier,monospace;"> V2=V2bf.average;</span><br /><span style="font-family: "Courier New",Courier,monospace;"></span><br /><span style="font-family: "Courier New",Courier,monospace;"> V4bf.total-=V4bf.data[V4bf.bptr];</span><br /><span style="font-family: "Courier New",Courier,monospace;"> V4bf.data[V4bf.bptr]=V4;</span><br /><span style="font-family: "Courier New",Courier,monospace;"> V4bf.total+=V4bf.data[V4bf.bptr];</span><br /><span style="font-family: "Courier New",Courier,monospace;"> V4bf.average=V4bf.total/bsize;</span><br /><span style="font-family: "Courier New",Courier,monospace;"> V4bf.bptr++;</span><br /><span style="font-family: "Courier New",Courier,monospace;"> if (V4bf.bptr>=bsize) V4bf.bptr=0;</span><br /><span style="font-family: "Courier New",Courier,monospace;"> V4=V4bf.average;</span><br /><span style="font-family: "Courier New",Courier,monospace;"> if (V2<=180){//1st quadrand, 1-90, based on V4</span><br /><span style="font-family: "Courier New",Courier,monospace;"> // V4 takes values</span><br /><span style="font-family: "Courier New",Courier,monospace;"> // it corresponds to a function of a line that passes from points (18,89) & (78,0)</span><br /><span style="font-family: "Courier New",Courier,monospace;"> // see http://www.webmath.com/equline1.html</span><br /><span style="font-family: "Courier New",Courier,monospace;"> heading=(-89.0/58*V4/10+3382.0/29);</span><br /><span style="font-family: "Courier New",Courier,monospace;"> }</span><br /><span style="font-family: "Courier New",Courier,monospace;"> if (V4<=220){ //2nd quadrand, 91-180, based on V2, passing from (18,90) & (76,179)</span><br /><span style="font-family: "Courier New",Courier,monospace;"> heading=(89.0/58*V2/10+1809.0/29);</span><br /><span style="font-family: "Courier New",Courier,monospace;"> }</span><br /><span style="font-family: "Courier New",Courier,monospace;"> if (V2>=758){ //3rd quadrand, 181-270, based on V4, passing from (22,180) & (76,269)</span><br /><span style="font-family: "Courier New",Courier,monospace;"> heading=(89.0/54*V4/10+3881.0/27);</span><br /><span style="font-family: "Courier New",Courier,monospace;"> }</span><br /><span style="font-family: "Courier New",Courier,monospace;"> if (V4>=758){ //4th quadrand, 271-360 based on V2, passing from (76,270) & (18,359)</span><br /><span style="font-family: "Courier New",Courier,monospace;"> heading=(-89.0/57*V2/10+1166.0/3);</span><br /><span style="font-family: "Courier New",Courier,monospace;"> }</span><br /><span style="font-family: "Courier New",Courier,monospace;"> if (heading>=360) heading-=360;</span><br /><span style="font-family: "Courier New",Courier,monospace;"> if (heading<0) heading+=360;</span><br /><span style="font-family: "Courier New",Courier,monospace;">}</span><br /><span style="font-family: "Courier New",Courier,monospace;"> </span><br /><span style="font-family: "Courier New",Courier,monospace;">void pulse(){ //this runs when a pulse is received from the windmeter rotor</span><br /><span style="font-family: "Courier New",Courier,monospace;"> static int msecs=0;</span><br /><span style="font-family: "Courier New",Courier,monospace;"> int temp;</span><br /><span style="font-family: "Courier New",Courier,monospace;"> temp=millis();</span><br /><span style="font-family: "Courier New",Courier,monospace;"> period=temp-msecs;</span><br /><span style="font-family: "Courier New",Courier,monospace;"> msecs=temp;</span><br /><span style="font-family: "Courier New",Courier,monospace;">}</span><br /><span style="font-family: "Courier New",Courier,monospace;"> </span><br /><span style="font-family: "Courier New",Courier,monospace;">void setup() {</span><br /><span style="font-family: "Courier New",Courier,monospace;"> lcd.begin(16,2);</span><br /><span style="font-family: "Courier New",Courier,monospace;"> lcd.clear();</span><br /><span style="font-family: "Courier New",Courier,monospace;"> lcd.print("WindMeter");</span><br /><span style="font-family: "Courier New",Courier,monospace;"> FlexiTimer2::set(50, getHeading); // 50ms period</span><br /><span style="font-family: "Courier New",Courier,monospace;"> pinMode (led,OUTPUT);</span><br /><span style="font-family: "Courier New",Courier,monospace;"> attachInterrupt (1, pulse, FALLING); // attach interrupt handler</span><br /><span style="font-family: "Courier New",Courier,monospace;"> FlexiTimer2::start();</span><br /><span style="font-family: "Courier New",Courier,monospace;">}</span><br /><span style="font-family: "Courier New",Courier,monospace;">void loop() {</span><br /><span style="font-family: "Courier New",Courier,monospace;"> lcd.clear();</span><br /><span style="font-family: "Courier New",Courier,monospace;"> lcd.print("dir=");lcd.print(heading);</span><br /><span style="font-family: "Courier New",Courier,monospace;"> lcd.setCursor (8,0);</span><br /><span style="font-family: "Courier New",Courier,monospace;"> lcd.print("p=");lcd.print(period);</span><br /><span style="font-family: "Courier New",Courier,monospace;"> lcd.setCursor (0,1);</span><br /><span style="font-family: "Courier New",Courier,monospace;"> lcd.print("V2=");lcd.print(V2);</span><br /><span style="font-family: "Courier New",Courier,monospace;"> lcd.setCursor (8,1);</span><br /><span style="font-family: "Courier New",Courier,monospace;"> lcd.print("V4=");lcd.print(V4);</span><br /><span style="font-family: "Courier New",Courier,monospace;"> delay(200);</span><br /><span style="font-family: "Courier New",Courier,monospace;">} </span></b></span></blockquote>
Style-wise it could be better polished but function-wise I think it's fine.<br />
It is completely Interrupt Driven (the main loop all it does is to display the readings), it handles smoothing of the analog values, it is a perfect base for I want to do next, which is to set the Arduino as a I2C slave device, connect it to the Raspberry and set up a high-level protocol for their communication.<br />
<br />
But more on that next time!<br />
<br />
Thanks for reading,<br />
<br />
G. <br />
<br />
<br />
PS<br />
Using the NASA Masthead unit was a dog.<br />
The analog values are not stable enough, they change along with the ambient temperature and the cup rotor only creates a single pulse per revolution. This is a low cost unit and it shows. <br />
Nevertheless, if anyone is thinking of using it in a project, do drop a line, we might exchange notes!<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br /></div>
sdfzsdfgsdfsdfhttp://www.blogger.com/profile/09402169675605441952noreply@blogger.com0tag:blogger.com,1999:blog-6871815440169158188.post-2849617195599673362013-11-23T20:19:00.001+02:002013-11-24T13:13:46.426+02:00How to access the peripherals, putting it all together, current state of project<div dir="ltr" style="text-align: left;" trbidi="on">
I'll start in reverse order, on how to access the peripheral devices:<br />
<br />
To start with, the second I2C bus has to be activated as mentioned on the previous post using the following command: <br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New",Courier,monospace;">hipi-i2c e 0 1</span></blockquote>
Following that, devices can be detected on both I2C buses:<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New",Courier,monospace;"> root@akka-pc:~# i2cdetect -y 0<br /> 0 1 2 3 4 5 6 7 8 9 a b c d e f<br />00: -- -- -- -- -- -- -- -- -- -- -- -- -- <br />10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- 1e -- <br />20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- <br />30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- <br />40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- <br />50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- <br />60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- <br />70: -- -- -- -- -- -- -- -- <br />root@akka-pc:~# i2cdetect -y 1<br /> 0 1 2 3 4 5 6 7 8 9 a b c d e f<br />00: -- -- -- -- -- -- -- -- -- -- -- -- -- <br />10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- 1e -- <br />20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- <br />30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- <br />40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- -- <br />50: -- -- -- 53 -- -- -- -- -- -- -- -- -- -- -- -- <br />60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- <br />70: -- -- -- -- -- -- -- -- </span></blockquote>
The aboves shows one HMC5883L-based, triple axis magnetometer at I2C#0 (connected to P5) with I2C address 1e.<br />
Also, it shows three devices being connected on I2C#1<br />
These have as follows:<br />
device 1e: HMC5883L-based, triple axis magnetometer<br />
device 48: 4 Channel ADC, Adafruit ADS1115<br />
device 53: ADXL345-based triple axis accelerometer<br />
<br />
The headings of the two compasses can be read using the following code:<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New",Courier,monospace;">$ cat two-compasses</span></blockquote>
<blockquote>
<span style="font-family: "Courier New",Courier,monospace;">#!/usr/bin/python3<br />from i2clibraries import i2c_hmc5883l<br />hmc5883a = i2c_hmc5883l.i2c_hmc5883l(<b>1</b>)<br />hmc5883a.setContinuousMode()<br />hmc5883a.setDeclination(0,0)<br />hmc5883b = i2c_hmc5883l.i2c_hmc5883l(<b>0</b>)<br />hmc5883b.setContinuousMode()<br />hmc5883b.setDeclination(0,0)<br />print (hmc5883a.__str__())<br />print (hmc5883b.__str__())</span></blockquote>
On the above code I have highlighted the way we choose which magnetometer (i.e. on which I2C bus) we work with. <br />
Executing this code, we get these results:<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New",Courier,monospace;">$ ./two-compasses <br />Axis X: -122.36<br />Axis Y: -809.6<br />Axis Z: -160.08<br />Declination: 0 0'<br />Heading: 261 24'<br /><br />Axis X: 411.24<br />Axis Y: -168.36<br />Axis Z: 215.28<br />Declination: 0 0'<br />Heading: 337 44'</span></blockquote>
Apart of the Compasses, we also have a 3D accelerometer, which can be read using something like:<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New",Courier,monospace;"># cat accelerometer </span><br />
<span style="font-family: "Courier New",Courier,monospace;">#!/usr/bin/python3</span><br />
<span style="font-family: "Courier New",Courier,monospace;">from i2clibraries import i2c_adxl345</span><br />
<span style="font-family: "Courier New",Courier,monospace;">from time import *</span><br />
<span style="font-family: "Courier New",Courier,monospace;">adxl345 = i2c_adxl345.i2c_adxl345(1)</span><br />
<span style="font-family: "Courier New",Courier,monospace;">while True:</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> print(adxl345)</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> sleep(1)</span><br />
<span style="font-family: "Courier New",Courier,monospace;"></span></blockquote>
and running the above while moving the accelerometer, we get:<br />
<blockquote class="tr_bq">
<span style="font-family: "Courier New",Courier,monospace;"># ./accelerometer <br />X: 0.21875<br />Y: -0.625<br />Z: 0.65625<br /><br />X: -0.34375<br />Y: 0.9375<br />Z: 0.28125<br /><br />X: -0.5625<br />Y: -0.25<br />Z: -0.78125<br /><br />X: -0.03125<br />Y: 0.6875<br />Z: 1.125</span></blockquote>
In order to access these peripherals, I use the <a href="http://think-bowl.com/i2c-python-libraries-for-the-raspberry-pi/" target="_blank">Think Bowl I2C Libraries</a><br />
<br />
The third peripheral I have connected is a <a href="http://www.adafruit.com/products/1085" target="_blank">Adafruit ADS1115</a>, which can be managed using the <a href="https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code/tree/master/Adafruit_ADS1x15" target="_blank">appropriate Adafruit library</a> (more about it in a later post).<br />
<br />
So, the current status can be seen in the following photo:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzeMYJx7iFm9nvljKwcmEC7H4vp31bwfx2QbdLbC0duho_kfHC4cn-6JRNC43YRK8FnTs1Dhml-nPrN3GYIS3DnVkMSleGiulo3JU-QdP9-ebnISDSKOE1gPLEkXPMHrk3OODYJgTDGYSk/s1600/photo+1c.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzeMYJx7iFm9nvljKwcmEC7H4vp31bwfx2QbdLbC0duho_kfHC4cn-6JRNC43YRK8FnTs1Dhml-nPrN3GYIS3DnVkMSleGiulo3JU-QdP9-ebnISDSKOE1gPLEkXPMHrk3OODYJgTDGYSk/s1600/photo+1c.jpg" height="480" width="640" /></a></div>
The components shown have as follows:<br />
<ol style="text-align: left;">
<li>The Raspberry PI: This is a model B, but since on the final version Ethernet won't be needed, it might be replaced with a Model A depending the the memory resources needed for the version of software that will eventually be running. Model A is considered for power consumption reasons. More about that below, when discussing item (3)</li>
<li>This is a 12V battery. Since the outcome of this project is intended to work on my boat, I am doing all development with that in mind. </li>
<li>This a switching voltage converter, that makes the 5V Raspberry needs out of the 12V the battery produces. Being a switching regulator, it has a very high efficiency, which is very important since electrical power on board is always scarce. I have been using a very low cost and light component that is usually being used in electric RC models and it is called <a href="http://www.wattflyer.com/forums/showthread.php?t=39138" target="_blank">"Battery Eliminator Circuit"</a>. On the final release of the ShipComputer, (the one I will be use on the boat) I will possibly make use of 2 BECs, one for creating 5V out of 12V and another one for creating 3.3V out of 12V. The Raspberry will be powered from both of these, and the 5V one will also be powering the USB hub that seems to be needed. The linear voltage regulator found on Raspberry, usually responsible for up to one third of the total power consumption, will be removed as it 'll be not longer needed. </li>
<li>This is a Current Sensor based on the ACS714 Hall effect-based chip that produces a analog voltage based on the current that passes through, and its direction. When there's no current, the sensor produces a voltage of Vcc/2. This output changes by 185 mV per Amp. It will be connected to an analog input of the attached ADC and it will measure consumption and charging.</li>
<li>This is the 3-axis Accelerometer</li>
<li>ADS1115 ADC, I2C-based ADC, by Adafruit. </li>
<li>Magnetometer of bus I2C#1</li>
<li>USB Hub (need more that the 2 USBs provided)</li>
<li>USB GPS, connected to the Raspberry through the USB hub</li>
<li>Wifi USB Dongle. The system is set up as an Access Point, in order to enable connection of the tablet, on which the Primary User Interface will be running.</li>
<li>Bluetooth Dongle for connectivity to the Pebble Smart Watch, on which the secondary UI will be running</li>
<li>A splitter PCB for connecting all three I2C peripherals on the same I2C bus</li>
<li>A PCB that holds the pull-up resistors needed for I2C#0</li>
<li>The second magnetometer on I2C#0 </li>
</ol>
As of the status of the project, most of the hardware is there, along with the low level libraries needed for accessing the various devices.<br />
Some porting has to be done from Python V2 to Python V3 but Ok, it is feasible, it will be done.<br />
In all, I consider the hardware and low-level software to be in place.<br />
What is left is all host and UI software, along with much needed solutions on some more core issues, for example, the lack of accuracy by the magnetometers! I have two devices that I work in parallel and they produce reading +/- 15 degrees from one another! I will investigate the possibility of providing some form of calibration for these, we 'll see. <br />
<br />
More about the software:<br />
Concerning the host software, well, I haven't touch it yet! I have done some tests on reading the sensors but that's it.<br />
For version 1 of the host software, there are not that many things to do, there has to be a loop for reading the sensors, calculating the computed fields, store results in a DB, push metrics to the UIs etc.<br />
For the Primary UI, I am investigating the possibility of using javascript and HTML5. It's a bit tough because things like websockets are new to me but the result will be something portable and possibly extensible so it is worth the effort.<br />
As for the Secondary UI, programming the Pebble using SDK 1.12 was not that bad, and there is a new V2 SDK that came out a few days ago, it might need some reading but looks OK too.<br />
<br />
Having said that, I am now forced to put the project on hold for one or two months, which means that I will probably be back early next year.<br />
<br />
Thanks for reading!<br />
<br />
G.<br />
<br />
UPDATE:<br />
I have totally forgotten about the wind direction and speed sensor! I have access to a <a href="http://www.nasamarine.com/proddetail.php?prod=01_Mast_Head_Unit" target="_blank">Nasa Masthead Wind Sensor</a> which produces two analog values for wind direction and a pulse signal for the wind speed.<br />
I will use two ADC inputs on the ADS1115 for the wind direction and a I/O pin in interrupt mode for counting the length of the wind speed pulses (as shown <a href="http://raspi.tv/2013/how-to-use-interrupts-with-python-on-the-raspberry-pi-and-rpi-gpio" target="_blank">here</a>).<br />
I have sent a message to <a href="http://www.nasamarine.com/" target="_blank">Nasa Marine Instruments</a> asking for documentation for the sensor but haven't had a reply yet, so whoever has any info about it, please let me know!<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br /></div>
sdfzsdfgsdfsdfhttp://www.blogger.com/profile/09402169675605441952noreply@blogger.com0tag:blogger.com,1999:blog-6871815440169158188.post-36014671286557982662013-11-23T17:03:00.003+02:002014-01-23T00:13:21.661+02:00Using the second I2C bus on Raspberry PI<div dir="ltr" style="text-align: left;" trbidi="on">
Hello again!<br />
Today I am really excited because I am a big step closer to finishing the hardware part of the project.<br />
But
since I use this blog as a form of documentation, on this post I will
concentrate on how the second i2c port of the raspberry PI can be used.<br />
<br />
Just for the record, I need a second I2C bus because I want to use two compasses for which I cannot change the I2C ID.<br />
<br />
Version
1 of the Raspberry Pi Model B had I2C#0 coming out on the GPIO. The SoC
has an additional I2C bus that on Raspberry Version 1 was very hard to
bring out.<br />
<br />
Version 2 of Raspberry Model B and all Model As have I2C#1 connected on GPIO, and the I2C#0 accessible through the connector P5:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6R8JJIDhZNOM1CXvJZTJwmpkeuJ6nO3BbXaQiF99ktHbK4wuZhTUW9SZ84qFC1Yaa_2vXJ8vwwJNXGE5nvoS_WaNA_M-5JhxoxrU4NKGi5DyfQcqYi1UOAzAoHr5SXqCtjrjJ9OOEzpx7/s1600/model-a.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6R8JJIDhZNOM1CXvJZTJwmpkeuJ6nO3BbXaQiF99ktHbK4wuZhTUW9SZ84qFC1Yaa_2vXJ8vwwJNXGE5nvoS_WaNA_M-5JhxoxrU4NKGi5DyfQcqYi1UOAzAoHr5SXqCtjrjJ9OOEzpx7/s1600/model-a.JPG" height="240" width="320" /></a></div>
<div class="" style="clear: both; text-align: left;">
(this is a Model A but is the same for Model B too)</div>
<div class="" style="clear: both; text-align: left;">
The P5 connector pins are actually missing, so the easiest way of take advantage of the I2C#0 is by adding the a 2x4 block of connector pins:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEkwnulpwIBX8efPGeerBPVaIbmsjXiRDbYow7JBBQacoBwwSSyTnI-YjV5fZLtXzvfUe96HcJIwDRqTPNIxVLMU3TDCecJ863z3ydGeCQ-HWTruhPOGYeosATAhB7SYS4Ems8v4uRjPqe/s1600/photo+5b.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEkwnulpwIBX8efPGeerBPVaIbmsjXiRDbYow7JBBQacoBwwSSyTnI-YjV5fZLtXzvfUe96HcJIwDRqTPNIxVLMU3TDCecJ863z3ydGeCQ-HWTruhPOGYeosATAhB7SYS4Ems8v4uRjPqe/s1600/photo+5b.JPG" height="320" width="240" /></a></div>
Although now the connector for I2C is available, it is still unusable because there are a couple of pull-up resistors missing.</div>
<div class="" style="clear: both; text-align: left;">
</div>
<div class="" style="clear: both; text-align: left;">
One can find what is missing by comparing the schematics for I2C#0 and I2C#1 which can be found <a href="http://www.raspberrypi.org/wp-content/uploads/2012/10/Raspberry-Pi-R2.0-Schematics-Issue2.2_027.pdf" target="_blank">here:</a> </div>
<div class="" style="clear: both; text-align: left;">
Connector GPIO P1 has these resistors:</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQZh26agOFTtyCF1vTblmghxEIQ42DW2pBzQfWsPMx6XZliPPhn6h3ue2ADPiazYvbVcI54x60HHY1FuQ0t40zaVwyuaosL0I5aKBS1vPmryseNsadbg_sRZjXEVnwAh2xD2A85zl_pqVu/s1600/Screen+Shot+2013-11-23+at+12.35.24+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQZh26agOFTtyCF1vTblmghxEIQ42DW2pBzQfWsPMx6XZliPPhn6h3ue2ADPiazYvbVcI54x60HHY1FuQ0t40zaVwyuaosL0I5aKBS1vPmryseNsadbg_sRZjXEVnwAh2xD2A85zl_pqVu/s1600/Screen+Shot+2013-11-23+at+12.35.24+PM.png" height="274" width="320" /> </a></div>
<div class="separator" style="clear: both; text-align: left;">
which are missing from connector GPIO P5:</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjp54EyUCdqljDPawBXxEe-etC_s3hwpA56r60vNXyvSi4gvGjRTUaPjZbbvIj2zrhtltJup-0CDnIkOV7l3E7w25or7EB22FgvAb1ydHhqYi55SQ1r34_l4JDDLBZ8iFlZv-iIFQnQj6RN/s1600/Screen+Shot+2013-11-23+at+12.36.32+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjp54EyUCdqljDPawBXxEe-etC_s3hwpA56r60vNXyvSi4gvGjRTUaPjZbbvIj2zrhtltJup-0CDnIkOV7l3E7w25or7EB22FgvAb1ydHhqYi55SQ1r34_l4JDDLBZ8iFlZv-iIFQnQj6RN/s1600/Screen+Shot+2013-11-23+at+12.36.32+PM.png" /> </a></div>
<div class="separator" style="clear: both; text-align: left;">
So we add them, that is, add 1.8K pullup resistors to pins 3 & 4 of connector P5 (the other side of the resistors should be connected to 3.3V). The easiest way for me to do that was using an external miniature PCB, someone might want to do a permanent modification to the RaspberryPI.</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwsk1inAEc1cmJP0hTy1L8GPeKW4W_3w0QSY8cQTylCrbNqJSZq8Fhsw4GYx_lkdkghEcgKj0FzOGF9CWWc0Z0HVEVJcV8k2b5V11Wp56u5JrlfC7krH0aJzwh3A_MbBwO9qpncly6LaFp/s1600/photo+2b.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwsk1inAEc1cmJP0hTy1L8GPeKW4W_3w0QSY8cQTylCrbNqJSZq8Fhsw4GYx_lkdkghEcgKj0FzOGF9CWWc0Z0HVEVJcV8k2b5V11Wp56u5JrlfC7krH0aJzwh3A_MbBwO9qpncly6LaFp/s1600/photo+2b.JPG" height="256" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
Now the hardware bit is ready, but we still can't use the I2C#0.</div>
<div class="separator" style="clear: both; text-align: left;">
This is because the I2C functionality is an alternative to the default mode of the P5 pins, so somehow the SoC has to be told to activate I2C on these pins.</div>
<div class="separator" style="clear: both; text-align: left;">
There are quite a few ways to do that, for various reasons I decided to use the HiPi Library, as described <a href="http://raspberry.znix.com/2013/04/second-i2c-bus.html" target="_blank">here</a>. </div>
<div class="separator" style="clear: both; text-align: left;">
After installing the HiPi package (using the manual process described <a href="http://raspberry.znix.com/p/install.html" target="_blank">here</a>), the I2C#0 can be activated by issuing the command:</div>
<blockquote class="tr_bq">
<div class="separator" style="clear: both; text-align: left;">
hipi-i2c e 0 1</div>
</blockquote>
At this point we are ready to start using the second I2C bus on the Raspberry PI!<br />
<b><br /></b>
<b>REFERENCES:</b><br />
<blockquote class="tr_bq">
<a href="http://www.raspberrypi.org/wp-content/uploads/2012/04/Raspberry-Pi-Schematics-R1.0.pdf" target="_blank">Raspberry PI Version 1 Schematics</a><br />
<a href="http://www.raspberrypi.org/wp-content/uploads/2012/10/Raspberry-Pi-R2.0-Schematics-Issue2.2_027.pdf" target="_blank">Raspberry PI Version 2 Schematics</a><br />
<a href="http://raspberry.znix.com/" target="_blank">HiPi Perl Modules for Raspberry PI</a></blockquote>
<div class="" style="clear: both; text-align: left;">
</div>
<div class="" style="clear: both; text-align: left;">
<br />
<br /></div>
<br />
<br />
<div class="" style="clear: both; text-align: left;">
<br /></div>
</div>
sdfzsdfgsdfsdfhttp://www.blogger.com/profile/09402169675605441952noreply@blogger.com0tag:blogger.com,1999:blog-6871815440169158188.post-7871417117927746692013-11-20T00:44:00.003+02:002013-11-20T00:46:28.295+02:00New Pebble firmware & SDK V2 (Beta2) + minor update on project status<div dir="ltr" style="text-align: left;" trbidi="on">
Many good news!<br />
New firmware & SDK give new capabilities to the Pebble.<br />
I won't repeat what has been extensively documented elsewhere (eg https://developer.getpebble.com/2/getting-started/) I will only mention that the new firmware enables pairing the pebble to more than one hosts.<br />
That way, the Pebble can be used as Secondary UI to the "Ship Computer" while still being able to get notifications from the smart phone. <br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9n5AnLZjiZpOvhQ_tG_fTauSyYV2WiTxCHxo7_lZxfn8v44k6QVcoNv-qyG38ixgXAl2PX6bP1mse0e0wgi1ojnBfLaHTfhciDdjlNG3O7Sy_A62a6dDdQaQFxUpqWHHDYZVsY0Q5ep4S/s1600/photo+1.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9n5AnLZjiZpOvhQ_tG_fTauSyYV2WiTxCHxo7_lZxfn8v44k6QVcoNv-qyG38ixgXAl2PX6bP1mse0e0wgi1ojnBfLaHTfhciDdjlNG3O7Sy_A62a6dDdQaQFxUpqWHHDYZVsY0Q5ep4S/s1600/photo+1.JPG" height="320" width="240" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Pebble paired to 2 hosts</td></tr>
</tbody></table>
As for the project itself, the hardware part of it is almost compete.<br />
The difficult part is the software, both for reading the peripherals but also the UI.<br />
<br />
For example, on the peripherals front, the digital compass in order to be sort of accurate, it has to be either held horizontally or I have to know its angle to the horizontal plane and for that I have to use a accelerometer whose measurements I have to take into account while calculating the heading of the magnetometer.<br />
The same time, the magnetometer doesn't seem to have the accuracy i was hoping to have... I have two devices pointing at the same direction and they give slightly different readings, but the difference among the two is not constant.<br />
<br />
I am not sure of how to handle this issue, I will think of it...<br />
<br />
Back on the software, I thought, in order to avoid having to write an iPad native app, at least for the functionality I described for Version 1, instead of implementing Version 1 Primary UI as a native app, to use Javascript instead and implement it over a browser.<br />
That way it would be portable and possibly faster to develop that having the native app into the equation.<br />
<br />
Well, so I thought!<br />
<br />
In order to do what I wanted to do, I could follow two paths:<br />
<br />
1. do everything on the host, send Primary UI browser a static page, doing a meta refresh every 1 or 2 seconds. The graphs would be created statickly using gdlib (http://libgd.bitbucket.org/) or something similar.<br />
2. Do the metrics collection on the host, use javascript on the client, running a rendering process that would communicate with the metrics-gathering daemon via a TCP socket<br />
<br />
The first approach was considered too clumsy to further investigate, it would consume a lot of processing power and bandwith.<br />
The second looked a more viable alternative to the native app.<br />
<br />
So, what's the problem?<br />
Can't create sockets on Javascript! The alternative is WebSockets but this is another API I have to learn, in a language (javascript) that I have never seriously used!<br />
<br />
Anyway, whoever feels like writing some code and doesn't know what to write for, would be highly welcome!<br />
<br />
Actually I am in need of people with knowledge of:<br />
hardware design<br />
low level (register level) system programming (Python)<br />
data collection, storage (Python + SQL)<br />
Secondary UI on Pebble (C) <br />
UI Daemon possibly in Python<br />
Primary Version 1 User Interface (clocks and measurements) Javascript/HTML5<br />
Primary Version 2 User Interface (Two way communication, maps, waypoints, VMG etc) Objective C<br />
<br />
Thanks for reading this.<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br /></div>
sdfzsdfgsdfsdfhttp://www.blogger.com/profile/09402169675605441952noreply@blogger.com0tag:blogger.com,1999:blog-6871815440169158188.post-75014505847987671682013-11-09T05:35:00.002+02:002013-11-11T11:19:41.126+02:00Setting up the GPS<div dir="ltr" style="text-align: left;" trbidi="on">
Setting up the GPS<br />
<br />
I have been lucky on this.<br />
<br />
Apart from the <a href="http://www.adafruit.com/products/746">Adafruit Ultimate GPS</a> I recently purchased, I did find in my drawers a <br />
couple more:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDLd_eHOyxBt4tZmXfaorlXzugE8AxCmZIIUKFbXU9kWzg3F7Iqv3yW0l6mwMOrLHvDQlpzegWN1kJNdMV2JTLeiW-ihXNiiGPpytc63gKYoOloOXTMljvWaXdSSr2IR36nQLq5AzbuH7J/s1600/GPS.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDLd_eHOyxBt4tZmXfaorlXzugE8AxCmZIIUKFbXU9kWzg3F7Iqv3yW0l6mwMOrLHvDQlpzegWN1kJNdMV2JTLeiW-ihXNiiGPpytc63gKYoOloOXTMljvWaXdSSr2IR36nQLq5AzbuH7J/s1600/GPS.jpg" height="240" width="320" /></a></div>
As shown in this photo, apart of the Adafruit GPS, I also had a choice from a Garmin 18-5, a 5 Hz device with serial TTL output and a 1-Hz OEM USB GPS,<br />
I decided to use the USB unit because:<br />
A. since the speed -in absolute terms- I will be moving with is low, 1 GPS sample per second is more than sufficient.<br />
B. The USB GPS has a long cable, long enough to put it out of the window now that I am doing the development, something that enables the system to get a fix!<br />
<br />
Setting it up was plain simple:<br />
1. Installed the required packages:<br />
<pre class="prettyprint linenums"><span class="pln">sudo apt</span><span class="pun">-</span><span class="kwd">get</span><span class="pln"> install gpsd gpsd</span><span class="pun">-</span><span class="pln">clients python</span><span class="pun">-</span><span class="pln">gps</span></pre>
2. Associate gpsd with the physical GPS device: <br />
<pre class="prettyprint linenums"><span class="pln">sudo gpsd </span><span class="pun">/</span><span class="pln">dev</span><span class="pun">/</span><span class="pln">ttyUSB0 </span><span class="pun">-</span><span class="pln">F </span><span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">run</span><span class="pun">/</span><span class="pln">gpsd</span><span class="pun">.</span><span class="pln">sock</span></pre>
<br />
The setup was verified using the following command:<br />
<pre class="prettyprint linenums"><span class="pln">cgps </span><span class="pun">-</span><span class="pln">s</span></pre>
<br />
This produced the following result:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYUEO9rkt5wJ6JOPcR-mfr39vMZc6BhZXVMomVuTdkEHpzCAUlB92P7dXU6-pfgnQp3bpkCeEVyZtjPgK7ot__8gO1aUQkT_hFGoPDeLLzbW01VUaPQuUx8phJVwobNf18ydJXnV-pam1y/s1600/Screen+Shot+2013-11-09+at+2.21.32+AM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYUEO9rkt5wJ6JOPcR-mfr39vMZc6BhZXVMomVuTdkEHpzCAUlB92P7dXU6-pfgnQp3bpkCeEVyZtjPgK7ot__8gO1aUQkT_hFGoPDeLLzbW01VUaPQuUx8phJVwobNf18ydJXnV-pam1y/s1600/Screen+Shot+2013-11-09+at+2.21.32+AM.png" height="159" width="320" /></a></div>
Which mean that the GPS works and communicates with the Raspberry.<br />
Further tests where conducted using Python:<br />
<blockquote class="tr_bq">
<i>#!/usr/bin/python<br />import gps<br />session = gps.gps("localhost", "2947")<br />session.stream(gps.WATCH_ENABLE | gps.WATCH_NEWSTYLE)<br />while True:<br /> try:<br /> report = session.next()<br /> print report<br /> except KeyError:<br /> pass<br /> except KeyboardInterrupt:<br /> quit()<br /> except StopIteration:<br /> session = None<br /> print "GPSD has terminated"</i></blockquote>
<br />
gpsd documentation can be found at <b><span style="color: blue;"><a href="http://catb.org/gpsd/">gpsd home</a></span></b>, and a quickstart how-to can be seen <b><span style="color: blue;"><a href="http://catb.org/gpsd/client-howto.html">here</a>.</span></b><br />
At<b> <span style="color: blue;"><a href="http://catb.org/gpsd/gpsd_json.html">this document</a></span></b> one can find info on the gpsd report structure which has as follows:<br />
<br />
<table border="1" summary="TPV object"><thead>
<tr><th align="left">Name</th><th align="left">Always?</th><th align="left">Type</th><th align="left">Description</th></tr>
</thead><tbody>
<tr><td align="left">class</td><td align="left">Yes</td><td align="left">string</td><td align="left">Fixed: "TPV"</td></tr>
<tr><td align="left">tag</td><td align="left">No</td><td align="left">string</td><td align="left">Type tag associated with this GPS sentence; from an NMEA
device this is just the NMEA sentence type.</td></tr>
<tr><td align="left">device</td><td align="left">No</td><td align="left">string</td><td align="left">Name of originating device.</td></tr>
<tr><td align="left">mode</td><td align="left">Yes</td><td align="left">numeric</td><td align="left">NMEA mode: %d, 0=no mode value yet seen, 1=no fix, 2=2D, 3=3D.</td></tr>
<tr><td align="left">time</td><td align="left">No</td><td align="left">string</td><td align="left">Time/date stamp in ISO8601 format, UTC. May have a
fractional part of up to .001sec precision. May be absent if mode
is not 2 or 3.</td></tr>
<tr><td align="left">ept</td><td align="left">No</td><td align="left">numeric</td><td align="left">Estimated timestamp error (%f, seconds, 95% confidence).
Present if time is present.</td></tr>
<tr><td align="left">lat</td><td align="left">No</td><td align="left">numeric</td><td align="left">Latitude in degrees: +/- signifies West/East. Present
when mode is 2 or 3.</td></tr>
<tr><td align="left">lon</td><td align="left">No</td><td align="left">numeric</td><td align="left">Longitude in degrees: +/- signifies North/South. Present
when mode is 2 or 3.</td></tr>
<tr><td align="left">alt</td><td align="left">No</td><td align="left">numeric</td><td align="left">Altitude in meters. Present if mode is 3.</td></tr>
<tr><td align="left">epx</td><td align="left">No</td><td align="left">numeric</td><td align="left">Longitude error estimate in meters, 95% confidence. Present
if mode is 2 or 3 and DOPs can be calculated from the satellite
view.</td></tr>
<tr><td align="left">epy</td><td align="left">No</td><td align="left">numeric</td><td align="left">Latitude error estimate in meters, 95% confidence. Present
if mode is 2 or 3 and DOPs can be calculated from the satellite
view.</td></tr>
<tr><td align="left">epv</td><td align="left">No</td><td align="left">numeric</td><td align="left">Estimated vertical error in meters, 95% confidence. Present
if mode is 3 and DOPs can be calculated from the satellite
view.</td></tr>
<tr><td align="left">track</td><td align="left">No</td><td align="left">numeric</td><td align="left">Course over ground, degrees from true north.</td></tr>
<tr><td align="left">speed</td><td align="left">No</td><td align="left">numeric</td><td align="left">Speed over ground, meters per second.</td></tr>
<tr><td align="left">climb</td><td align="left">No</td><td align="left">numeric</td><td align="left">Climb (positive) or sink (negative) rate, meters per
second.</td></tr>
<tr><td align="left">epd</td><td align="left">No</td><td align="left">numeric</td><td align="left">Direction error estimate in degrees, 95% confidence.</td></tr>
<tr><td align="left">eps</td><td align="left">No</td><td align="left">numeric</td><td align="left">Speed error estinmate in meters/sec, 95% confidence.</td></tr>
<tr><td align="left">epc</td><td align="left">No</td><td align="left">numeric</td><td align="left">Climb/sink error estimate in meters/sec, 95% confidence.</td></tr>
</tbody></table>
<br />
<br />
For example, the following code<br />
<blockquote class="tr_bq">
<i>#!/usr/bin/python<br />import gps<br /># Listen on port 2947 (gpsd) of localhost<br />session = gps.gps("localhost", "2947")<br />session.stream(gps.WATCH_ENABLE | gps.WATCH_NEWSTYLE)<br /><br />while True:<br /> try:<br /> report = session.next()<br /> # Wait for a 'TPV' report <br /> if report['class'] == 'TPV':<br /> print 'fix mode:', report.mode<br /> print 'Course over ground, degrees from true north', report.track<br /> print 'Speed over ground, meters per second', report.speed<br /> print '-----------------------------------------------------------------'<br /> except KeyError:<br /> pass<br /> except KeyboardInterrupt:<br /> quit()<br /> except StopIteration:<br /> session = None<br /> print "GPSD has terminated"</i></blockquote>
<br />
produces this output:<br />
<blockquote class="tr_bq">
fix mode: 2<br />
Course over ground, degrees from true north 0.0<br />
Speed over ground, meters per second 0.0<br />
-----------------------------------------------------------------<br />
fix mode: 2<br />
Course over ground, degrees from true north 0.0<br />
Speed over ground, meters per second 0.0<br />
-----------------------------------------------------------------</blockquote>
This report says that we have 2D fix (possibly a result of not having a good view of the sky) and that we are stationary.<br />
<br />
<br />
<br />
This concludes post "Setting up the GPS".<br />
<br />
Additional details will be found in future post with title something in the line of "GPS Software"<br />
<br />
<br />
<br />
References:<br />
<a href="http://catb.org/gpsd/" target="_blank"><span style="color: blue;">GPSD Home</span></a><br />
<a href="http://catb.org/gpsd/client-howto.html" target="_blank"><span style="color: blue;">GPSD Client HOWTO</span></a><br />
<a href="http://catb.org/gpsd/gpsd_json.html" target="_blank">GPSD Result Structures</a><br />
<span style="color: blue;"><a href="http://www.aosabook.org/en/gpsd.htm">The Architecture of Open Source Applications, GPSD </a></span><br />
<span style="color: blue;"><a href="http://gpsd.berlios.de/vendor-docs/sirf/SiRF2-Leadtek.pdf">GPS Protocol Reference Manual</a></span><br />
<br />
<br />
<b>UPDATE:</b><br />
After rebooting the Raspberry PI, gpsd didn't seem to work.<br />
I did some debuging using<br />
<blockquote class="tr_bq">
gpsmon /dev/ttyUSB0 </blockquote>
This showed that hardware-wise the GPS was working.<br />
The same time gpsd daemon was running and hooked to TCP port 2947.<br />
I killed the process and started it again manually giving<br />
<blockquote class="tr_bq">
/usr/sbin/gpsd -n -F /var/run/gpsd.sock -P /var/run/gpsd.pid /dev/ttyUSB0</blockquote>
gpsd & cgps got working.<br />
Reboot caused once again the same issue. <br />
I check the default gpsd config (cat /etc/default/gpsd) but looked OK.<br />
I reconfigured the gpsd using "dpkg-reconfigure gpsd" but on reboot I had the same issue.<br />
I decided to take matters in hand, "runlevel" indicated the Raspberry was running in level 2.<br />
I deleted the S04gpsd file from /etc/rc2.d (a link to /etc/init.d/gpsd) and added the above command ("/usr/sbin/gpsd -n -F /var/run/gpsd.sock -P /var/run/gpsd.pid /dev/ttyUSB0" to the end of the /etc/rc.local file.<br />
<br />
Now the system works everytime.<br />
<br />
It's probably a quick and dirty solution but for the time being it works.<br />
<br />
The actual solution to the initial problem came by adding the -n flag ("don't wait for client connect to poll GPS") to the gpsd initialization.<br />
<br />
<b>UPDATE 2: </b><br />
few more problems with gpsd, sometimes after reboot, gpsd was running but gpsd.pid had wrong id.<br />
Quick and dirty solution by removing the line <br />
<blockquote class="tr_bq">
<i>/usr/sbin/gpsd -n -F /var/run/gpsd.sock -P /var/run/gpsd.pid /dev/ttyUSB0</i></blockquote>
and adding<br />
<blockquote class="tr_bq">
<i>pkill gpsd</i><br />
<i>service gpsd start</i></blockquote>
on the /etc/rc.local</div>
sdfzsdfgsdfsdfhttp://www.blogger.com/profile/09402169675605441952noreply@blogger.com0tag:blogger.com,1999:blog-6871815440169158188.post-50633406128301905552013-11-06T00:23:00.002+02:002013-11-08T15:26:34.427+02:00Preparing the Raspberry PI, pairing Pebble to Raspberry<div dir="ltr" style="text-align: left;" trbidi="on">
Concerning OS, I didn't give much thought on the distribution I was going to use, <a href="http://www.raspbian.org/">Raspbian </a>has been my OS of choice on Raspberry, had no reason to look elsewhere.<br />
I installed the latest release of Raspbian, updated and upgrated (apt-get update, apt-get upgrade).<br />
As media, I used a 8GB Sandisk Ultra SD and, in contrary to what I usually do, I didn't expand the root partition. Instead I created a new primary partition (3rd) and mounted it to /mnt/data using /etc/fstab.<br />
The idea is to use this partition for writing the logs. I know that this, because of the wear-leveling mechanism integrated in the SD , doesn't increase the life of the SD but nevertheless it makes the system more manageable and easier to backup.<br />
After that, I set the IP address of the ethernet interface to a static one, valid for my internal network.<br />
I also set the system hostname to "akka-pc", Akka being the name of my boat.<br />
The next thing I had to do was to make sure the SD has as a small wear as possible.<br />
<div dir="ltr" style="text-align: left;" trbidi="on">
The
SDs fail after a finite number of write cycles, and in order to ensure
longevity, these write cycles have to be kept as few as possible (actually, everything will eventually fail, the thing with SDs is that if you don't pay attention, the card might stop working after only a few months). <br />
<br />
The obvious first step was to disable SWAP. <br />
This was accomplished using the following commands:<br />
<i>sudo dphys-swapfile swapoff<br />sudo dphys-swapfile uninstall<br />sudo update-rc.d dphys-swapfile remove </i><br />
<br />
Then, I relocated the /var/log & /var/run to ram-based tmpfs filesystems and set the SD-based filesystems not to log access times, further eliminating unneeded writes and the same time increasing speed of operation.</div>
<div dir="ltr" style="text-align: left;" trbidi="on">
All this were done using the following /etc/fstab file:</div>
<div dir="ltr" style="text-align: left;" trbidi="on">
</div>
<div dir="ltr" style="text-align: left;" trbidi="on">
root@akka-pc:~# cat /etc/fstab<br />
proc /proc proc defaults 0 0<br />
/dev/mmcblk0p1 /boot vfat defaults,<b>noatime</b> 0 2<br />
/dev/mmcblk0p2 / ext4 defaults,<b>noatime</b> 0 1<br />
/dev/mmcblk0p4 /mnt/data ext4 defaults,noatime 0 1<br />
<b>none /var/run tmpfs size=1M,noatime 0 0</b><br />
<b>none /var/log tmpfs size=1M,noatime 0 0</b></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<br /></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
Since I intend to write most of the Raspbery software in Python, I went and installed the <a href="http://learn.adafruit.com/webide/">Adafruit WebIde. </a></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
Something to take a note, the Adafruit WebIDE won't run after reboot on this setup! After a bit of checking, the reason for this was because /var/log is volatile storage and there was attempt to access a file a couple of levels further down the tree, and this folder was missing after review.</div>
<div dir="ltr" style="text-align: left;" trbidi="on">
All was needed to be done was to change the location a the log file, as specified in file:<br />
/etc/redis/redis.conf </div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
Next, I added a bluetooth and a WiFi USB dongle and set the Raspberry to act as a Access Point. Info on how to do that can be found in many places for example at one of my favorite sites, <a href="http://learn.adafruit.com/setting-up-a-raspberry-pi-as-a-wifi-access-point/preparation">here!</a></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
I also set a few iptables rules and enabled IP forwarding so that the device that would get connected to the Raspberry via WiFi, will also have internet access, assuming of course that the Raspberry itself is connected to the net, something that in lab environment is done through the ethernet and on an production environment might get done using 3G connectivity. </div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<br /></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
After completing this step, I had the tablet able to connect to the Raspberry. That way, the Version 1 Primary UI software that will eventually be written, which will be running on a tablet, will have IP connectivity with the Raspberry.</div>
<br />
Next was the Bluetooth connectivity. I had to "pair" the Pebble smartwatch to the Raspberry.<br />
<div dir="ltr" style="text-align: left;" trbidi="on">
That proved to be little complicated.</div>
<div dir="ltr" style="text-align: left;" trbidi="on">
</div>
<div dir="ltr" style="text-align: left;" trbidi="on">
Eventually, I managed to complete this task using the Linux libraries <a href="https://github.com/postskolkovo/lightblue-0.4">Lightblue</a> and <a href="https://github.com/Hexxeh/libpebble">libpebble</a>. These are not specifically written for Raspberry, nevertheless it wasn;t much trouble making them work with Raspberry. </div>
<div dir="ltr" style="text-align: left;" trbidi="on">
A note of attention, if anyones tries to do the same, look closely at the dependencies, in order to set the system to work properly I had to "apt-get install" a number of packages related to bluetooth.</div>
<div dir="ltr" style="text-align: left;" trbidi="on">
</div>
<div dir="ltr" style="text-align: left;" trbidi="on">
Unfortunately, I was unable to pair the Pebble to the Raspberry sing command line. Instead I had to use the GUI utility <i>blueman-manager</i> (anyone knowing otherwise, please let me know!) </div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<br /></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
Just to remind anyone that might have forgotten, when you connect to a X capable *nix host from another host that supports X using <i>ssh</i> , if you connect using the -X flag, X-Window apps can be run on the remote terminal.</div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<br /></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
I took advantage of this in order to keep having me Raspberry setup headless (i.e. without locally connected monitor & keyboard) and still able to run the GUI program. Connecting to the Raspberry from my host using the ssh -X, I could run the GUI utility "blueman-manager" and have its window appear in my desktop:</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgA3Dw5EFj3QY1txdVVTDrbTeZRZNUgRtJQWsaFVgsdTTlAsk2dHY9JgPXh_Gc0UmB6WMLsL-ioBUb_vnhaAPl6IntS_yInJsWVhtjsOhw9N2QHPZ6MEr6HRmVXqWC8fCKkD7XxnP4Gqv69/s1600/Screen+Shot+2013-11-08+at+12.41.51+AM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgA3Dw5EFj3QY1txdVVTDrbTeZRZNUgRtJQWsaFVgsdTTlAsk2dHY9JgPXh_Gc0UmB6WMLsL-ioBUb_vnhaAPl6IntS_yInJsWVhtjsOhw9N2QHPZ6MEr6HRmVXqWC8fCKkD7XxnP4Gqv69/s1600/Screen+Shot+2013-11-08+at+12.41.51+AM.png" height="252" width="320" /></a></div>
(Yes, I am working on a Mac!)<br />
As you can see. the Pebble is connected to the Raspberry and the Raspberry thinks Pebble is a pager!<br />
<br />
After pairing, on the bluetooth menu the Pebble shows this info:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjm_ms2nTCC9jGpZzyH8Me38PK9Sy_cBiW4lcgexgyZHkQIZhReWcdAv6cbnqpDf29S43JE4gnFhEUYRoGdldwAjWDCI3V5-EeWg_2-0oOmZV4bPYjQKAgg0DqGbxAb0o83xY8_OSbCr_2-/s1600/pebble.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjm_ms2nTCC9jGpZzyH8Me38PK9Sy_cBiW4lcgexgyZHkQIZhReWcdAv6cbnqpDf29S43JE4gnFhEUYRoGdldwAjWDCI3V5-EeWg_2-0oOmZV4bPYjQKAgg0DqGbxAb0o83xY8_OSbCr_2-/s1600/pebble.JPG" height="267" width="320" /></a></div>
It show that has been paired to the Raspberry which is named akka-pc. The funny thing is Pebble thinks akka-pc is a phone but this doesn't have any negative effects to the communication link.<br />
<br />
Using the libpebble library, we can "ping" the pebble from the Raspberry, as shown in this screenshot:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDrMgpQMFLkhC7304-tXH0KNHZ2iXU7xrU_n5zKvY8gQ57SWgu1YkOH9VD-T_LbjHrdqEj0S3wD3t9V5uxrI8MRn49UKeX9cL_0nxgCfH71HIqfudJlqK4yWUIWhGs3FzWJMY5yEnk9mgI/s1600/Screen+Shot+2013-11-08+at+1.09.17+AM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDrMgpQMFLkhC7304-tXH0KNHZ2iXU7xrU_n5zKvY8gQ57SWgu1YkOH9VD-T_LbjHrdqEj0S3wD3t9V5uxrI8MRn49UKeX9cL_0nxgCfH71HIqfudJlqK4yWUIWhGs3FzWJMY5yEnk9mgI/s1600/Screen+Shot+2013-11-08+at+1.09.17+AM.png" height="289" width="640" /></a></div>
After issuing this command, the pebble displays:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9dUppw8X9sZGJP4SRqiCoC01MP0iVAB5xc3_HIJu0lJ7LNCeJ7fNiNA6l44QHtpa6moVX-vkW7O_5LCWkLnAGABXNeH4wKe92Zvju4AUVrfggQXLBFuYtJonNlUqpyLWAmEWhpLN0SGH2/s1600/photo.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9dUppw8X9sZGJP4SRqiCoC01MP0iVAB5xc3_HIJu0lJ7LNCeJ7fNiNA6l44QHtpa6moVX-vkW7O_5LCWkLnAGABXNeH4wKe92Zvju4AUVrfggQXLBFuYtJonNlUqpyLWAmEWhpLN0SGH2/s1600/photo.JPG" height="320" width="240" /></a></div>
Which means that we have communication with the Pebble watch!.<br />
<br />
<br />
So, the UI front end devices, the tablet through use of WiFi and the Pebble through use of BluTooth have been connected to the Ship Computer. All is left is to connect the sensors and write the software (sounds easier than what it is...)<br />
<br />
More on the next post!<br />
<br />
Thanks for reading,<br />
<br />
G.<br />
<br />
<div dir="ltr" style="text-align: left;" trbidi="on">
<br /></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<br /></div>
</div>
sdfzsdfgsdfsdfhttp://www.blogger.com/profile/09402169675605441952noreply@blogger.com0tag:blogger.com,1999:blog-6871815440169158188.post-38675811700947848532013-11-05T18:56:00.002+02:002013-11-05T19:01:06.693+02:00Hardware Design, optional modules<div dir="ltr" style="text-align: left;" trbidi="on">
Well, these are not going to be optional, they will be installed from day 0. It is more that the use of them is for providing lesser importance services, that is, things someone can live without.<br />
But since someone can live without all of this ship computer, this is not much of a distinction, is it!<br />
<br />
Back to the subject, the "optional" modules that will be used from day 1, have as follows:<br />
<br />
1. <b>Barometric Sensor </b>(BMP085)<b><br /></b><br />
This one:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://i.ebayimg.com/t/New-GY-65-BMP085-Digital-Barometric-Pressure-Sensor-Module-Board-For-Arduino-/00/s/NTAwWDUwMA==/z/GGIAAOxy8HlSdJU8/$(KGrHqYOKpMFJzd!6-rjBSdJU8Y!0Q~~60_12.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="http://i.ebayimg.com/t/New-GY-65-BMP085-Digital-Barometric-Pressure-Sensor-Module-Board-For-Arduino-/00/s/NTAwWDUwMA==/z/GGIAAOxy8HlSdJU8/$(KGrHqYOKpMFJzd!6-rjBSdJU8Y!0Q~~60_12.JPG" width="200" /></a></div>
This is an I2C device and as such, it will be connected the same way the magnetometers are.<br />
Obviously, this will be used for providing Atmospheric Pressure and the UI will also have a graph of the atmospheric pressure of the last 24 hours.<br />
<br />
2. <b>Accelerometer</b> (ADXL345-based)<br />
This one:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://i.ebayimg.com/t/1pcs-New-ADXL345-3-Axis-Digital-Acceleration-Of-Gravity-Tilt-Module-For-Arduino-/00/s/NTAwWDUwMA==/z/4pgAAOxy~ilSOVgX/$T2eC16F,!ycFId,8m!kVBSOVg(edK!~~60_12.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="http://i.ebayimg.com/t/1pcs-New-ADXL345-3-Axis-Digital-Acceleration-Of-Gravity-Tilt-Module-For-Arduino-/00/s/NTAwWDUwMA==/z/4pgAAOxy~ilSOVgX/$T2eC16F,!ycFId,8m!kVBSOVg(edK!~~60_12.JPG" width="200" /></a></div>
I2C-based. Will be used for logging of the sea condition. It's a bit of a gimmick but the readings could also be used as inclinometer!<br />
<br />
<br />
3. <b>Noise Sensor</b> <br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://thumbs.ebaystatic.com/d/l180/pict/300975427801_1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://thumbs.ebaystatic.com/d/l180/pict/300975427801_1.jpg" /></a></div>
<br />
This will be placed under the cockpit, to the left side of the boat, as close as possible to where the outboard is fixed. That way, there's going to be a engine run-hours log! (I might add tachometer functionality at a later stage).<br />
<br />
4. <b>Ampere Sensor</b><br />
The whole system relies on a single 12V battery for operation. I have a solar panet and charger, by using a Ampere Sensor connected straight to the battery, I will monitor charging and discharging.<br />
The sensor that will be used is this one:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://thumbs4.ebaystatic.com/d/l225/m/mR_JYUHQ_KP15Ez7KeOBwVw.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://thumbs4.ebaystatic.com/d/l225/m/mR_JYUHQ_KP15Ez7KeOBwVw.jpg" /></a></div>
This sensor has an analog output, which has the value VCC/2 when there is no current flowing, and it changes 185mV per Ampere flowing plus or minus the 0 Amp voltage depending on the direction of the current.<br />
That way, I can have an indication of charging or discharging of the battery and the amperage of the current.<br />
This sensor will by connected to the I2C ADC board that was mentioned on the previous post.<br />
Now that I am to it, and since there are 5 analog unused inputs, I might use an input (through a voltage divider) to measure battery voltage.<br />
<br />
That's it about the additional hardware, on the next post I will provide descriptions of system operation, both for version 1 and version 2 of software.<br />
<br />
Regards!<br />
<br /></div>
sdfzsdfgsdfsdfhttp://www.blogger.com/profile/09402169675605441952noreply@blogger.com0tag:blogger.com,1999:blog-6871815440169158188.post-85899143722118187262013-11-05T11:41:00.004+02:002013-11-24T13:43:40.120+02:00Hardware Design, essential modules.<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
I will be using Raspberry PI's I2C interfaces for connecting the modules.<br />
The hardware that I will be using has as follows:<br />
<br />
1. Raspberry PI Model B, Version 2.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://cdn3.pcadvisor.co.uk/cmsdata/features/3405229/Raspberry_Pi.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://cdn3.pcadvisor.co.uk/cmsdata/features/3405229/Raspberry_Pi.jpg" height="223" width="320" /></a></div>
<br />
Since Ethernet connectivity is not needed and in order to minimize power consumption, model A could be used in field. That said, during development and testing, model B will be used.<br />
<br />
2. The digital Compasses will be based to a HMC5883L Triple Axis Compass Magnetometer Sensor Module:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://i.ebayimg.com/t/HMC5883L-Triple-Axis-Compass-Magnetometer-Sensor-Module-3V-5V-For-Ras-Pi-Arduino-/00/s/NTAwWDUwMA==/z/SoEAAOxyfpJSVgTn/$(KGrHqJHJCwFDOjQ7odVBSVgTm2wI!~~60_12.JPG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://i.ebayimg.com/t/HMC5883L-Triple-Axis-Compass-Magnetometer-Sensor-Module-3V-5V-For-Ras-Pi-Arduino-/00/s/NTAwWDUwMA==/z/SoEAAOxyfpJSVgTn/$(KGrHqJHJCwFDOjQ7odVBSVgTm2wI!~~60_12.JPG" height="200" width="200" /></a><a href="http://i.ebayimg.com/t/HMC5883L-Triple-Axis-Compass-Magnetometer-Sensor-Module-3V-5V-For-Ras-Pi-Arduino-/00/s/NTAwWDUwMA==/z/T48AAOxy2d9SVgTo/$(KGrHqF,!qsFI+PH3yPnBSVgTn4qKg~~60_12.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://i.ebayimg.com/t/HMC5883L-Triple-Axis-Compass-Magnetometer-Sensor-Module-3V-5V-For-Ras-Pi-Arduino-/00/s/NTAwWDUwMA==/z/T48AAOxy2d9SVgTo/$(KGrHqF,!qsFI+PH3yPnBSVgTn4qKg~~60_12.JPG" height="200" width="200" /></a></div>
<br />
This module is I2C based.<br />
<a href="http://en.wikipedia.org/wiki/I%C2%B2C">I2C bus</a> enables multiple devices to get connected to the master device (in this case the Raspberry PI), as shown in the following image:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://upload.wikimedia.org/wikipedia/commons/thumb/3/3e/I2C.svg/350px-I2C.svg.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://upload.wikimedia.org/wikipedia/commons/thumb/3/3e/I2C.svg/350px-I2C.svg.png" height="113" width="320" /></a></div>
The I2C devices have a 7-bit address so there can be up to 127 interconnected devices in a single bus, as long as these devices have different addresses.<br />
<br />
The problem is that on these devices I cannot change the address, and I need to connect 2 of them!<br />
<br />
Luckily, Raspberry PI Model B V2 (and any Model A) has available a second I2C bus, as shown in the <a href="http://www.raspberrypi.org/wp-content/uploads/2012/10/Raspberry-Pi-R2.0-Schematics-Issue2.2_027.pdf">Raspbery Schematics</a> and described <a href="http://raspberrypi.znix.com/hipidocs/topic_i2cbus_2.htm">here.</a><br />
<br />
So the simple solution is to connect each of the magnetometers to a different I2C bus (problem solved!).<br />
<br />
3. The existing apparent wind direction indicator produces two analogue values. In order to read them I will use an I2O-based A-to-D converter, probably this one:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.pichips.co.uk/index.php/P011_ADC"><img alt="http://www.pichips.co.uk/index.php/P011_ADC" border="0" src="http://www.byvac.com/images/Converters/p011/top_500px.jpg" height="200" width="178" /></a></div>
<br />
Information on using and programming this module are shown <a href="http://www.pichips.co.uk/index.php/P011_ADC">here.</a><br />
This is a 8 port A/D converter, for the apparent wind direction I will be using 2 (6 left, one will be used for power consumption measurement, see later!)<br />
The relation between this values and the wind direction, will be mapped manually, by means of testing.<br />
(UPDATE: I bought one of the above but couldn't make it work, so I opted for using a Adafruit ADS1115 instead. The <a href="http://www.pichips.co.uk/index.php/P011_ADC" target="_blank">Pi Chips PO11 ADC</a> not working could be of my fault, I will investigate whenever I find time to do so...) <br />
<br />
4. The apparent wind speed is measured by the wind cup rotor that produces a number of pulses per revolution. I intend to feed these signal to a I/O port (via a voltage divider) and use interrupts in order to measure the width of the pulse without wasting precious CPU cycles on the Raspberry.<br />
The actual way to do it is described <a href="http://raspi.tv/2013/how-to-use-interrupts-with-python-on-the-raspberry-pi-and-rpi-gpio">here</a>.<br />
<br />
<br />
5. The last essential module is a GPS that will communicate with the Raspberry through the Serial port.<br />
I have bought <a href="http://www.adafruit.com/products/746">this SUPERB GPS</a> module: <br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.adafruit.com/images/medium/746_MED.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://www.adafruit.com/images/medium/746_MED.jpg" height="153" width="200" /></a></div>
It's so good I will probably keep it for a project that a 10Hz refresh would be crucial, Instead I will probably use a TTL version of the Garmin 18-5, that has been left from behind a previous project some years ago:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://i.pgcdn.com/pi/7/56/99/75699404_260.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://i.pgcdn.com/pi/7/56/99/75699404_260.jpg" /></a></div>
The serial connection on the RPi is described <a href="http://elinux.org/RPi_Serial_Connection">here</a>.<br />
Everything needed for connecting the GPS, programming it and using it can be found <a href="http://learn.adafruit.com/adafruit-ultimate-gps-on-the-raspberry-pi/setting-everything-up">here</a> (Thanks Adafruit for everything!) <br />
<br />
This concludes the description of the essential modules. <br />
<br />
<br />
<br />
<br />
<br />
<br />
<br /></div>
sdfzsdfgsdfsdfhttp://www.blogger.com/profile/09402169675605441952noreply@blogger.com0tag:blogger.com,1999:blog-6871815440169158188.post-7429356765075213172013-11-05T02:08:00.000+02:002013-11-24T13:36:32.010+02:00Ship Computer V1, Initial Hardware Design <div dir="ltr" style="text-align: left;" trbidi="on">
I will be using a <a href="http://www.raspberrypi.org/faqs">Raspberry PI</a> as the heart of the system.<br />
In order to have a working system, we need various readings, and have the corresponding sensors connected to the PI<br />
<br />
The compulsory sensors/readings have as follows:<br />
<br />
1. Magnetometer (Compass Sensor) for indicating the boat magnetic heading<br />
2. Magnetometer for the mast in order to calculate mast rotation.<br />
3. Existing apparent wind direction indicator, interfaced to Raspberry PI<br />
4. Existing wind speed indicator, interfaced to Raspberry PI<br />
5. GPS unit, for calculating Speed Over Ground (SoG) & Course over Ground (CoG) etc<br />
<br />
These measurements would be logged to a database.<br />
<br />
Using these measurements, the system would also be able to calculate the following:<br />
<br />
1. <b>Apparent wind direction</b> using the mast rotation (the difference of the two magnetometers, one on the boat and the other on the mast) and the data from the apparent wind direction indicator.<br />
<br />
2. <b>Real Wind Direction</b> and <b>Real Wind Speed</b> using data from GPS (SoG & CoG)<br />
<br />
3. <b>Leeway angle</b> (from boat magnetic heading and CoG)<br />
<br />
Additional but not critical sensors that can be added in version 1 of the ship computer could be:<br />
<br />
1. Barometric Sensor for logging atmospheric pressure<br />
2. 3D accelerometer for logging sea conditions<br />
3. Current Sensor Module, that will be used for logging of battery charging and power consumption.<br />
<br />
<br />
<br /></div>
sdfzsdfgsdfsdfhttp://www.blogger.com/profile/09402169675605441952noreply@blogger.com0tag:blogger.com,1999:blog-6871815440169158188.post-88712196997620551142013-11-05T01:59:00.002+02:002013-11-24T13:29:54.392+02:00Ship Computer Requirements, Software Versions and functionality<div dir="ltr" style="text-align: left;" trbidi="on">
OK, on my previous post I tried to sum up the situation.<br />
Here, I will describe my needs, what I want from a ship computer.<br />
In the next couple of posts I will describe the design, and possibly some draft of the implementation.<br />
<br />
So, what I need.<br />
<br />
to start with, I need to have <b>indication of apparent wind angle</b>. Now, one might thing that this is rather entry-level requirement, why do I have to create a custom device in order to have this indication? simply because I have a rotating mast!<br />
<br />
the next obvious requirement is to have <b>apparent wind speed</b> (Kn).<br />
This should be straightforward, at least when the wind cups rotor works!.<br />
<br />
Then I want to have <b>magnetic heading</b> and <b>course (GPS) heading, </b>along with <b>Speed Over Ground</b>.<br />
<br />
Having this measurements, it is easy to calculate <b>True Wind Speed</b>, <b>True Wind Angle</b> and <b>leeway.</b><br />
<br />
More functionality and measurements will be added in subsequent development cycles.<br />
<br />
To sum it up, the basic info I want to have, are as follows:<br />
<br />
1. Apparent Wind Speed<br />
2. Apparent Wind Angle<br />
3. True Wind Speed<br />
4. True Wind Angle<br />
5. Speed over ground<br />
6. Heading<br />
7. Course over Ground<br />
8. Leeway angle (=heading-CoG)<br />
<br />
I want to have realtime update for these as well as logs. <br />
<br />
This is for version 1 of the software.<br />
For version 2, I will provide mechanism for uploading route and waypoints so that I can have VMG and ETA calculated in real time.<br />
<br />
The ship computer will be headless.<br />
It will be equipped with 2 Interfaces, a WiFi setup as Access Point, and a Bluetooth.<br />
A third interface could be added, that of a GSM/GPR/3G usb modem, in which case the Ship Computer when within 3G/GSM range, could provide Internet Access for all onboard and the same time push on a land-locked server, info on it's whereabouts and environment, providing means of fleet management (this functionality will come on Version 3 of the software).<br />
<br />
In all software versions, the UI will be divided in Primary UI and Secondary UI.<br />
<br />
The <b>PRIMARY</b> User Interface will run on a tablet (an iPad on version 1, might use android for subsequent versions).<br />
Through the Primary User Interface, the Ship Computer will:<br />
<b>In Software Version 1</b> report to the user all values, either collected or calculated. Early version of the V1 UI could be made up as a web page created by a apache server running on the ship computer, but eventually, Version 1 UI should be a native tablet application with lifelike instruments, animated needles, etc. Version 1 UI shouldn't need two way communication, the information flow should be only from the Ship Computer (the server) to the Version 1 UI (the client).<br />
<br />
<b>Software Version 2 UI</b> will be a native application built on Version 1 but will additionally provide:<br />
<ul style="text-align: left;">
<li>MapView, that will enable route creation.</li>
<li>Ability to upload route(s) to Ship Computer</li>
<li>Ability to activate specific route</li>
<li>Ability to show on map current position along with heading</li>
</ul>
Needless to say, the virtual instruments should be visible or readily available.<br />
<br />
In<b> Software Version 3,</b> the UI should be almost identical to V2, the main difference being on the software running on the ship computer itself that should be able to send regular notifications with location and other critical information (heading, speed, sea condition (see the 3D accelerometer, later in the descriptions) etc. Also V3 of the software would need server-side software for collecting these info and for presenting them to users (users could be from your mom that wants to know you are sailing safe, to the yacht charter administration office that needs to know your whereabouts in order to better assist if required)<br />
<br />
I have started talking on the Primary UI and ended up on the V3 Server-Side software!<br />
<br />
So let's go back to the UI!<br />
As said before, there's going to be a SECONDARY UI too.<br />
This will be a one way (ship computer to device) communication, that will provide quick notification on major metrics, eg Speed Over Ground (SoG), Course Heading, Wind, etc.<br />
On VERSION 2 of Secondary UI there's also going to be VMG, Distance to next Waypoint, ETA to Next Waypoint, ETA to Finish. etc.<br />
<br />
I have decided to implement the SECONDARY UI on a PEBBLE watch:<br />
<div>
<div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://cdn1.appleinsider.com/pebble-130109-1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://cdn1.appleinsider.com/pebble-130109-1.jpg" height="130" width="320" /></a></div>
The <a href="https://getpebble.com/">Pebble smartwatch</a> is a fully programmable device (the SDK is freely available for download) and in contrast to most of the other SmartWatches or GPS Watches, it doesn't try to do all by itself, it doesn't even have a GPS!.<br />
Instead, being programmable, it can communicate with a master device (server, smartphone etc) and get functionality through the other device's mechanisms.<br />
It is slim, light, with a great paperwhite display, it's a breath of fresh air! (check out reviews on the net, eg <a href="http://www.theverge.com/2013/1/28/3924904/pebble-smartwatch-review">this one</a>).<br />
<br />
For the secondary UI to work, the Pebble should be paired over bluetooth with the Ship Computer.</div>
<div>
</div>
<div>
</div>
<div>
</div>
<div>
The secondary UI will word independantly of the Primary UI, that is, the tablet can be turned off, run out of battery, fall in the sea or whatever, the Secondary UI will still work.</div>
<div>
(just for the record, my initial design was with the Pebbled paired on the tablet, that might have been easier to implement but the Secondary UI would be tied up to the Primary. Instead of doing so, I added a bluetooth dongle on the Raspberry PI and set up communication between Raspberry and Pebble using <a href="https://github.com/Hexxeh/libpebble">libpebble</a>, a library for OSX and linux, which I installed on Raspberry.)</div>
<div>
</div>
<div>
Anyway, enough said, will provide all info on the solution presentation on a later post. </div>
<div>
</div>
<div>
</div>
<div>
</div>
<div>
</div>
<div>
</div>
<div>
<br /></div>
</div>
</div>
sdfzsdfgsdfsdfhttp://www.blogger.com/profile/09402169675605441952noreply@blogger.com0tag:blogger.com,1999:blog-6871815440169158188.post-81971266535492952222013-11-05T01:41:00.001+02:002013-11-24T13:27:12.728+02:00The Ship Computer, intro<div dir="ltr" style="text-align: left;" trbidi="on">
Hi all!<br />
<br />
I set up this blog in order to keep notes on the development of what I call "the Ship Computer"<br />
<br />
Some background notes first:<br />
<br />
I have a Corsair F24 MKII.<br />
This is a small trimaran, a pocket cruiser and (in other parts of the world) a racer.<br />
It is this one:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-Dky63AbxzHs/Um7ghpRaivI/AAAAAAAAEDY/ktsU1SM2q6s/w1192-h670-no/DSC09133.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-Dky63AbxzHs/Um7ghpRaivI/AAAAAAAAEDY/ktsU1SM2q6s/w1192-h670-no/DSC09133.JPG" height="223" width="400" /></a></div>
<br />
<br />
It's great fun to sail, on the proper conditions it is much faster than what you would expect from a normal boat (i.e. monohull) of that size, and because of the nets, it has enough room to be used as a summer cruiser, sort of sailing camping that is, luxuries are what you would expect when backpack camping in the mountains. That is, the bare essentials and possibly a bit less than that!<br />
<br />
Now, the boat has a rotating mast that is supposed to reduce drag and help with the mainsail shape on the luff. As a side effect, causes wind indicator to go bananas.<br />
<br />
The same time, the instruments on board are not sufficient.<br />
<br />
I have a GPS-Plotter that has north England and Scotland on rom. Living in Athens and sailing in Saronic gulf, the plotter is of not much use to me.<br />
The GPS itself, without the plotter, has a 20-year old UI. It used to be nice if all you wanted was to get the current coordinates and plot it in a normal (paper!) map, but who does this nowadays (I don't...), adding waypoints and marking them is a total pain, and hence I tend to keep it switched off.<br />
The wind instrument, a low-budget <a href="http://www.nasamarine.com/proddetail.php?prod=Clipper_Wind">"NASA Clipper"</a> is, as I said, of no use for showing wind direction and lately is also failing to show the wind speed, sometime this winter I'll take down the mast and check the transducer, hopefully it won't need replacing.<br />
<br />
The "instrument" I use most onboard is my iPad with Navionics Marine:Europe HD app, placed in a waterproof(-ish) case.<br />
<br />
From time to time, I also use a GPS-equipped watch (I had a Garmin 305 but it proved to be too fragile and I replaced it with a Sunnto Ambit) that I use for track recording and instant speed monitoring.<br />
<br />
For electricity I have a single 12V battery, a 120W (nominal) semi-flexible solar panel and in case of emergency, the battery can by charged through the outboard that has a 60W charging coil.<br />
<br />
Since I have been sailing mostly shorthanded (double-handed most of the time) I am also, when weather permits, using a Simrad tiller autopilot.<br />
<br />
To make the long story short, I am not happy with the instruments I 've got.<br />
<br />
I guess, I could go out and search for the instruments that fit my requirements. This has two disadvantages: 1. Cost 2. I have specific ideas on what I want and and I feel no matter how much money I spend, I won't be satisfied with the result.<br />
<br />
<br />
So, I decided to design and build my own "Ship Computer".<br />
<br />
Simple as that.<br />
<br />
More on the next post...<br />
<br /></div>
sdfzsdfgsdfsdfhttp://www.blogger.com/profile/09402169675605441952noreply@blogger.com1