tag:blogger.com,1999:blog-54519318716912931212024-03-21T14:33:35.485+00:00Random Stuff of ChrisA blog for recording some of my miscellaneous projects on programming, home automation, wearable computing etc.Unknownnoreply@blogger.comBlogger13125tag:blogger.com,1999:blog-5451931871691293121.post-66198271323377610802013-12-24T18:09:00.000+00:002014-01-26T17:57:10.340+00:00Tardis lake in South Wales?Stumbled across this Doctor Who easter egg in Google Maps and thought I'd share.<br />
<br />
<br />
<iframe allowfullscreen="" frameborder="0" height="480" src="//www.youtube.com/embed/wVKoTufWYOI?rel=0" width="640"></iframe>
<br />
<br />
Or if you prefer to have a look directly in Google Maps...<br />
<br />
<iframe frameborder="0" height="350" marginheight="0" marginwidth="0" scrolling="no" src="https://maps.google.co.uk/?ie=UTF8&ll=51.731354,-3.383521&spn=0.004519,0.010643&t=m&z=17&output=embed" width="425"></iframe><br />
<small><a href="https://maps.google.co.uk/?ie=UTF8&ll=51.731354,-3.383521&spn=0.004519,0.010643&t=m&z=17&source=embed" style="color: blue; text-align: left;">View Larger Map</a></small>
chrishttp://www.blogger.com/profile/08639640522185430373noreply@blogger.com0tag:blogger.com,1999:blog-5451931871691293121.post-65324314206982095322013-07-28T13:52:00.001+01:002013-07-28T13:52:22.431+01:00Apple TV and F&H TV Remote Control with ArduinoOne of the things I've been wanting to get working for a while is to 'script' some TV Infra-Red commands so that with one button I could make the TV turn on and switch to a certain channel, or to switch to HDMI and turn on the Apple TV. You can buy devices that will do this, but as usual if you build it yourself then you have much more flexibility over what you can do in the future. These are the two remotes I need to automate (an F&H TV remote, and an Apple TV):<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLRkCu67pKaUbVZD73TXTuiGiYsqlJGBSa5SSf_zlhC9hE7zzAoXoIHKUDjVcn81H6Pd_3gbPCcdjCz8GQyCGbzGZa60R0Spcd-uEhgEVd1O5RW0D_vd5hJwZ0uUPczRb2R3HgsukXHaUV/s1600/IMG_0010.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLRkCu67pKaUbVZD73TXTuiGiYsqlJGBSa5SSf_zlhC9hE7zzAoXoIHKUDjVcn81H6Pd_3gbPCcdjCz8GQyCGbzGZa60R0Spcd-uEhgEVd1O5RW0D_vd5hJwZ0uUPczRb2R3HgsukXHaUV/s1600/IMG_0010.JPG" height="240" width="320" /></a></div>
<br />
<br />
There are two stages to this: one is to record the IR signals, the other is to then replay these signals. Fortunately both of these are made very easy using existing libraries. <a href="http://www.righto.com/" target="_blank">Ken Sherriff's blog</a> has information about the <a href="http://www.righto.com/2009/08/multi-protocol-infrared-remote-library.html" target="_blank">Multi-Protocol Infrared Remote Library for the Arduino</a>. I'm not going to repeat the information here, because the blog post is well written and I just used a very slightly modified version of the IRsend and IRrecv scripts in his examples.<br />
<br />
With the IRrecv script you can record and decode the IR signals from an existing remote. Basically you need to:<br />
<br />
- Install the library<br />
- Use IRrecvDump sketch from the examples<br />
- Use the Serial Monitor in the Arduino IDE to monitor the output of the Arduino<br />
- Note the hexadecimal codes for the remote<br />
<br />
For example, this video shows the recording of commands from the Apple TV Remote:<br />
<br />
<iframe allowfullscreen="" frameborder="0" height="480" src="//www.youtube.com/embed/WzxIVK33bg4?rel=0" width="640"></iframe><span id="goog_125078146"></span>
<br />
<br />
This was then performed for selected remote control button presses on the F&H TV and the Apple TV. Some of the identified codes are below:<br />
<br />
<b>F&H Codes</b><br />
<b><br /></b>
Power: Decoded NEC: 20DF10EF (32 bits)<br />
<div>
Mute: Decoded NEC: 20DF906F (32 bits)</div>
<div>
Up: Decoded NEC: 20DF02FD (32 bits)</div>
<div>
Down: Decoded NEC: 20DF827D (32 bits)</div>
<div>
Left: Decoded NEC: 20DFE01F (32 bits)</div>
<div>
Right: Decoded NEC: 20DF609F (32 bits)</div>
<div>
OK: Decoded NEC: 20DF22DD (32 bits)</div>
<div>
Input: Decoded NEC: 20DFD02F (32 bits)</div>
<div>
TV: Decoded NEC: 20DF0AF5 (32 bits)</div>
<br />
<b>Apple TV Remote Codes</b><br />
<br />
Up: Decoded NEC: 77E15057 (32 bits)<br />
<div>
Down: Decoded NEC: 77E13057 (32 bits)</div>
<div>
Left: Decoded NEC: 77E19057 (32 bits)</div>
<div>
Right: Decoded NEC: 77E16057 (32 bits)</div>
<div>
Centre button: Decoded NEC: 77E13A57 (32 bits)</div>
<div>
Menu: Decoded NEC: 77E1C057 (32 bits)</div>
<div>
Play/Pause: Decoded NEC: 77E1FA57 (32 bits)</div>
<div>
<br /></div>
<br />
You can then modify the IRsend Example to send the particular codes for your TV. You need to call a specific function in the library for the "type" of remote, e.g. NEC, and then pass the hexadecimal for the actual code. I've been making specific functions for particular IR codes, e.g. power_tv() in this case:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">void power_tv(){</span><br />
<span style="font-family: Courier New, Courier, monospace;"> irsend.sendNEC(0x20DF10EF, 32); </span><br />
<span style="font-family: Courier New, Courier, monospace;">}</span><br />
<div>
<br /></div>
... but I think this was a bad idea and I'll probably replace it with something more generic at some point.<br />
<br />
What is slightly annoying is that the TV doesn't have a single button way of changing to a particular HDMI input. Therefore you have to do a really stupid hack where you activate the input menu and scroll down a specified number of times to get to HDMI 1 input!<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSTY3d-7nGjW361m3Xvsrv7ftDhQRs6hNIgS71tTUuOkPJY_X5BQDMqXoaVyCz9UVZbJgijX7L0g500igEl_LANw5dc3cFkdHw0ZzO-8odrb2ttY3zBSsTa5X81OJVx7DJpMgh9qLvI3DD/s1600/IMG_0013.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSTY3d-7nGjW361m3Xvsrv7ftDhQRs6hNIgS71tTUuOkPJY_X5BQDMqXoaVyCz9UVZbJgijX7L0g500igEl_LANw5dc3cFkdHw0ZzO-8odrb2ttY3zBSsTa5X81OJVx7DJpMgh9qLvI3DD/s1600/IMG_0013.JPG" height="240" width="320" /></a></div>
<br />
<br />
The code for doing this is:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">void switch_to_hdmi1()</span><br />
<span style="font-family: Courier New, Courier, monospace;">{</span><br />
<span style="font-family: Courier New, Courier, monospace;"> irsend.sendNEC(0x20DF0AF5, 32); // switch to TV (not DTV)</span><br />
<span style="font-family: Courier New, Courier, monospace;"> delay(5500);</span><br />
<span style="font-family: Courier New, Courier, monospace;"> irsend.sendNEC(0x20DFD02F, 32); // input menu</span><br />
<span style="font-family: Courier New, Courier, monospace;"> delay(800);</span><br />
<span style="font-family: Courier New, Courier, monospace;"> for(int i=0;i<5;i++) // go down the menu 5 times</span><br />
<span style="font-family: Courier New, Courier, monospace;"> {</span><br />
<span style="font-family: Courier New, Courier, monospace;"> irsend.sendNEC(0x20DF827D, 32); // down</span><br />
<span style="font-family: Courier New, Courier, monospace;"> delay(400);</span><br />
<span style="font-family: Courier New, Courier, monospace;"> }</span><br />
<span style="font-family: Courier New, Courier, monospace;">}</span><br />
<br />
So I can now get the Arduino to switch to particular channels on the TV, switch on the Apple TV and navigate menus. This is also integrated with the rest of my home automation system.<br />
<br />
This was the Arduino setup during the development phase... it is slightly more discrete now :)<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiqoQP0AEki23QFLDnVBhEvfUJa9sjcFt4d7L2UneYDKKUehE1GdthOdw6PzRjKy74o-Ce8bn9dMNtQ4-To135bD8Q8ICw8B_R6Zt9b1oH6gLSgEtMC2tiggzonCt48fK9UwxethlsGHpm/s1600/IMG_1637.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiqoQP0AEki23QFLDnVBhEvfUJa9sjcFt4d7L2UneYDKKUehE1GdthOdw6PzRjKy74o-Ce8bn9dMNtQ4-To135bD8Q8ICw8B_R6Zt9b1oH6gLSgEtMC2tiggzonCt48fK9UwxethlsGHpm/s1600/IMG_1637.jpg" height="320" width="240" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyeHPhIcLjqo7qyacs7Y9LZyt66CmKWvE9YVLHYTs-kzdQ3UUUUK_zQYbgBQKxVB3w_PXqFM_7ENQb5mLeQObGk5XnzixmDRHjGXQPiraUON7DFQsKHoZFCq1Zw53H7eMKBpneNrpkbnfX/s1600/IMG_1641.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyeHPhIcLjqo7qyacs7Y9LZyt66CmKWvE9YVLHYTs-kzdQ3UUUUK_zQYbgBQKxVB3w_PXqFM_7ENQb5mLeQObGk5XnzixmDRHjGXQPiraUON7DFQsKHoZFCq1Zw53H7eMKBpneNrpkbnfX/s1600/IMG_1641.JPG" height="240" width="320" /></a></div>
<br />
<br />
Note: in the picture on the right you can see that I'm using a <a href="http://shop.ciseco.co.uk/xrf-wireless-rf-radio-uart-rs232-serial-data-module-xbee-shape-arduino-pic-etc/" target="_blank">XRF module</a> from <a href="http://shop.ciseco.co.uk/" target="_blank">Ciseco</a> to wirelessly send signals to the Arduino.chrishttp://www.blogger.com/profile/08639640522185430373noreply@blogger.com0tag:blogger.com,1999:blog-5451931871691293121.post-45345468737959099472013-05-21T18:33:00.002+01:002013-05-21T18:34:45.799+01:00Tellstick on Raspberry Pi to control Maplin(UK) remote lightsThis is a short post just to describe the setup of the<a href="http://www.maplin.co.uk/remote-controlled-mains-sockets-3-pack-531561" target="_blank"> Maplin (UK) lamp remote control switches</a> so that you can control them using a Raspberry Pi.<br />
<br />
The lamp controls come in packs of three or you can buy them individually.<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0OD0447-RKPOnBgjwMMkN0XwI5DMndhUnUjJjRAyZCzubsEnGLAh5NAIxv9XlH1A3WwyrlfOF_YEnGUpYqJqlEa8dk_pWVvzDlj7gRfRL8EaU4Hw8OfgXon-L90DPUClXpOeiVdh54Cq2/s1600/IMG_1201.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0OD0447-RKPOnBgjwMMkN0XwI5DMndhUnUjJjRAyZCzubsEnGLAh5NAIxv9XlH1A3WwyrlfOF_YEnGUpYqJqlEa8dk_pWVvzDlj7gRfRL8EaU4Hw8OfgXon-L90DPUClXpOeiVdh54Cq2/s640/IMG_1201.jpg" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
They come with a remote, which from the back you can see uses 433.92 MHz.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilWEVmyIdBH5MOWBCYYalj-RFkNs0t8C1S29xOrGeDSdhddM0v5FG1TNLC7G74BY9xZvm7rCjfw5r4Cn2_Rap5N5k0cd9wWJ8g_G64PDTR0b3kJYVZFxa2PDc0I70oXu1XUvQA2ryXqp4G/s1600/IMG_1203.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilWEVmyIdBH5MOWBCYYalj-RFkNs0t8C1S29xOrGeDSdhddM0v5FG1TNLC7G74BY9xZvm7rCjfw5r4Cn2_Rap5N5k0cd9wWJ8g_G64PDTR0b3kJYVZFxa2PDc0I70oXu1XUvQA2ryXqp4G/s640/IMG_1203.jpg" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
However, to control these from the Raspberry Pi, I obtained a <a href="http://www.telldus.se/products/tellstick" target="_blank">TellStick</a> for about £20 on ebay. </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
To get the TellStick set up on the Pi I followed <a href="http://elinux.org/R-Pi_Tellstick_core" target="_blank">this guide</a> and I'm not going to repeat it here as it covers all the key steps.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The part that you need to know for these particular lamp controllers is when you come to the 'Configure Receivers' section. This is where you edit to configuration files for the <span style="font-family: Courier New, Courier, monospace;">telldusd</span> service.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The file to edit is:</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Courier New, Courier, monospace;">/etc/tellstick.conf</span></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
There are a number of different protocols that can be used for different brands of light switches. In this case, the configuration that worked for me was the <i>risingsun</i> protocol. </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<div class="p1">
<span style="font-family: Courier New, Courier, monospace;">user = "nobody"</span></div>
<div class="p1">
<span style="font-family: Courier New, Courier, monospace;">group = "plugdev"</span></div>
<div class="p1">
<span style="font-family: Courier New, Courier, monospace;">ignoreControllerConfirmation = "false"</span></div>
<div class="p1">
<span style="font-family: Courier New, Courier, monospace;">device {</span></div>
<div class="p1">
<span style="font-family: Courier New, Courier, monospace;"> id = 3</span></div>
<div class="p1">
<span style="font-family: Courier New, Courier, monospace;"> name = "Living room light 3"</span></div>
<div class="p1">
<span style="font-family: Courier New, Courier, monospace;"> protocol = "risingsun"</span></div>
<div class="p1">
<span style="font-family: Courier New, Courier, monospace;"> model = "codeswitch"</span></div>
<div class="p1">
<span style="font-family: Courier New, Courier, monospace;"> parameters {</span></div>
<div class="p1">
<span style="font-family: Courier New, Courier, monospace;"> house = "4"</span></div>
<div class="p1">
<span style="font-family: Courier New, Courier, monospace;"> unit = "3"</span></div>
<div class="p1">
<span style="font-family: Courier New, Courier, monospace;"> }</span></div>
<div class="p1">
<span style="font-family: Courier New, Courier, monospace;">}</span></div>
<br />
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The "name" can be defined by you. The "protocol" needs to be <i>risingsun</i>, "model" needs to be <i>codeswitch</i>, and the parameters for "house" and "unit" need to match what you set on the remote and the switches. In the diagram above on the remote you can see that the "house" is set to 4 ( <i>IV</i> ) and the buttons on the reverse of the remote provide on/off switches for each unit (1-4). In the picture below of an individual switch, you can see house is also set to 4 ( IV ) and this particular unit is number 3. </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwIwnDRCdQIUhI8jmTl3Ll5o6eandeNRRUcuml_9gtj7oWxJ8ISuXiNMGD-mvbELClcIqvv1qZYWoMBMd5aAAKa_yCvkz0E0Ic0QfFeZpvG6zYzBBWJPH7D4X68SNTed9vTBfJEYhwGNBO/s1600/IMG_1204.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwIwnDRCdQIUhI8jmTl3Ll5o6eandeNRRUcuml_9gtj7oWxJ8ISuXiNMGD-mvbELClcIqvv1qZYWoMBMd5aAAKa_yCvkz0E0Ic0QfFeZpvG6zYzBBWJPH7D4X68SNTed9vTBfJEYhwGNBO/s640/IMG_1204.jpg" width="480" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Once you save the configuration file, you need to remember to restart the service using:</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<div class="p1">
<span style="font-family: Courier New, Courier, monospace;">sudo service telldusd restart</span></div>
<div class="p1">
<br /></div>
<div class="p1">
To actually control the lights you use:</div>
<div class="p1">
<br /></div>
<div class="p1">
</div>
<div class="p1">
<span style="font-family: Courier New, Courier, monospace;">tdtool --on 3</span></div>
<div class="p1">
</div>
<div class="p1">
<span style="font-family: Courier New, Courier, monospace;">tdtool --off 3</span></div>
<div class="p1">
<br /></div>
<div class="p1">
... where the number following the on or off argument matches the "id" that you set in the configuration file. In the above example it was defined to be 3. </div>
<div class="p1">
<br /></div>
<div class="p1">
You can add multiple units to the configuration file by duplicating the device section, making sure you add a new id and modify the "house" and "unit" values to match those on your switch. </div>
<br />
<div class="separator" style="clear: both; text-align: left;">
It is then fairly easy to create a simple web server to generate an interface and make calls to the <span style="font-family: Courier New, Courier, monospace;">tdtool</span> in order to control the lights from a computer or smartphone. </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
chrishttp://www.blogger.com/profile/08639640522185430373noreply@blogger.com3tag:blogger.com,1999:blog-5451931871691293121.post-9038055734362699962013-03-31T20:51:00.000+01:002013-04-01T20:48:30.644+01:00Snowboard HUD Part 10 - SummaryThis is the last post (for a while) in this series on hacking together a pair of Heads-Up-Display snowboard goggles. At some point in the future I might revisit this and add in some more sensors and update the display -- I still haven't added in the temperature sensor and there are some really easy things to do in Python to add more functionality (e.g. keeping track of maximum speed, stopwatch functionality etc). This picture shows all the components put together.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKkXiAnlXvK83Bf2EmAssJOcicczfrNgl1oRDXUDGReiBPQ3Yy-MDnmrxBjHQbbeJoBXNY8tCECPFG7Y_DN47jYzv1YBEPtP8dPMLXFxAo6INP0U0f1E_BPoXXvyilB5pTCWnz1j37bIUl/s1600/IMG_1031.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKkXiAnlXvK83Bf2EmAssJOcicczfrNgl1oRDXUDGReiBPQ3Yy-MDnmrxBjHQbbeJoBXNY8tCECPFG7Y_DN47jYzv1YBEPtP8dPMLXFxAo6INP0U0f1E_BPoXXvyilB5pTCWnz1j37bIUl/s640/IMG_1031.JPG" width="640" /></a></div>
<br />
<br />
This video shows the goggles now that I've hot glued the MyVu components in. It's a bit of a mess and probably needs another layer of foam added around the outside to hide all the glue and put a bit more separation between your face and the MyVu.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='640' height='360' src='https://www.youtube.com/embed/zxngbiYjD74?feature=player_embedded' frameborder='0'></iframe></div>
<br />
I've also recorded one more video showing the view through the goggles.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='640' height='360' src='https://www.youtube.com/embed/CoZgNuGUK0g?feature=player_embedded' frameborder='0'></iframe></div>
<br />
<br />
So in summary, it seems it is possible to hack together something that approximates a pair of Heads-Up-Display snowboard goggles. Although I'm not too sure about actually carrying around all that kit for real.<br />
<span style="color: red;"><b><br /></b></span>
<span style="color: red;"><b>Also probably best not to be strapping things to your face that could poke out your eyes during an accident.</b> </span><br />
<br />
The full listing of parts for my hacked together version is below...<br />
<br />
Raspberry Pi - RS Components £25.92<br />
SD Card - RS Components - £7.79<br />
Anker Astro 3E 10000mAh battery pack - Amazon - £29.99<br />
2013 Rayzor Pro Goggles - Amazon - £19.59<br />
Ultimate GPS Breakout - Cool Components - £28.54<br />
MyVu glasses - ebay - about £40<br />
USB to TTL to UART RS232 COM Cable - Anmazon £4.66<br />
Various USB cables, bits of wire etc. less than £5<br />
<br />
So the total for all this would be about £160! Thankfully I had a lot of this already anyway from other projects. I guess it shows that the <a href="http://reconinstruments.com/products/snow-heads-up-display" target="_blank">Recon glasses</a> are actually quite good value for the technology that you are getting and the functionality that it offers.<br />
<br />
If I end up getting a pair of the proper Recon goggles I'll have a play with the SDK and see what else interesting could be done with a properly engineered product!<br />
<br />
Oh, and <a href="http://www.google.com/glass/start/how-to-get-one/" target="_blank">#IfIHadGlass</a>, I'd start with reimplementing this, before getting on to a load of other projects I'd like to try :)<br />
<br />
<br />chrishttp://www.blogger.com/profile/08639640522185430373noreply@blogger.com8tag:blogger.com,1999:blog-5451931871691293121.post-43654849973847504622013-03-31T16:14:00.000+01:002013-03-31T20:48:34.312+01:00Snowboard HUD Part 9 - Field Test 1I'm going to take the glasses out today and try them outside with the battery pack. Before that I thought I'd make a quick summary of the setup and show all the components finally put together.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjW63xcAqR_9XGPzTFjCf6tV9dTeT7cPPvYNyfPF9Opzs69wAEaLemWBbDTkmIuemfdhZR-Y-7KwwgbSX8csCl2arM9wvYgRnVVBtWFnRruIfUQu0y9IYwssn8wjIWPbU-bO2wqVndSDTee/s1600/Rasperry+Pi+HUD+Snowboard+Goggles+kit.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="472" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjW63xcAqR_9XGPzTFjCf6tV9dTeT7cPPvYNyfPF9Opzs69wAEaLemWBbDTkmIuemfdhZR-Y-7KwwgbSX8csCl2arM9wvYgRnVVBtWFnRruIfUQu0y9IYwssn8wjIWPbU-bO2wqVndSDTee/s640/Rasperry+Pi+HUD+Snowboard+Goggles+kit.jpeg" width="640" /></a></div>
<br />
<br />
Below is a video showing all the wearable components in my jacket (sorry the video is a bit shaky).<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='640' height='360' src='https://www.youtube.com/embed/j7-bW9y883o?feature=player_embedded' frameborder='0'></iframe></div>
<br />
<br />
The first video from inside the glasses is below. I'm not that happy with it really. I will try to make a better one when I get some time over the next couple of days.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='640' height='360' src='https://www.youtube.com/embed/VThbix5g7Lo?feature=player_embedded' frameborder='0'></iframe></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
<br />
<br />
<span id="goog_1749009873"></span>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5451931871691293121.post-60022090516793189622013-03-27T16:05:00.000+00:002013-03-31T21:35:58.258+01:00Snowboard HUD Part 8 - Goggle integrationThe goggles I'm going to try and integrate this HUD with are <a href="http://www.amazon.co.uk/gp/product/B002MPA5LU" rel="nofollow" target="_blank">2013 Rayzor Pro</a> from Amazon. More details are <a href="http://www.rayzorinternational.com/rayzor-black-framed-goggle-with-an-anti-fog-smoked-lens-p-47.html?cPath=2&zenid=fcf6c6ce73b22448eb505934386d6215" target="_blank">here</a>. I actually bought these to go snowboarding, so I've just ordered another pair so that it doesn't matter that I'm about to destroy the first pair that I bought.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiV_dpBt4Gug1mvaX17lVnv9NKEYUf2cc5ynYDTXCUU3NneiYD-cmQWBp24XbhMcntVn-Af4fSwgQjEnb_b3Ouax52tZBZqGZxOJ5uTjkkNVW0cp7uc6zWHwA9RS98iSd3Dy4t-FK-J5yU/s1600/silvercamosmoke_LRG.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="197" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiV_dpBt4Gug1mvaX17lVnv9NKEYUf2cc5ynYDTXCUU3NneiYD-cmQWBp24XbhMcntVn-Af4fSwgQjEnb_b3Ouax52tZBZqGZxOJ5uTjkkNVW0cp7uc6zWHwA9RS98iSd3Dy4t-FK-J5yU/s320/silvercamosmoke_LRG.jpg" width="320" /></a></div>
<br />
<br />
I spent quite a lot of time trying to get the displays to sit at the bottom of the goggles so that you look down to see the display<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiG-gH6ltVzH1WQhRhoymF1oCdPZbRg1FEC209NHVn7S5rPc-JzBDv213aj0Kn5IVAGHzo8nGoU4nhk_Ydy8k9GU3yR_dVdH6xRiWOuVAt-OomN0zEXrsWWOz9-WOdq4k8T44hQ-DKWp4/s1600/IMG_0966.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiG-gH6ltVzH1WQhRhoymF1oCdPZbRg1FEC209NHVn7S5rPc-JzBDv213aj0Kn5IVAGHzo8nGoU4nhk_Ydy8k9GU3yR_dVdH6xRiWOuVAt-OomN0zEXrsWWOz9-WOdq4k8T44hQ-DKWp4/s640/IMG_0966.JPG" width="640" /></a></div>
<br />
The problem is that without separating the two displays, i.e. breaking the central part of the MyVu (and I don't know what runs through the middle), for the displays to be low enough to not obstruct your actual view, the plastic hits your nose when the goggles are on.<br />
<br />
Eventually I started think about whether the displays could sit at the top of the goggles. There is already a large area that isn't visible (some foam and vents) so I started trying to fix the displays in position at the top of the goggles.<br />
<br />
I cut some holes in the foam so the cables for display and earphones cold easily come out of the goggles. I haven't found a good way of holding the displays in place yet so I've just opted for some temporary fixes to see if it all works. You can just see the HUD being displayed in the picture below.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHQfZscOZ7sr1UZTdqoTFOuq2TZsyYZs4AfYLET7-Vr_1JNEzhfaRlgIOssa7AdeVc-vBZ_f7NQ89kelnWtyoA_nwou_id0RZ2u2QArAbMYqDBFRscwXudLxP70h0lkiYbWOHJoBOnlR0/s1600/IMG_0970.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHQfZscOZ7sr1UZTdqoTFOuq2TZsyYZs4AfYLET7-Vr_1JNEzhfaRlgIOssa7AdeVc-vBZ_f7NQ89kelnWtyoA_nwou_id0RZ2u2QArAbMYqDBFRscwXudLxP70h0lkiYbWOHJoBOnlR0/s640/IMG_0970.JPG" width="640" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-W-1tNOJnnLu7lhEM7j6ajtHfmM_EmW7oCv1g-moi6kJbD_5Kr0sGpZA9tm4IeiS56fEYKQNS_P0z1GYNtRtywiMff4a3bfA9qTotYfz-ehr43RndB-ogqZeN8bWhj08SoBdHpfZ_oWU/s1600/IMG_0972.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-W-1tNOJnnLu7lhEM7j6ajtHfmM_EmW7oCv1g-moi6kJbD_5Kr0sGpZA9tm4IeiS56fEYKQNS_P0z1GYNtRtywiMff4a3bfA9qTotYfz-ehr43RndB-ogqZeN8bWhj08SoBdHpfZ_oWU/s640/IMG_0972.JPG" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
It looks really clunky in the picture, but when you wear it it actually hardly obstructs your view at all.</div>
<br />
I have a short video where I've tried to capture what you see but it is quite hard to film. Any ideas to make this better please let me know.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='640' height='360' src='https://www.youtube.com/embed/jm6c5F2HJNE?feature=player_embedded' frameborder='0'></iframe><br />
<br />
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5451931871691293121.post-43374795582029631312013-03-27T15:27:00.000+00:002013-03-28T12:45:14.430+00:00Snowboard HUD Part 7 - MyVu DisassemblyI've finally got to the point where I need to dismantle the MyVu glasses....<br />
<br />
Basically after a combination of prising bits of plastic off, the occasional M5 screw that can be removed, I managed to get most of the casing removed. Sorry I didn't create a proper set of instructions on how to dismantle but I didn't really know what I was doing until it was finished.<br />
<br />
The front bit of plastic was quite easy just to prise off using a screwdriver.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhY2z54jp7HaYXd9f7mstivhbF-UdLpCiYpEPJF-Gd37DSqfVw8XsF0xCkTUp9_rx0qD-qOYTFJtgqfMR7gNf0MA88iAFIm5itRJPklE7SwUScnKUrNpQ4vJ5E_Togq8QTCfyEgYfpLMko/s1600/IMG_0951.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhY2z54jp7HaYXd9f7mstivhbF-UdLpCiYpEPJF-Gd37DSqfVw8XsF0xCkTUp9_rx0qD-qOYTFJtgqfMR7gNf0MA88iAFIm5itRJPklE7SwUScnKUrNpQ4vJ5E_Togq8QTCfyEgYfpLMko/s320/IMG_0951.JPG" width="320" /></a></div>
<br />
There are then some M5 screws on the bottom that are accessible<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6ibAcQrJHbRCdM8uVn_Pf6mi7rmfbnd8IUbn7RttcDGLS1kgpDnZGPU4-SH_0olBC9zWEpohpm7l03Y3iITeYud9tu3-7jMgBLAg8TYeCkGVvXNzhPissWQ2ZZ6qNkZKk8vc1xTmJknE/s1600/IMG_0953.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6ibAcQrJHbRCdM8uVn_Pf6mi7rmfbnd8IUbn7RttcDGLS1kgpDnZGPU4-SH_0olBC9zWEpohpm7l03Y3iITeYud9tu3-7jMgBLAg8TYeCkGVvXNzhPissWQ2ZZ6qNkZKk8vc1xTmJknE/s320/IMG_0953.JPG" width="320" /></a></div>
<br />
You can also get access to another two screws under plastic caps. One came out easily, the other I drilled out.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgX0SpjijrLT9ZafjKrhtnNB3Wmq3vX1DMhLezoUxf5enEcII6JYq8W_kX111vv3hYy6HvDqXVTDinVk1n3hqrTTzYUZe6qg99bjRzlZTz0afoTH_xiULM5cyZ7eY9oGjzA2Eot-_OmI6M/s1600/IMG_0956.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgX0SpjijrLT9ZafjKrhtnNB3Wmq3vX1DMhLezoUxf5enEcII6JYq8W_kX111vv3hYy6HvDqXVTDinVk1n3hqrTTzYUZe6qg99bjRzlZTz0afoTH_xiULM5cyZ7eY9oGjzA2Eot-_OmI6M/s320/IMG_0956.JPG" width="320" /></a></div>
<br />
at which point most of the plastic can be removed<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQ3u9GjfbsO9gkzEzNNZIWCdDn-uOT6DSI7RwEC9fbitTkxSgMZoSVBd-A5jqCvi7osh2cCwdfyrf5Mnawxw7q-YNqtH_Heb85B4uenfbjt4OTMR7xDhECaXKwhHq3XSvLvEoGm11e7_g/s1600/IMG_0957.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQ3u9GjfbsO9gkzEzNNZIWCdDn-uOT6DSI7RwEC9fbitTkxSgMZoSVBd-A5jqCvi7osh2cCwdfyrf5Mnawxw7q-YNqtH_Heb85B4uenfbjt4OTMR7xDhECaXKwhHq3XSvLvEoGm11e7_g/s320/IMG_0957.JPG" width="320" /></a></div>
<br />
<br />
I kept testing to make sure that nothing I had done had broken a connection to the display.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://i.ytimg.com/vi/lH_H3h3Ralo/0.jpg" height="360" width="640"><param name="movie" value="http://www.youtube.com/v/lH_H3h3Ralo?version=3&f=user_uploads&c=google-webdrive-0&app=youtube_gdata" /><param name="bgcolor" value="#FFFFFF" /><param name="allowFullScreen" value="true" /><embed width="640" height="360" src="http://www.youtube.com/v/lH_H3h3Ralo?version=3&f=user_uploads&c=google-webdrive-0&app=youtube_gdata" type="application/x-shockwave-flash" allowfullscreen="true"></embed></object><br />
<br />
I thought I was going to just use one of the screens but if I disconnected the brown ribbon cable from any the second screen the first one didn't display either. Therefore I'm going to have to (for now) integrate both screens into the goggles.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4ryvvZrUt3VKuWkUPFkRZeVtFi9z27LihA7SeEk8fCxlyrzApuuqv0RhC1fyQ5_c-bCv61Qh7rVCC_Hg76FCKN4aw0L7_T91lqy0rhUv74Fus8XAw9yNn7I13jU50wkCJ7TeRXD0lfBs/s1600/IMG_0962.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4ryvvZrUt3VKuWkUPFkRZeVtFi9z27LihA7SeEk8fCxlyrzApuuqv0RhC1fyQ5_c-bCv61Qh7rVCC_Hg76FCKN4aw0L7_T91lqy0rhUv74Fus8XAw9yNn7I13jU50wkCJ7TeRXD0lfBs/s320/IMG_0962.JPG" width="240" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
After removing as much of the plastic as I could and stripping the arms I've ended up with this:</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgh-KEl3ywaHqbA_XbxxWhuKk2sVM77Zc8oM1inHDU-ACmRZnZn2CNHN0c1UWq5pe5B4BBtib3fJY60ywBl7TCWHkQQlQ_66PktszuF1NKJTm3Gbr2PwCIFZ7XwW8wsQ8KpIhzFa8o7PtA/s1600/Screen+Shot+2013-03-27+at+15.24.41.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="194" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgh-KEl3ywaHqbA_XbxxWhuKk2sVM77Zc8oM1inHDU-ACmRZnZn2CNHN0c1UWq5pe5B4BBtib3fJY60ywBl7TCWHkQQlQ_66PktszuF1NKJTm3Gbr2PwCIFZ7XwW8wsQ8KpIhzFa8o7PtA/s320/Screen+Shot+2013-03-27+at+15.24.41.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
I then taped up most of the loose and exposed cables. I now need to figure out if it can be embedded in some goggles...</div>
<span id="goog_520293734"></span><span id="goog_520293735"></span><br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5451931871691293121.post-33476704857223894402013-03-23T19:30:00.003+00:002013-03-28T12:48:47.353+00:00Snowboard HUD Part 6 - Auto-launching the scriptNow that the battery pack has arrived I can now think about making this mobile.<br />
<div>
<br /></div>
<div>
Before I get on to connecting up the battery, I need to make the display script start up automatically, since when it is out and about it wont have a keyboard attached in order to load the script.</div>
<div>
<br /></div>
<div>
Running scripts on startup can be achieved in a number of ways. I wish I could find a decent article somewhere that descripbes all the different methods and why you might choose one over the other. I have in the past modified the <span style="font-family: Courier New, Courier, monospace;">.profile</span> file within the user's home folder, but in this case I need to run scripts using sudo, and I haven't been able to do that using the <span style="font-family: Courier New, Courier, monospace;">.profile</span>. Therefore what I've done is used the guide from <a href="http://www.raspberrypi.org/phpBB3/viewtopic.php?f=72&t=28199" rel="nofollow" target="_blank">here</a>. First I created a new file called <span style="font-family: Courier New, Courier, monospace;">rungui</span>. </div>
<div>
<br /></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">sudo nano /etc/init.d/rungui</span></div>
<div>
<br /></div>
<div>
and put this text into it</div>
<div>
<br /></div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;">#! /bin/sh</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"># /etc/init.d/rungui</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">### BEGIN INIT INFO</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"># Provides: noip</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"># Required-Start: $remote_fs $syslog</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"># Required-Stop: $remote_fs $syslog</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"># Default-Start: 2 3 4 5</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"># Default-Stop: 0 1 6</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"># Short-Description: Simple script to start a program at boot</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"># Description: A simple script which will start / stop a program a boot /$</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">### END INIT INFO</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace;">echo 'called rungui script'</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">sudo killall gpsd</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">sudo gpsd /dev/ttyUSB0 -F /va</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">sudo python /home/pi/test_gui3.py</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">exit 0</span></div>
</div>
<div>
<br /></div>
<div>
The important lines are at the bottom</div>
<div>
<br /></div>
<div>
The two lines that refer to gpsd have been added since for some reason my GPS has stopped working unless you do this on every boot. I have no idea why, I don't think I have changed anything since I first got this working, but eventually I found I could fix it with these two lines. So I'm calling them on every boot of the pi.</div>
<div>
<br /></div>
<div>
The script is then called suing <span style="font-family: 'Courier New', Courier, monospace;">python /home/pi/test_gui3.py. </span><span style="font-family: Times, Times New Roman, serif;">I should probably rename that something sensible at some point.</span></div>
<div>
<span style="font-family: Times, Times New Roman, serif;"><br /></span></div>
<div>
<span style="font-family: Times, Times New Roman, serif;">Once this file is created run:</span></div>
<div>
<span style="font-family: Times, Times New Roman, serif;"><br /></span></div>
<div>
<div class="p1">
<span style="font-family: Courier New, Courier, monospace;">sudo update-rc.d rungui defaults</span></div>
</div>
<div>
<br /></div>
<div>
and the script should be launched automatically when the pi boots.</div>
<div>
<br /></div>
<div>
<br />
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5451931871691293121.post-81464846107576802832013-03-15T17:10:00.000+00:002013-03-28T12:45:48.734+00:00Snowboard HUD Part 5 - GPS IntegrationFor the GPS integration, the articles from <a href="http://learn.adafruit.com/adafruit-ultimate-gps-on-the-raspberry-pi/setting-everything-up" target="_blank">Kevin Townsend</a> have been invaluable. The hardware I'm using is the Ultimate GPS Breakout Board. Mine was from <a href="http://www.coolcomponents.co.uk/catalog/ultimate-breakout-channel-updates-p-1109.html" target="_blank">Cool Components</a> in the UK.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheT9hg_ENbErrJEW7mvcY357v67giq9486cEJwlhGpMfv-0Re7Chw7hPoKK3PlnUxKwnpqTmvVdKSY5F1LwYqTeDXJpG2eH3MFII8ag-It3lLx3r7kTSMaZIdFW5KdpWwTyJ7hqO-OuK4/s1600/IMG_0933.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheT9hg_ENbErrJEW7mvcY357v67giq9486cEJwlhGpMfv-0Re7Chw7hPoKK3PlnUxKwnpqTmvVdKSY5F1LwYqTeDXJpG2eH3MFII8ag-It3lLx3r7kTSMaZIdFW5KdpWwTyJ7hqO-OuK4/s320/IMG_0933.JPG" width="320" /></a></div>
<br />
<br />
As per the suggestion in Kevin's article I'm also using a USB to serial converter rather than using the GPIO pins directly. I got this from Amazon UK (<a href="http://www.amazon.co.uk/gp/product/B008AGDTA4" target="_blank">http://www.amazon.co.uk/gp/product/B008AGDTA4</a>)<br />
<br />
This worked just by plugging it into the Raspberry Pi and is accessible probably as:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">/dev/ttyUSB0</span><br />
<br />
The instructions on Kevin's page are really comprehensive so I wont repeat them here. The only mistake I made was in connecting the GPS breakout to the serial.<br />
<br />
The coloured cables from the USB to serial are:<br />
<br />
Red VCC<br />
Black GND<br />
Green TXD<br />
White RXD<br />
<br />
Everytime I do something with serial I do this wrong, and it is completely logical I just seem to do it wrong every time! The TXD from the USB to serial needs to connect to the RX on the GPS breakout. I've put a picture below. Sorry the cables for TX and RX are both yellow, it doesn't help with the understanding but it's all I had.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiU9Vz2pgY8m7n8uuhIByrk6xgpZeBF0Pi4EnV4nYiu9u4n70FwBG1nonOGb93eUmhdjCGIxZxC39N47zggopLoaIjn9JwXIBCv4Nijq_bbuB1aZD-lNahQITx0f79HM0TE5JQjYXW_yGk/s1600/GPD+breakout+connections.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiU9Vz2pgY8m7n8uuhIByrk6xgpZeBF0Pi4EnV4nYiu9u4n70FwBG1nonOGb93eUmhdjCGIxZxC39N47zggopLoaIjn9JwXIBCv4Nijq_bbuB1aZD-lNahQITx0f79HM0TE5JQjYXW_yGk/s320/GPD+breakout+connections.png" width="320" /></a></div>
<br />
<br />
Once you get it all working, on the Raspberry Pi if you run<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">cgps -s</span><br />
<br />
you should see output something like this:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiArhWU41afmneQTa4uxqjvy475s6PP67HIMq_qWQ8d-D0ubnTBmGUyStS0nDCFc_SXGUyC42GctpYNv-euNG0baltrxIJrYUA4D6c_ecWKcGsWFtkUT_LccqW-W1PypH1P2zekNKjoou4/s1600/gps+output.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="146" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiArhWU41afmneQTa4uxqjvy475s6PP67HIMq_qWQ8d-D0ubnTBmGUyStS0nDCFc_SXGUyC42GctpYNv-euNG0baltrxIJrYUA4D6c_ecWKcGsWFtkUT_LccqW-W1PypH1P2zekNKjoou4/s320/gps+output.png" width="320" /></a></div>
<br />
However, what we really need is to be able to access this information from the Python program created earlier. In order to do this Kevin has another article with examples <a href="http://learn.adafruit.com/adafruit-ultimate-gps-on-the-raspberry-pi/using-your-gps" target="_blank">http://learn.adafruit.com/adafruit-ultimate-gps-on-the-raspberry-pi/using-your-gps</a><br />
<br />
Based on these examples, my updated code is:<br />
<br />
<br />
<span style="font-family: Courier New, Courier, monospace;"># coding=UTF-8</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">import pygame</span><br />
<span style="font-family: Courier New, Courier, monospace;">import sys</span><br />
<span style="font-family: Courier New, Courier, monospace;">import datetime</span><br />
<span style="font-family: Courier New, Courier, monospace;">import gps</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">def draw_borders(screen):</span><br />
<span style="font-family: Courier New, Courier, monospace;"> """Draws some simple borders to the display"""</span><br />
<span style="font-family: Courier New, Courier, monospace;"> pygame.draw.lines(screen, (255, 255, 255), False, [(0, 30), (width, 30)], 2)</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">def draw_time(screen):</span><br />
<span style="font-family: Courier New, Courier, monospace;"> """Draws the time to the display"""</span><br />
<span style="font-family: Courier New, Courier, monospace;"> the_time = datetime.datetime.now()</span><br />
<span style="font-family: Courier New, Courier, monospace;"> time_as_string = the_time.strftime('%H:%M')</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> font = pygame.font.Font(None, 42)</span><br />
<span style="font-family: Courier New, Courier, monospace;"> text = font.render(time_as_string, 1, (255, 255, 255))</span><br />
<span style="font-family: Courier New, Courier, monospace;"> textpos = text.get_rect(centerx=screen.get_width()/2, centery=15)</span><br />
<span style="font-family: Courier New, Courier, monospace;"> screen.blit(text, textpos) # paste the text into the background</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">def draw_speed(screen, the_speed):</span><br />
<span style="font-family: Courier New, Courier, monospace;"> """Draws the speed to the display"""</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> # get the speed...</span><br />
<span style="font-family: Courier New, Courier, monospace;"> if the_speed:</span><br />
<span style="font-family: Courier New, Courier, monospace;"> the_speed_string = '{} kph'.format(int(the_speed)) # display as whole number</span><br />
<span style="font-family: Courier New, Courier, monospace;"> else:</span><br />
<span style="font-family: Courier New, Courier, monospace;"> the_speed_string = '-- kph'</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> font = pygame.font.Font(None, 160)</span><br />
<span style="font-family: Courier New, Courier, monospace;"> text = font.render(the_speed_string, 1, (255, 255, 255))</span><br />
<span style="font-family: Courier New, Courier, monospace;"> textpos = text.get_rect(centerx=screen.get_width()/2, centery=screen.get_height()/2)</span><br />
<span style="font-family: Courier New, Courier, monospace;"> screen.blit(text, textpos) # paste the text into the background</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">def draw_altitude(screen, the_altitude):</span><br />
<span style="font-family: Courier New, Courier, monospace;"> """Draws the altitude to the display"""</span><br />
<span style="font-family: Courier New, Courier, monospace;"> if the_altitude:</span><br />
<span style="font-family: Courier New, Courier, monospace;"> the_altitude_string = '{} m'.format(the_altitude)</span><br />
<span style="font-family: Courier New, Courier, monospace;"> else:</span><br />
<span style="font-family: Courier New, Courier, monospace;"> the_altitude_string = '-- m'</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> font = pygame.font.Font(None, 65)</span><br />
<span style="font-family: Courier New, Courier, monospace;"> text = font.render(the_altitude_string, 1, (255, 255, 255))</span><br />
<span style="font-family: Courier New, Courier, monospace;"> textpos = text.get_rect(centerx=120, centery=screen.get_height()-20)</span><br />
<span style="font-family: Courier New, Courier, monospace;"> screen.blit(text, textpos) # paste the text into the background</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">def draw_temp(screen):</span><br />
<span style="font-family: Courier New, Courier, monospace;"> """Draws the temperature to the display"""</span><br />
<span style="font-family: Courier New, Courier, monospace;"> the_temp = 0</span><br />
<span style="font-family: Courier New, Courier, monospace;"> the_temp_string = u'{}°C'.format(the_temp)</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> font = pygame.font.Font(None, 65)</span><br />
<span style="font-family: Courier New, Courier, monospace;"> text = font.render(the_temp_string, 1, (255, 255, 255))</span><br />
<span style="font-family: Courier New, Courier, monospace;"> textpos = text.get_rect(centerx=screen.get_width()-80, centery=screen.get_height()-20)</span><br />
<span style="font-family: Courier New, Courier, monospace;"> screen.blit(text, textpos) # paste the text into the background</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">if __name__ == '__main__':</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> pygame.init()</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> size = width, height = 650, 400</span><br />
<span style="font-family: Courier New, Courier, monospace;"> black = 0, 0, 0</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> screen = pygame.display.set_mode(size)</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> # set up gps if possible</span><br />
<span style="font-family: Courier New, Courier, monospace;"> </span><br />
<span style="font-family: Courier New, Courier, monospace;"> gps_session = gps.gps("localhost", "2947")</span><br />
<span style="font-family: Courier New, Courier, monospace;"> gps_session.stream(gps.WATCH_ENABLE | gps.WATCH_NEWSTYLE)</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> speed = None</span><br />
<span style="font-family: Courier New, Courier, monospace;"> altitude = None</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> while True:</span><br />
<span style="font-family: Courier New, Courier, monospace;"> # Checks for key presses, e.g. escape to quit</span><br />
<span style="font-family: Courier New, Courier, monospace;"> for event in pygame.event.get():</span><br />
<span style="font-family: Courier New, Courier, monospace;"> if event.type == pygame.QUIT: sys.exit()</span><br />
<span style="font-family: Courier New, Courier, monospace;"> if event.type == pygame.KEYUP and event.key == pygame.K_ESCAPE: sys.exit()</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> # Fill the screen with black background</span><br />
<span style="font-family: Courier New, Courier, monospace;"> screen.fill(black)</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> # get GPS data</span><br />
<span style="font-family: Courier New, Courier, monospace;"> gps_report = gps_session.next()</span><br />
<span style="font-family: Courier New, Courier, monospace;"> altitude_temp = gps_report.get('alt')</span><br />
<span style="font-family: Courier New, Courier, monospace;"> speed_temp = gps_report.get('speed')</span><br />
<span style="font-family: Courier New, Courier, monospace;"> # need to do this temp stuff otherwise it flickers</span><br />
<span style="font-family: Courier New, Courier, monospace;"> # back to '--' if gps is temporarily lost</span><br />
<span style="font-family: Courier New, Courier, monospace;"> if altitude_temp:</span><br />
<span style="font-family: Courier New, Courier, monospace;"> altitude = altitude_temp</span><br />
<span style="font-family: Courier New, Courier, monospace;"> if speed_temp:</span><br />
<span style="font-family: Courier New, Courier, monospace;"> speed = speed_temp</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> # Draw all the stuff</span><br />
<span style="font-family: Courier New, Courier, monospace;"> draw_borders(screen)</span><br />
<span style="font-family: Courier New, Courier, monospace;"> draw_time(screen)</span><br />
<span style="font-family: Courier New, Courier, monospace;"> draw_speed(screen, speed)</span><br />
<span style="font-family: Courier New, Courier, monospace;"> draw_altitude(screen, altitude)</span><br />
<span style="font-family: Courier New, Courier, monospace;"> draw_temp(screen)</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> # Update the display</span><br />
<span style="font-family: Courier New, Courier, monospace;"> pygame.display.flip()</span><br />
<div>
<br /></div>
<br />
<br />
<br />
And the output:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='640' height='360' src='https://www.youtube.com/embed/PxVMg4aJ-oc?feature=player_embedded' frameborder='0'></iframe></div>
<br />
<br />
I haven't been able to test the speed yet until I get a battery pack, but you can see that the altitude has been updated.<br />
<br />
It is also worth looking at the other details that are stored within the <span style="font-family: Courier New, Courier, monospace;">gps_report</span> variable. The Python dictionary keys are in italics.<br />
<br />
longitude <i>lon</i><br />
latitude <i>lat</i><br />
time <i>time</i><br />
altitude <i>alt </i>(m)<br />
speed <i>speed (</i>kph)<br />
climb <i>climb </i>(m/min)<br />
heading <i>track </i>(degrees) (I think)<br />
<br />
Might be able to add more of this information in later.<br />
<br />
<br />
<br />
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5451931871691293121.post-69748265915915422212013-03-15T13:04:00.001+00:002013-03-28T12:46:15.882+00:00Snowboard HUD Part 4 - Basic displayThis posts describes the construction of a basic display with some placeholders.<br />
<br />
The idea is to produce something like this that displays the speed, altitude and temperature.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoBHKtq4VG7YJ3CS5TrBZaW77DJ1lL-E76Nh8LxDA_wRoPNIJb9MzcT8mV0KMNGt7WlWeZz0Dzj2yC4BnM8p0j_2MXkiLdUo5IkVySQA68KjIEMR7DrVLx4C9fdDpsqnsocZ5Hz1ZgN251/s1600/IMG_0984.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoBHKtq4VG7YJ3CS5TrBZaW77DJ1lL-E76Nh8LxDA_wRoPNIJb9MzcT8mV0KMNGt7WlWeZz0Dzj2yC4BnM8p0j_2MXkiLdUo5IkVySQA68KjIEMR7DrVLx4C9fdDpsqnsocZ5Hz1ZgN251/s320/IMG_0984.JPG" width="320" /></a></div>
<br />
<br />
I'm using a Raspberry Pi and I want to avoid booting into the GUI so I need a way of creating a graphical display from the terminal display. I discovered that this is possible using Python and PyGame.<br />
<br />
I think this was already installed but in case it isn't, the easiest thing to do is use aptitide to install python setup tools and then you can install any packages you want.<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">sudo apt-get install python-setuptools</span><br />
<span style="font-family: Courier New, Courier, monospace;">sudo apt-get install python-pip</span><br />
<br />
then you can use pip to install other Python packages e.g. PySerial<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">sudo pip install pyserial</span><br />
<br />
So to create the display I'm going to use PyGame. This may not be the most sensible thing to do, but it does seem to work. Alternative suggestions welcome.<br />
<br />
I used a PyGame tutorial from <a href="http://www.pygame.org/docs/tut/intro/intro.html" target="_blank">Pete Shinners</a> to get me started, which was very helpful.<br />
<br />
This first version of the display creates some text in fixed positions in the display as placeholders until I can actually start reading some data. There are also a lot of hard coded positions , which at the moment doesn't matter because it is set up to be displayed on the MyVu glasses.<br />
<br />
<br />
<br />
<span style="font-family: Courier New, Courier, monospace;"># coding=UTF-8</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">import pygame</span><br />
<span style="font-family: Courier New, Courier, monospace;">import sys</span><br />
<span style="font-family: Courier New, Courier, monospace;">import datetime</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">def draw_borders(screen):</span><br />
<span style="font-family: Courier New, Courier, monospace;"> """Draws some simple borders to the display"""</span><br />
<span style="font-family: Courier New, Courier, monospace;"> pygame.draw.lines(screen, (255, 255, 255), False, [(0, 30), (width, 30)], 2)</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">def draw_time(screen):</span><br />
<span style="font-family: Courier New, Courier, monospace;"> """Draws the time to the display"""</span><br />
<span style="font-family: Courier New, Courier, monospace;"> the_time = datetime.datetime.now()</span><br />
<span style="font-family: Courier New, Courier, monospace;"> time_as_string = the_time.strftime('%H:%M')</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> font = pygame.font.Font(None, 42)</span><br />
<span style="font-family: Courier New, Courier, monospace;"> text = font.render(time_as_string, 1, (255, 255, 255))</span><br />
<span style="font-family: Courier New, Courier, monospace;"> textpos = text.get_rect(centerx=screen.get_width()/2, centery=15)</span><br />
<span style="font-family: Courier New, Courier, monospace;"> screen.blit(text, textpos) # paste the text into the background</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">def draw_speed(screen):</span><br />
<span style="font-family: Courier New, Courier, monospace;"> """Draws the speed to the display"""</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> # get the speed...</span><br />
<span style="font-family: Courier New, Courier, monospace;"> the_speed = 0.0</span><br />
<span style="font-family: Courier New, Courier, monospace;"> the_speed_string = '{} mph'.format(int(the_speed)) # display as whole number</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> font = pygame.font.Font(None, 160)</span><br />
<span style="font-family: Courier New, Courier, monospace;"> text = font.render(the_speed_string, 1, (255, 255, 255))</span><br />
<span style="font-family: Courier New, Courier, monospace;"> textpos = text.get_rect(centerx=screen.get_width()/2, centery=screen.get_height()/2)</span><br />
<span style="font-family: Courier New, Courier, monospace;"> screen.blit(text, textpos) # paste the text into the background</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">def draw_altitude(screen):</span><br />
<span style="font-family: Courier New, Courier, monospace;"> """Draws the altitude to the display"""</span><br />
<span style="font-family: Courier New, Courier, monospace;"> the_altitude = 0</span><br />
<span style="font-family: Courier New, Courier, monospace;"> the_altitude_string = '{} m'.format(the_altitude)</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> font = pygame.font.Font(None, 65)</span><br />
<span style="font-family: Courier New, Courier, monospace;"> text = font.render(the_altitude_string, 1, (255, 255, 255))</span><br />
<span style="font-family: Courier New, Courier, monospace;"> textpos = text.get_rect(centerx=120, centery=screen.get_height()-20)</span><br />
<span style="font-family: Courier New, Courier, monospace;"> screen.blit(text, textpos) # paste the text into the background</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">def draw_temp(screen):</span><br />
<span style="font-family: Courier New, Courier, monospace;"> """Draws the temperature to the display"""</span><br />
<span style="font-family: Courier New, Courier, monospace;"> the_temp = 0</span><br />
<span style="font-family: Courier New, Courier, monospace;"> the_temp_string = u'{}°C'.format(the_temp)</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> font = pygame.font.Font(None, 65)</span><br />
<span style="font-family: Courier New, Courier, monospace;"> text = font.render(the_temp_string, 1, (255, 255, 255))</span><br />
<span style="font-family: Courier New, Courier, monospace;"> textpos = text.get_rect(centerx=screen.get_width()-80, centery=screen.get_height()-20)</span><br />
<span style="font-family: Courier New, Courier, monospace;"> screen.blit(text, textpos) # paste the text into the background</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">if __name__ == '__main__':</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> pygame.init()</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> size = width, height = 650, 400</span><br />
<span style="font-family: Courier New, Courier, monospace;"> black = 0, 0, 0</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> screen = pygame.display.set_mode(size)</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> while True:</span><br />
<span style="font-family: Courier New, Courier, monospace;"> # Checks for key presses, e.g. escape to quit</span><br />
<span style="font-family: Courier New, Courier, monospace;"> for event in pygame.event.get():</span><br />
<span style="font-family: Courier New, Courier, monospace;"> if event.type == pygame.QUIT: sys.exit()</span><br />
<span style="font-family: Courier New, Courier, monospace;"> if event.type == pygame.KEYUP and event.key == pygame.K_ESCAPE: sys.exit()</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> # Fill the screen with black background</span><br />
<span style="font-family: Courier New, Courier, monospace;"> screen.fill(black)</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> # Draw all the stuff</span><br />
<span style="font-family: Courier New, Courier, monospace;"> draw_borders(screen)</span><br />
<span style="font-family: Courier New, Courier, monospace;"> draw_time(screen)</span><br />
<span style="font-family: Courier New, Courier, monospace;"> draw_speed(screen)</span><br />
<span style="font-family: Courier New, Courier, monospace;"> draw_altitude(screen)</span><br />
<span style="font-family: Courier New, Courier, monospace;"> draw_temp(screen)</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> # Update the display</span><br />
<span style="font-family: Courier New, Courier, monospace;"> pygame.display.flip()</span><br />
<br />
<br />
<br />
<br />
And what this produces is:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqAop1DslPiqaN_apF1ghaIxHHAnjRs0NRB9I_HF3ifCWP_asMa3md5iza-nBrA53kEKVSPMrBBt5BlVGFzROAiwV7iUlfLczx4cchZoRe1Di_hbEFy7FejM2146EVBtlmQT_9AxQlWvI/s1600/hud_test1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="206" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqAop1DslPiqaN_apF1ghaIxHHAnjRs0NRB9I_HF3ifCWP_asMa3md5iza-nBrA53kEKVSPMrBBt5BlVGFzROAiwV7iUlfLczx4cchZoRe1Di_hbEFy7FejM2146EVBtlmQT_9AxQlWvI/s320/hud_test1.png" width="320" /></a></div>
<br />
You can see that this is actually being run on a Mac, which is good for editing the display layout, maybe doing some keyboard based control later, but the actual display needs to run on the Pi connected to the glasses.<br />
<br />
You can see the same here being displayed in the glasses.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='640' height='360' src='https://www.youtube.com/embed/ispmnclk2Zg?feature=player_embedded' frameborder='0'></iframe></div>
<br />
<br />
As a side note, I'm actually getting the code onto the Pi by copying it to a public dropbox folder and downloading with wget. I'm doing a lot of this through SSH-ing into the Pi, but I don't know how to start the script from the remote login and have the display update on the glasses that are connected via composite. Please let me know if you know if this is possible. You can just about hear from the video that I have a keyboard connected the the Pi in order to run the Python script.<br />
<br />
I also had to mess around quite a lot with the resolution of the display. If the MyVu didn't like the resolution I would get a blank screen inside the glasses and couldn't get rid of it without restarting the Pi. The line configuring the PyGame display:<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;">size = width, height = 650, 400</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span>
isn't the maximum resolution that I could probably use, but it does work.<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5451931871691293121.post-24947592661062876992013-03-15T12:12:00.003+00:002013-03-28T11:22:50.005+00:00Snowboard HUD Part 3 - Basic ComponentsWhat I'm going to first is just think about some of the components. I'm ignoring all the sensors here which wil get added as we progress.<br />
<br />
<b>Display</b><br />
<br />
In terms of the display what I have lying around is a pair of MyVu Solo Plus video display glasses. I think mine were from e-bay for about £35. It is definitely possible to pull the LCDs out of these glasses because it's been done on <a href="http://hackaday.com/2012/12/24/pulling-the-lcd-screens-out-of-a-myvu-glasses-display/" target="_blank">Hack a Day</a>. For now I'm going to leave the LCDs inside the MyVu though.<br />
<br />
Edit: also found this on instructables (<a href="http://www.instructables.com/id/Raspberry-Pi-wearable-computer" target="_blank">http://www.instructables.com/id/Raspberry-Pi-wearable-computer</a>), which is encouraging to see the idea isn't completely daft.<br />
<br />
<iframe allowfullscreen="" frameborder="0" height="360" src="http://www.youtube.com/embed/WG0ELTe6igU?feature=player_detailpage" width="640"></iframe>
<br />
<br />
<b>Processing</b><br />
<br />
For processing data, running the display etc. I think I'm going to use a Raspberry Pi (at least for now). It will output composite display, which is what the MyVu wants. It should also be very easy to program, and allow connection of other sensors. In addition to the Pi, as standard I tend to get an Edimax Nano USB Wifi dongle, just becasue it makes interaction with the Pi easier (<a href="http://www.amazon.co.uk/gp/product/B003MTTJOY" target="_blank">mine was from Amazon</a><span id="goog_1312487111"></span><span id="goog_1312487112"></span><a href="http://www.blogger.com/"></a>).<br />
<br />
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5451931871691293121.post-34480158608524588502013-03-15T11:59:00.002+00:002013-03-28T11:22:50.010+00:00Snowboard HUD Part 2 - Videos of the ReconSo, first things first. What data does the Recon output...<br />
<br />
From their website, the data that can be displayed includes:<br />
<br />
Speed<br />
Time<br />
Battery<br />
Temperature<br />
Jump airtime<br />
Jump height<br />
Stopwatch<br />
Text message display<br />
<br />
A good video showing the features is here:<br />
<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/p9jvnqKw2D8?feature=player_embedded' frameborder='0'></iframe></div>
<br />
<br />
and a nice view from inside the goggles is here.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://img.youtube.com/vi/wN8mmMzQU_M/default.jpg?h=90&w=120&sigh=__sl7LfD5CxqWWOqPrTBp5zG1lVPQ=" height="266" width="320"><param name="movie" value="http://youtube.googleapis.com/v/wN8mmMzQU_M&source=uds" /><param name="bgcolor" value="#FFFFFF" /><param name="allowFullScreen" value="true" /><embed width="320" height="266" src="http://youtube.googleapis.com/v/wN8mmMzQU_M&source=uds" type="application/x-shockwave-flash" allowfullscreen="true"></embed></object></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
next post soon...</div>
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5451931871691293121.post-50269409096765081492013-03-15T00:52:00.000+00:002013-03-28T11:22:50.016+00:00Snowboard HUD Part 1So this is the first post in this wearable computing blog. I got this idea when I was looking for a cheap pair of goggles for my first trip snowboarding. Unsurprisingly this research turned into an internet wandering into the most expensive and gadget ridden goggles that are available!<br />
<br />
This led me to Recon Instruments (<a href="http://reconinstruments.com/products/snow-heads-up-display">http://reconinstruments.com/products/snow-heads-up-display</a>), who sell a heads-up-display for skiing or snowboarding that can provide information such as speed, jump airtime, etc. though built-in GPS. It can also connect to your smartphone via bluetooth.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://img.youtube.com/vi/_qtROM5kNdk/default.jpg?h=90&w=120&sigh=__xisEYVpywSHsSY1LcIoklaGZ9wk=" height="266" width="320"><param name="movie" value="http://youtube.googleapis.com/v/_qtROM5kNdk&source=uds" /><param name="bgcolor" value="#FFFFFF" /><param name="allowFullScreen" value="true" /><embed width="320" height="266" src="http://youtube.googleapis.com/v/_qtROM5kNdk&source=uds" type="application/x-shockwave-flash" allowfullscreen="true"></embed></object></div>
<br />
<br />
While I would love a pair of these goggles as they look amazing (particularly when there is an SDK), for a first trip, they seem a little extravagant. Nevertheless, being a bit a geek, it did make me wonder about how close I could get to this functionality with some DIY hacking.<br />
<br />
More posts to follow...Unknownnoreply@blogger.com0