tag:blogger.com,1999:blog-29021971638079653932024-03-20T15:41:38.129+00:00Winkleink - box of wiresBlog about Raspberry Pi and Arduino mainly.Winkleinkhttp://www.blogger.com/profile/10921617680353539604noreply@blogger.comBlogger107125tag:blogger.com,1999:blog-2902197163807965393.post-4379355565242116072019-05-07T11:35:00.002+01:002021-09-09T16:30:41.899+01:00Some tips on using the Smart 2 Wheel Arduino Robot chassisI'm a big fan of these basic 2 wheel chassis. They're cheap to buy. I've seen them on eBay for less than £6.00 without the batter holder. There is enough space on them an Arduino or PiZero with a motor controller alongside the battery pack.<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/AVvXsEgU9_I5XehBBmJb_ksu46kD3rtGtX1LUUDWXu8ttmD_OIh0BZZ9-A7WuSVLp_ldYQGtV__UOsPkvRd6wwRyCj0BGMbST0cdSMVLm5qC02MX6VFEEX-EjFWbx9HIQ7vjEWxzvq-hTM2PKs2z/s1600/2-WHEEL-ROBOT-STARTER-KIT1.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="800" data-original-width="800" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU9_I5XehBBmJb_ksu46kD3rtGtX1LUUDWXu8ttmD_OIh0BZZ9-A7WuSVLp_ldYQGtV__UOsPkvRd6wwRyCj0BGMbST0cdSMVLm5qC02MX6VFEEX-EjFWbx9HIQ7vjEWxzvq-hTM2PKs2z/s320/2-WHEEL-ROBOT-STARTER-KIT1.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">2 wheel smart robot chassis</td></tr>
</tbody></table>
They're usually listed as "2 Wheel Smart Robot" with the word Arduino added in there somewhere even thought they are not Arduino specific. I think it's there to improve SEO for all the people making their first robot using an Arduinio. Also, they are not smart, there is no intelligence provided. They usually come with tachometer encoders for the wheels, but you need extra electronics to read them.<br />
<br />
I've used these chassis a few times and these are some gotchas that I'd to figure out.<br />
<br />
<b>1. The perspex is clear</b><br />
If the perspex is opaque or brown in colour then this is a layer that can be pealed off. It's there to protect the perspex. You can leave it on but it's supposed to come off.<br />
<br />
<b>2. The caster goes to the back</b>.<br />
Even though most of the pictures you see show the caster wheel at the front this is really a drag wheel and should be at the back of the bot.<br />
The fact the caster spins means if it is put at the front then you're pushing against the caster when turning. It's like having a wobbly shopping trolley. Easier to pull behind you than push in front. Also, you can see from the image the (correct) front has more mounting options for sensors which makes sense.<br />
<br />
<b>3. The battery box can be screwed on the underside</b><br />
All pictures I've seen always have the AA battery box on the top. Makes sense as gravity will keep the batteries in. But, if needed the battery box can be screwed to the underside of the deck giving more real estate on the top for other components.<br />
<br />
<b>4. The connections on the motors are very fragile</b><br />
Where you solder the wires to the motors is very fragile and prone to snapping off if put under any strain. So, it's best to put in place some strain relief.<br />
The easiest and without needing any additional hardware is to knot the two wires around the plastic fastener holding the motor in place. In this way if someone pulls on a wire or it gets snagged it doesn't put any pressure on the actual connection on the motor.<br />
<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/AVvXsEg_0_eo1IyE9vV2B84V5-030wiXDZbWyrQM_ASIIEAlpYKRXYX3jwZxi4MHEw-sZ8RXQl2-AXNdlLhsQwlOS3wJbzZQ_o41zVStvrfzU9_btfEeeh8x_AnMp_NK6dZO7Dw7Yj4s1KSV-xIy/s1600/motors_knot.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="1048" data-original-width="1600" height="209" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_0_eo1IyE9vV2B84V5-030wiXDZbWyrQM_ASIIEAlpYKRXYX3jwZxi4MHEw-sZ8RXQl2-AXNdlLhsQwlOS3wJbzZQ_o41zVStvrfzU9_btfEeeh8x_AnMp_NK6dZO7Dw7Yj4s1KSV-xIy/s320/motors_knot.JPG" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Strain relief on the motor wiring</td></tr>
</tbody></table>
<br />
<b>Some final thoughts</b><br />
<b></b><br />
<b></b>I've used these motors with L298N as well as L9110s motor controllers. Both work great. The L298N is bigger and really over specced for these little motors so the L9110s is more than capable of driving them.<br />
The cheap L9110s board only has one GND connection and assuming using a different power supply for the motors and the controller (Pi/Arduino) you'll need to tie the GND from the different power supplies, the controller and the L9110s together. I usually use one of the additional GND pins on the controller. Arduino Uno has three GND pins, the Arduino Nano has 2 and the Raspberry Pi has 8.<br />
<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/AVvXsEjKtDAREqMv0e1I-9hIGQOhubsUhci9EOAbeJtyvrPwTGh0hrsV20UcJDooqLlrE69gcbpuYdEDyeAwuIKlqe4K64WlH2SYV6JHCgnb_t5bY00GN-QWder4W4Mgk-6mnSh9U2DxGp-_Exfv/s1600/L9110s.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="800" data-original-width="800" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKtDAREqMv0e1I-9hIGQOhubsUhci9EOAbeJtyvrPwTGh0hrsV20UcJDooqLlrE69gcbpuYdEDyeAwuIKlqe4K64WlH2SYV6JHCgnb_t5bY00GN-QWder4W4Mgk-6mnSh9U2DxGp-_Exfv/s320/L9110s.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">L9110s - only one GND connection</td></tr>
</tbody></table>
<br />
<br />
I've heard reports that as the gears are plastic they can be shredded. A lot of fast reversing with a decent power supply can put the cogs under a lot of strain. This is one of the main compromises for the price. So, either limit the speed at which the motors can change direction or be ready to replace the motors.<br />
<br />
These little yellow motors look like they're all the same, but the gearing inside them can be different. If you do need a replacement motor you may not get the same gearing ratio which would affect the ability of your robot to go in a straight line or just move consistently.<br />
<br />
Even with all this I think these kits are a great start. They're easy to put together. Reliable (enough), powerful (enough) and cheap so a great place to start.<br />
Add an Arduino Nano and an L9110s with a small breadboard to connect everything together and you have a capable platform to develop from for less than £10.00.<br />
You can then add ultra-sonic sensors, line following sensors, infra-red remote control, Bluetooth interface, or even the tachometers to measure speed and lots more...<br />
Giving an easy and cost effective introduction to robots.<br />
This may not be the chassis you finish with but it's definitely a good place to start.<br />
And if you're already thinking of upgrades there is a 4 wheeled version as well for not much more.<br />
<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/AVvXsEhqPy452bpn4PLbDcHJud59isd5d9A-rj5QYyym0UgkO-cTzAHbfixSZ4x1oY8wPYHumMCV88fkW9yOorGLSjQotp_cdBjhYvJAYPJpUlI7caHIoX6HDQqvhedkiip4t7FM-mjCBe7_LqLo/s1600/4wheel_bot.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="1000" data-original-width="1000" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqPy452bpn4PLbDcHJud59isd5d9A-rj5QYyym0UgkO-cTzAHbfixSZ4x1oY8wPYHumMCV88fkW9yOorGLSjQotp_cdBjhYvJAYPJpUlI7caHIoX6HDQqvhedkiip4t7FM-mjCBe7_LqLo/s320/4wheel_bot.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">4 Wheel Smart Chassis</td></tr>
</tbody></table>
<br />
Happy roboting.<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />Winkleinkhttp://www.blogger.com/profile/10921617680353539604noreply@blogger.com0tag:blogger.com,1999:blog-2902197163807965393.post-59006344376151504152019-02-28T16:35:00.000+00:002019-02-28T16:35:07.242+00:00Arduino - avrdude: stk500_getsync() not in sync - How to fix<br />
This is reminder for me and hopefully useful for others either new to Arduino or using different boards.<br />
<br />
Sometimes on uploading you can get an error message<br />
<br />
<span style="font-family: Courier New, Courier, monospace;"><b>avrdude: stk500_recv(): programmer is not responding</b></span><br />
<span style="font-family: Courier New, Courier, monospace;"><b>avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00</b></span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjw3O0zyQblPL4jx-9_fUFzPWGf65g234tN7sHcOpf6daXOdyKkVixiR6Ju8WaKRJOB343FzWk8YRDZQXd9vO3GxoKCIqbrn4RymwnMPMimrEU0ipp2P-MwjJnD7C-NB3jNvwUGsCP89Fl_/s1600/Arduino_avrdude_IDE.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="736" data-original-width="1366" height="172" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjw3O0zyQblPL4jx-9_fUFzPWGf65g234tN7sHcOpf6daXOdyKkVixiR6Ju8WaKRJOB343FzWk8YRDZQXd9vO3GxoKCIqbrn4RymwnMPMimrEU0ipp2P-MwjJnD7C-NB3jNvwUGsCP89Fl_/s320/Arduino_avrdude_IDE.png" width="320" /></a></div>
<br />
<br />
<br />
Of course the attempt number changes as it tries 10 times.<br />
<br />
There are a few relatively obvious things that can help stop this error message.<br />
<br />
Select the right board. If you're using an Uno, select Uno. If you're using a Leonardo, select Leonardo.<br />
<br />
Select the correct processor: ATMega328 is the Uno one and the default<br />
<br />
Make sure your USB port is selected.<br />
<br />
Even after doing both of these and it all looking right you might still be getting the error message.<br />
<br />
This is where we get into a discussion about Arduino compatible boards. The Arduino is an Open Source design and so it is perfectly legal and acceptable for anyone to copy the design and make their own boards and sell them (but they cannot call it an Arduino, topic for another day)<br />
<br />
Some of these compatible boards use a different USB chip (CH340) and the ATMega328 could have a different bootloader to the actual Arduino.<br />
<br />
if you are using a compatible board that has a CH340 make sure to install the driver for the chip otherwise you may not even be able to see the board in the IDE.<br />
<br />
Then for the bootloader there is an alternative option under the Processor called "ATMega328P (Old Bootloader)" Not where I expect to see an alternative bootloader option but there it is.<br />
<br />
<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/AVvXsEg84wZ0_YLb9dpwSVr_VW9DWr4gvk5_zC0oFaLgnJZWIdUuUEZQAx0PrqH1k9HPk06ZH2-OyEiecMJzVHZHFD7cBWxs71hB5ugHZnA1MjDKuyEVIkV8EjkzwTh-a5otx8GiTJt3XUO34fwR/s1600/Arduino_avrdude_error.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="600" data-original-width="500" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg84wZ0_YLb9dpwSVr_VW9DWr4gvk5_zC0oFaLgnJZWIdUuUEZQAx0PrqH1k9HPk06ZH2-OyEiecMJzVHZHFD7cBWxs71hB5ugHZnA1MjDKuyEVIkV8EjkzwTh-a5otx8GiTJt3XUO34fwR/s400/Arduino_avrdude_error.png" width="332" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">ATMega328p (Old Bootloader)</td></tr>
</tbody></table>
<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;">
This is the one I have to use for compatible boards.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
So, once the correct board, processor, and port are selected you should be able to program your Arduino with ease.<br /><br />Finally, finally. If you're running Linux and not Windows there is one more thing to take into account and that's permissions. By default a regular user account does not have permission to read/write to USB serial ports so you have to add your user to the group with access. </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The command you need is as follows where [USERNAME] is replaced with your username.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both;">
<b><span style="font-family: Courier New, Courier, monospace;">sudo usermod -a -G dialout [USERNAME]</span></b></div>
<div>
<br /></div>
<br />
WARNING: This command is run using sudo and so has root access. It's always the right thing when finding commands online that use sudo to do your own research before blindly using the command.<br />So, here's where I got the command from <b><a href="https://www.arduino.cc/en/Guide/Linux/">https://www.arduino.cc/en/Guide/Linux/</a></b><br />
<br />
<br />
Hope you find this useful as I expect I'll be back here again when I set up my next computer or buy some new compatible boards.<br />
<br />
<br />Winkleinkhttp://www.blogger.com/profile/10921617680353539604noreply@blogger.com2tag:blogger.com,1999:blog-2902197163807965393.post-37327010794435883992019-02-28T15:55:00.000+00:002020-07-17T16:13:37.421+01:00Arduino and NRF24L01 - test code<br />
<br />
A while back I made a game using some Arduino Nano and NRF24l01 called ButtonFlash (<b><a href="https://www.winkleink.com/2016/08/buttonflash-game-made-with-raspberry-pi.html">https://www.winkleink.com/2016/08/buttonflash-game-made-with-raspberry-pi.html</a></b>)<br />
<br />
Mnadatory video showing it being played.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/P50Zw_adcwo/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/P50Zw_adcwo?feature=player_embedded" width="320"></iframe></div>
<br />
<br />
It was good fun to make and people seemed to enjoy it but it wasn't in a state for someone else to make easily and wasn't robust so running repairs were needed.<br />
<br />
But I really liked it and wanted to do a version that others could make easily.<br />
At the same time <b><a href="https://easyeda.com/" target="_blank">EasyEDA</a></b> was starting to be advertised as a simple web based PCB design tool with integration to a PCB fabrication facility so getting the boards manufactured would be super easy. So, I took the plunge and designed a PCB and had 10 of them manufactured.<br />
<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/AVvXsEiXVrHiTLLrUTB3ZcUyIHr2ITiL68t9PG027dMfmEl3nRFcJ-KJPUueM1nJs8Zf9Qu3y56ZQfqwDtsLT9Z8dIQPTUaFFL2SmatEcvleCw0wffInDQoxCvuA9OSbSTzsNz-MzB6fVhiG9RR2/s1600/Button_Flash_pair.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXVrHiTLLrUTB3ZcUyIHr2ITiL68t9PG027dMfmEl3nRFcJ-KJPUueM1nJs8Zf9Qu3y56ZQfqwDtsLT9Z8dIQPTUaFFL2SmatEcvleCw0wffInDQoxCvuA9OSbSTzsNz-MzB6fVhiG9RR2/s320/Button_Flash_pair.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Soldered up</td></tr>
</tbody></table>
<br />
I soldered a pair and started running code to test them and it kept failing. I tried different libraries and different setups and every time I couldn't get it to work reliably. This is part of the pleasure of using code and electronic components created by others.<br />
<br />
Today I figured out one of the NRF24l01 that I used can transmit but not receive. Maybe I damaged it as had power caps in the wrong way around when testing early on.<br />
<br />
I soldered up a 3rd but without the switch and LED and ignoring the bad one the pair I used were reliable today.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7d0VRyJdnLuxGP5ImD_MlS6n7AqEKL8CuCmrJmgu33Cx3-u_acbFCfmcv3w4S226lhw_AQK_x-6DBP55jCDKklzLERR0_DZZjOpZRecwGscRjpyU9ml8s1iflJx6VklCH0moWoT7RHwW1/s1600/ButtonFlash_PCB.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7d0VRyJdnLuxGP5ImD_MlS6n7AqEKL8CuCmrJmgu33Cx3-u_acbFCfmcv3w4S226lhw_AQK_x-6DBP55jCDKklzLERR0_DZZjOpZRecwGscRjpyU9ml8s1iflJx6VklCH0moWoT7RHwW1/s320/ButtonFlash_PCB.jpg" width="320" /></a></div>
<br />
<br />
Now as I tried lots of sample code and had different results with them I have prepared my own tester code.<br />
This code uses the Arduino, NRF24l01, LED attached to Pin2 (through current limiting resistor) and switch on Pin3 using internal pull up.<br />
<br />
When uploaded the Arduinos start in transmit mode.<br />
Press the switch on one and it transmits and switches to receive mode.<br />
Now you have one in transmit and one in receive mode.<br />
<br />
Pressing the switch on the transmit one and it's LED will flash 5 times and change to receive mode and the receive one will turn it's LED on full and change to transmit mode.<br />
<br />
It's amazing how much fun it is to press the switch. See the change. Then press the switch on the other one and see them swap roles.<br />
<br />
So, if you are messing with Arduino and NRF24l01 then maybe this code will be useful to help you.<br />
<br />
<a href="https://github.com/winkleink/Arduino_NRF24l01_Tester" target="_blank"><b>Code is available on GitHub </b></a><br />
<br />
<br />
Now to actually make ButtonFlash 2.0.<br />
<br />
<br />
<br />Winkleinkhttp://www.blogger.com/profile/10921617680353539604noreply@blogger.com0tag:blogger.com,1999:blog-2902197163807965393.post-17187119027231642432018-11-08T17:51:00.001+00:002018-11-08T17:55:28.240+00:00Electronics Maker Christmas stocking fillers list<br />
It's that time of year when my family ask me for ideas of presents for Christmas and my Birthday. (both December)<br />
<br />
With electronics bits being a bit specific/esoteric I stopped trusting that if I said what I wanted they would get me the right thing after I gave my wife a link without a description for a new CPU.<br />
By the time she clicked it the link redirected to a few screws. Luckily she checked before buying and I was able to get her the alternative link.<br />
<br />
So, these day I provide a wish list email with more items than I expect to get so I still have the surprise when I open the packaging as to what they give me.<br />
<br />
This year I've decided to share the list. This list may be added to as I think of more things.<br />
Before you ask things like Arduinos, Raspberry Pis, Circuit Playground boards are not on this list as these are things I have usually already got a stash of. This list is for the other bits that make those things useful. The kind of things it would be useful to have before starting a project but may not have already or may have run out of.<br />
<br />
I try to keep the items to less than £20 so for many these are good stocking fillers.<br />
<br />
<br />
<span style="background-color: white; color: #212121; font-family: sans-serif; font-size: 13px;"><b><a href="https://www.amazon.co.uk/gp/product/B01JFQVRY2?ie=UTF8&tag=thefirsteisth-21&camp=1634&linkCode=xm2&creativeASIN=B01JFQVRY2" target="_blank">USB Current Tester</a> - £4.50</b></span><br />
<div style="background-color: white; color: #212121; font-family: sans-serif; font-size: 13px;">
I buy random items off the Internet and for batteries and USB PSUs I want a way to see if they meet their stated ratings.</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://www.amazon.co.uk/gp/product/B01JFQVRY2?ie=UTF8&tag=thefirsteisth-21&camp=1634&linkCode=xm2&creativeASIN=B01JFQVRY2" target="_blank"><img border="0" data-original-height="1001" data-original-width="1001" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgACJODF8wCCDR0-IglWOjvFS_OW1wSJSrB33n_V9roOfhHJ2Rgm4kion8dAnks8sbZ8NuKdIA-mbuf8B3sBd-Hzeng2DtjBPU9RzBXYOTvhx-V75313kLRCtSFVsenKyFNWyATAKg24pRO/s320/Current_Tester_.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div style="background-color: white; color: #212121; font-family: sans-serif; font-size: 13px;">
<br /></div>
<div style="background-color: white; color: #212121; font-family: sans-serif; font-size: 13px;">
<br /></div>
<div style="background-color: white; color: #212121; font-family: sans-serif; font-size: 13px;">
<br /></div>
<div style="background-color: white; color: #212121; font-family: sans-serif; font-size: 13px;">
<br /></div>
<span style="background-color: white; color: #212121; font-family: sans-serif; font-size: 13px;"><b><a href="https://www.amazon.co.uk/gp/product/B073RG47CD?ie=UTF8&tag=thefirsteisth-21&camp=1634&linkCode=xm2&creativeASIN=B073RG47CD" target="_blank">Heat Resist Soldering Mat</a></b> - </span><span style="background-color: white; color: #212121; font-family: sans-serif; font-size: 13px;">£9.90 - £15.00 - There are bigger and smaller ones out there as well.</span><br />
<span style="background-color: white; color: #212121; font-family: sans-serif; font-size: 13px;">I have a regular A3 cutting mat but like this because of the different compartments to keep bits as I regularly drop screws and tools and hope this will help me be more organised when working on something.</span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://www.amazon.co.uk/gp/product/B073RG47CD?ie=UTF8&tag=thefirsteisth-21&camp=1634&linkCode=xm2&creativeASIN=B073RG47CD" target="_blank"><img border="0" data-original-height="1200" data-original-width="1200" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhncUNxFMoM8pSByFFj4Qdg08GmP4DGaA4eHAeW80FWcEAmSB4sLE6HVFWMIhmQRAudtTXfEIO0f62HsoPbfYu_iZ-0xWCgtAlgDMtLxU6jvmhVmO1mc_QpzaET8iOPXEzY1XHOtjKJQzcU/s320/silicone_mat.jpg" width="320" /></a></div>
<span style="background-color: white; color: #212121; font-family: sans-serif; font-size: 13px;"><br /></span>
<span style="background-color: white; color: #212121; font-family: sans-serif; font-size: 13px;"><br /></span>
<br />
<div style="background-color: white; color: #212121; font-family: sans-serif; font-size: 13px;">
<br />
<div>
<b><a href="https://www.amazon.co.uk/gp/product/B07D112W8D?ie=UTF8&tag=thefirsteisth-21&camp=1634&linkCode=xm2&creativeASIN=B07D112W8D" target="_blank">Crimping Tool with 450Pcs Connector</a></b> - £23.99 </div>
<div>
I sometimes use buttons with spade connectors and at the moment I solder the wires on which is not ideal. Want to start using the correct connectors for the correct job and not just bodge something that later causes a headache that I have to fix.</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4oKJrnE0cS5EtDV9IzorxJEZoSNG_QljHcoQvBP6NT1YR4nQ4lkYFvba4Chlv_oSCyVFJr07usIh3-hgd1Tv_lrbVLxXRToq-qUzfk0z4sjK_cK-jK46FjUKBFz3JAvCuGjA3tXfM78jp/s1600/crimp_tool_and_terminals.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1000" data-original-width="1000" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4oKJrnE0cS5EtDV9IzorxJEZoSNG_QljHcoQvBP6NT1YR4nQ4lkYFvba4Chlv_oSCyVFJr07usIh3-hgd1Tv_lrbVLxXRToq-qUzfk0z4sjK_cK-jK46FjUKBFz3JAvCuGjA3tXfM78jp/s320/crimp_tool_and_terminals.jpg" width="320" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
</div>
<span style="background-color: white; color: #212121; font-family: sans-serif; font-size: 13px;"><b><a href="https://www.amazon.co.uk/gp/product/B00Y25XFGK?ie=UTF8&tag=thefirsteisth-21&camp=1634&linkCode=xm2&creativeASIN=B00Y25XFGK" target="_blank">Anker 4-Port USB 3.0 Hub</a></b> - </span><span style="background-color: white; color: #212121; font-family: sans-serif; font-size: 13px;">£10.99 </span><br />
<span style="background-color: white;"><span style="color: #212121; font-family: sans-serif;"><span style="font-size: 13px;">Sometimes for the Raspberry Pi I need to burn multiple SD cards. The great <b><a href="https://www.balena.io/etcher/" target="_blank">Etcher</a></b> will burn multiple images at the same time so with this I can add 3 more to be burned in parallel (it's not 4 as I lose a port to connect it)</span></span></span><br />
<span style="background-color: white; color: #212121; font-family: sans-serif; font-size: 13px;"><br /></span>
<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/AVvXsEidM1gntxPLq009VS82aM4a_xCuz9-0JsXH7gO5g9HplIEijREUp2u0M-rrpbKH_UmXK6kJ0u6gghaQhc7IFR4iYNXamvImPQiP_lKzIZnOuzthxCBH6hVlfZfCIphMvNsp4L4BJDCNG-YM/s1600/usb3_hub_.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1500" data-original-width="1500" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidM1gntxPLq009VS82aM4a_xCuz9-0JsXH7gO5g9HplIEijREUp2u0M-rrpbKH_UmXK6kJ0u6gghaQhc7IFR4iYNXamvImPQiP_lKzIZnOuzthxCBH6hVlfZfCIphMvNsp4L4BJDCNG-YM/s320/usb3_hub_.jpg" width="320" /></a></div>
<span style="background-color: white; color: #212121; font-family: sans-serif; font-size: 13px;"><br /></span>
<br />
<div style="background-color: white; color: #212121; font-family: sans-serif; font-size: 13px;">
<b><a href="https://www.amazon.co.uk/gp/product/B01LZHQ9HR?ie=UTF8&tag=thefirsteisth-21&camp=1634&linkCode=xm2&creativeASIN=B01LZHQ9HR" target="_blank">Adafruit Hook-up Wire Spool Set - 22AWG Stranded-Core</a></b> - £17.93 </div>
<span style="color: #212121; font-family: sans-serif;"><span style="background-color: white; font-size: 13px;">Starting to try and be more organised so like the idea of this set of wires. I have loose spools of wire around the place so the plan is to replenish the spools when they run out.</span></span><br />
<span style="background-color: white; color: #212121; font-family: sans-serif; font-size: 13px;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://www.amazon.co.uk/gp/product/B01LZHQ9HR?ie=UTF8&tag=thefirsteisth-21&camp=1634&linkCode=xm2&creativeASIN=B01LZHQ9HR" target="_blank"><img border="0" data-original-height="900" data-original-width="1200" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfqOuGdlyEHEFRy1XX0uY5_pG9fjBmc6Sb5dqlcuBN50uO-MIV_XfECfev4LyoygaskbVoBwJYhT09iuzt7Hn0-5aKnAdvRgJUPK6IBir9n0FwzxAqQkWrFj9kfSbX5JlC5tW1C8RUc75o/s320/wires_.jpg" width="320" /></a></div>
<div style="background-color: white; color: #212121; font-family: sans-serif; font-size: 13px;">
<br /></div>
<div style="background-color: white; color: #212121; font-family: sans-serif; font-size: 13px;">
<br />
<b><a href="https://www.amazon.co.uk/gp/product/B01EV70C78?ie=UTF8&tag=thefirsteisth-21&camp=1634&linkCode=xm2&creativeASIN=B01EV70C78" target="_blank">20pcs Multicolored Dupont Wire 40pin Male to Female, 40pin Male to Male, 40pin Female to Female Breadboard Jumper Wires</a></b> - £5.95</div>
<div style="background-color: white; color: #212121; font-family: sans-serif; font-size: 13px;">
Saying that I still do breadboard stuff so it's always good to replenish the stock of Dupont jumper wires.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://www.amazon.co.uk/gp/product/B01EV70C78?ie=UTF8&tag=thefirsteisth-21&camp=1634&linkCode=xm2&creativeASIN=B01EV70C78" target="_blank"><img border="0" data-original-height="1500" data-original-width="1500" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyk38Z_kvR5aqaPJS-csDuWefbiJfH7L1GuoYUpHV6SG8b89JZ-WW9FcEpmhpgcPhoKgrtj97DZiQ0fSRJiqPRQ7B9nc7WNXN8m-ybnBfN3BL3svyLTSdrkxgbrJmrPD3RAcylOhT3YT-6/s320/jumperwires.jpg" width="320" /></a></div>
<div style="background-color: white; color: #212121; font-family: sans-serif; font-size: 13px;">
<br /></div>
<div style="background-color: white; color: #212121; font-family: sans-serif; font-size: 13px;">
<br /></div>
<div style="background-color: white; color: #212121; font-family: sans-serif; font-size: 13px;">
<br /></div>
<div style="background-color: white; color: #212121; font-family: sans-serif; font-size: 13px;">
<b><a href="https://www.amazon.co.uk/gp/product/B00R1LLM1M?ie=UTF8&tag=thefirsteisth-21&camp=1634&linkCode=xm2&creativeASIN=B00R1LLM1M" target="_blank">2.54mm 2x20 40-Pin Female Pin Header Socket Connector Strip 10 Pcs</a></b> - £1.94</div>
<div style="background-color: white; color: #212121; font-family: sans-serif; font-size: 13px;">
Having recently committed a project to an actual prototyping board rather than using a breadboard I want to do more of that for my Raspberry Pi projects so need a bunch of 2x20 female connectors to hand. Last one I used I 'borrowed' form a Kickstarter I backed, so that's now an incomplete kit.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://www.amazon.co.uk/gp/product/B00R1LLM1M?ie=UTF8&tag=thefirsteisth-21&camp=1634&linkCode=xm2&creativeASIN=B00R1LLM1M" target="_blank"><img border="0" data-original-height="1100" data-original-width="1100" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivFDBxM6sBHbHR9a4zHowwksDNfacrIMwZdDKMrs1H97aFibXNxiKn34kKy1_4pdFFcWPFzOsvAVOfOFAknVeC5uelTdtfs6R9fPVsQ9KOBel_VanJWtRiz-4BTQ_s2Gac7RseUV7LvLXb/s320/40pin+female_SL1100_.jpg" width="320" /></a></div>
<div style="background-color: white; color: #212121; font-family: sans-serif; font-size: 13px;">
<br /></div>
<div style="background-color: white; color: #212121; font-family: sans-serif; font-size: 13px;">
<br /></div>
<div style="background-color: white; color: #212121; font-family: sans-serif; font-size: 13px;">
<b><a href="https://www.amazon.co.uk/gp/product/B073S9SFK2?ie=UTF8&tag=thefirsteisth-21&camp=1634&linkCode=xm2&creativeASIN=B073S9SFK2" target="_blank">SanDisk Ultra 16GB microSDHC Memory Card + SD Adapter</a></b> - £5.99</div>
<div style="background-color: white; color: #212121; font-family: sans-serif; font-size: 13px;">
<div>
I'm always looking for microSD cards, so every year I add them to the stocking filler list.</div>
<div>
They're small and I'm clumsy so replenishing stock is an ongoing activity. </div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://www.amazon.co.uk/gp/product/B073S9SFK2?ie=UTF8&tag=thefirsteisth-21&camp=1634&linkCode=xm2&creativeASIN=B073S9SFK2" target="_blank"><img border="0" data-original-height="1092" data-original-width="1500" height="232" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4jl2oQjtYvkSAfTDU4AMg6YnHM6z5PH_FLkU_xrd4tL68jhDQJqCzPlBGlWHY4LGee8gyyzTZZghQME8Qck_Myk7fmC4tEm-cFidwh87BbIXo97fQYUSN6wa_ijVDzHyMWuEH7InVkB6o/s320/16gb_microsd.jpg" width="320" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
</div>
<br />Winkleinkhttp://www.blogger.com/profile/10921617680353539604noreply@blogger.com1tag:blogger.com,1999:blog-2902197163807965393.post-82172042826016895272018-08-24T09:13:00.000+01:002018-08-24T09:13:07.530+01:00Workbench in the garageI've been meaning for a while to set up a permanent workspace for doing electronics and finally cleared a corner of the garage.<br />
<br />
Once cleared I of course needed a workbench and whenever I searched on line this steel bench kept coming up. Listed on the <b><a href="https://ebay.to/2BG1vzG" target="_blank">UK eBay for about £50</a> </b>which to me seemed like an OK price to pay for a bench with main surface size of 120cm x 59cm and with a drawer the full length of the bench.<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://ebay.to/2BG1vzG" target="_blank"><img border="0" data-original-height="1000" data-original-width="1000" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRUKvWY5m_uOuM8sqpt_1_d4e5WrCTSquTnUkZHDN27QYTzzEtIiDbARSuySymxMtauQAbQVfbjuoOUjgci7vVr0Ab72mRnwdvSSnTDqb2O3zUmt8ILmUnQ8DVuT-IfGNglXrfqM9FvAYl/s320/workbench.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
I asked on Twitter what it was like and a few people replied that the metal is quite light but it's sturdy once built.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
I got one and for £50 I think it's definitely worth the price.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The metal frame is not the strongest or thickest metal I've seen and without the wood tops being in place it does flex. I expected to have to add braces at the side and back but in the end they are not needed as once the work surface and other wooden pieces are added it gets nice and rigid.</div>
<div class="separator" style="clear: both; text-align: left;">
One thing to be aware of is the wood is MDF and so has limited strength in itself.</div>
<div class="separator" style="clear: both; text-align: left;">
The lower shelf on mine is flexing already due to the boxes I have on it. I note this in the video below and also my plan to add some wooden battens to support the lower shelf.</div>
<div class="separator" style="clear: both; text-align: left;">
The lower shelf and the work surface are not screwed down and are held in by the frame so it will be easy enough to lift out the self add the battens and put the the shelf back on.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The draw was also pointed out to be quit flimsy and I agree. It's not robust but it works and for tool and storage for light parts it will do the job. Again the base on the drawer is MDF.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The back pegboard on mine is slightly bowing out. Not sure if I've done something wrong or if it's the kit. The top shelf is OK. Again I'm not expecting it to take much weight but as a place for odd small bits it will work well. It's also high enough above the main work surface that it should be ideal for adding additional lighting in the future. Maybe some RGB LED strips </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Finally, the instructions are really poor. The kit I received wasn't missing any parts but let's say with my flat pack skills it took me a fair while to get it all together. </div>
<div class="separator" style="clear: both; text-align: left;">
The one tip I'd give is watch the number of holes in the metal parts to figure out which way is up.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
So, overall I'm very happy with the bench. I've used it a fair bit since getting it and I like the size. Much smaller and it would be a challenge to have equipment out and have a decent sized work surface. (There is a smaller sized version that's 81cm x 41cm and from searching eBay there are also versions without the back and top shelf.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Finally, here's a video of the bench so you can see what it's really like.</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: center;">
<iframe width="320" height="266" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/X5Y4mjQeTHA/0.jpg" src="https://www.youtube.com/embed/X5Y4mjQeTHA?feature=player_embedded" frameborder="0" allowfullscreen></iframe></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Onward and upwards with the making. </div>
<br />Winkleinkhttp://www.blogger.com/profile/10921617680353539604noreply@blogger.com0tag:blogger.com,1999:blog-2902197163807965393.post-53813057347150942462018-08-21T17:21:00.000+01:002018-08-21T17:22:48.777+01:00Shakey Shakey - a game using title switchesFor the most recent Egham Raspberry Jam <a href="https://twitter.com/EghamJam" target="_blank"><b><span style="color: black;">@EghamJam</span></b></a> we did two workshops.<br />
One was NoPi Blinky, making LEDs blink without any programming. More to come on this as during the workshop we found a few typos.<br />
<br />
The other was Shakey Shakey.<br />
<br />
For the workshops my goal is to do something slightly different that not only teaches the attendees something new from either a programming or electronics standpoint but also shows them creative options.<br />
<br />
Shakey Shakey was based around really simple tilt switches. They're basically a small tube with a contact inside that moves as you tilt the tube. Really simple and really cheap. On <a href="https://ebay.to/2LdH5xe" target="_blank"><b><span style="color: black;">eBay UK they're about £1.50 for 20</span></b></a>. So, ideal when you need a bunch for the Jam<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgk2fl-4AmnCRpZRnK0U4SMjNbPqofJFTWQytsFxiuNxQxERNz5UwSRwHrN0Qu6ZXPzyf-DPM385YQfXdBLEmHYOcGhQB5ScN6UuVt9WGkByHgs-5G3quzrBf8LfhP35xDAXQJAm3LD5Bta/s1600/tilt_switch.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Tilt Switch" border="0" data-original-height="800" data-original-width="800" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgk2fl-4AmnCRpZRnK0U4SMjNbPqofJFTWQytsFxiuNxQxERNz5UwSRwHrN0Qu6ZXPzyf-DPM385YQfXdBLEmHYOcGhQB5ScN6UuVt9WGkByHgs-5G3quzrBf8LfhP35xDAXQJAm3LD5Bta/s320/tilt_switch.jpg" title="Tilt Switch" width="320" /></a></div>
<br />
The only other things needed then were some female-female jumper wires and some 2 core wire.<br />
I cut the female-female wires in 2 giving me a pair of wires that had the female connectors on one end and bare wire the other. Cut the 2 core wire into about 150cm lengths and used them to connect the switch to the other wires giving a nice long wire for the kids to shake without (hopefully) unplugging the wires or pulling on the Raspberry Pi.<br />
<br />
With the hardware sorted I them did the worksheet which is available to <span style="color: black;"><a href="https://github.com/winkleink/RJam-Worksheets" style="font-weight: bold;" target="_blank">download from GitHub</a><b> </b>along with other Jam worksheets</span>.<br />
<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;"><span style="margin-left: auto; margin-right: auto;"><a href="https://github.com/winkleink/RJam-Worksheets" target="_blank"><img border="0" data-original-height="840" data-original-width="834" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOYwU60UMXsGZ_wDQEGbhwieM-lnfdqDFDCdSb2oXCjuOrf6a1B4UV98SOQEl1ziH5UyGJZtlsWRx9UbsA5vF-kwNLRXim02xGM7ALQPJR2J7EVdHRGpt8czWFv1cySWWvLesP8Sa_CaQv/s320/shakey_shakey_image.PNG" width="317" /></a></span></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><a href="https://github.com/winkleink/RJam-Worksheets" target="_blank"><b><span style="color: black;">Shakey Shakey worksheet</span></b></a></td></tr>
</tbody></table>
The worksheet goes through:<br />
<br />
<ul>
<li>Connecting a tilt switch</li>
<li>Python code to read the switch and display how many times it connects</li>
<li>Adding a pause to deal with debouncing</li>
<li>Adding a second tilt switch</li>
<li>Updating the code so the switches have to be activated alternatively</li>
<li>Final update of the code to add a timeline making it into a game</li>
</ul>
<br />
We had a full workshop and the kids who took parts seemed to really enjoy the coding and then playing the new game they created.<br />
<br />
At the end I challenged the participants to come back to the next Egham Raspberry Jam (<a href="https://eghamjam20.eventbrite.co.uk/" target="_blank"><b><span style="color: black;">21st October 2018</span></b></a>) with their own program that uses the same tilt switch controllers. The worksheet at the end gives some suggestions. Here's looking forward to the 21st of October to see what fantastic creative ideas the kids come up with.<br />
<br />
<br />
<br />
<br />
<br />Winkleinkhttp://www.blogger.com/profile/10921617680353539604noreply@blogger.com0tag:blogger.com,1999:blog-2902197163807965393.post-26413254165832985972018-06-19T10:13:00.001+01:002018-06-19T10:35:24.761+01:00Cat or Dino- Scratch 2.0 game <br />
<br />
I saw a tweet from the <b><a href="https://twitter.com/Raspberry_Pi" target="_blank">@Raspberry_Pi</a></b> Foundation about a game called Knifey Spoony by <a href="https://twitter.com/Jonic?ref_src=twsrc%5Etfw"><b>@Jonic</b></a> one of their senior web developers did using pico-8.<br />
<br />
<br />
<blockquote class="twitter-tweet" data-lang="en">
<div dir="ltr" lang="en">
Our Senior Web Developer <a href="https://twitter.com/Jonic?ref_src=twsrc%5Etfw">@Jonic</a> just released a game called Knifey Spoony.<br />
Playing Knifey Spoony will be all you do today.<br />
Knifey Spoony is your life now.<br />
Life is Knifey Spoony.<br />
Knifey Spoony.<br />
🔪🥄 <a href="https://t.co/wTOvwkeU92">https://t.co/wTOvwkeU92</a></div>
— Raspberry Pi (@Raspberry_Pi) <a href="https://twitter.com/Raspberry_Pi/status/1008644278724284416?ref_src=twsrc%5Etfw">June 18, 2018</a></blockquote>
<script async="" charset="utf-8" src="https://platform.twitter.com/widgets.js"></script>
<br />
<br />
<br />
The idea of the game is to select if the image is a spoon or a knife as quickly as you can with a timer running getting faster and faster the higher your score, so the pressure is on.<br />
<br />
I thought this could be done with Scratch, so I fired up Scratch 2.0 and had a go.<br />
<br />
Here is the result. It uses only built in graphics making it easy for anyone to replicate and extend.<br />
<div style="text-align: left;">
It is done with Scratch 2.0 but there is nothing special so it should work with Scratch 1.4 on the Raspberry Pi as well.<br />
<br />
<b>https://scratch.mit.edu/projects/229582133</b><br />
<br /></div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: center;">
<iframe allowfullscreen="" allowtransparency="true" frameborder="0" height="402" src="//scratch.mit.edu/projects/embed/229582133/?autostart=false" width="485"></iframe>
</div>
<br />
<br />Winkleinkhttp://www.blogger.com/profile/10921617680353539604noreply@blogger.com0tag:blogger.com,1999:blog-2902197163807965393.post-62891396572583399322018-02-21T20:49:00.003+00:002018-02-21T20:49:50.011+00:00PiGPIOPin - when you want to use pin numbers and not BCM on the Raspberry Pi in PythonA while back I was doing some bare Arduino compatible boards using the ATMega328 chip. From this I saw that Arduino did not map the pins on the IC to the same numbers on the Arduino. They used a simple order on the Arduino board and the Arduino ID so it was easy to find the right pin for wiring and also for your code.<br /><br />Only problem is when you use the chip with the bootloader the mappings are different to the pin number so you need a lookup tool to know when you want to use Arduino Pin 13 that it's ATMega Pin 19.<br />After a while this became a bit annoying so I put together an .h file with a bunch of constants that got around this.<br />
<br />
<b><a href="http://www.winkleink.com/2014/01/arduinopinsh-converts-atmega328-pins.html">http://www.winkleink.com/2014/01/arduinopinsh-converts-atmega328-pins.html</a></b><br />
<br />
On the Raspberry Pi there is a similar situation. The default numbering mechanism used is the BCM numbering which is great if you're operating at chip level, but at a board level it means things like:<br />
<br />BCM GPIO 5 is board pin 29<br />
<br />
I still have to count pins to get to board pin 29, so having to also know it's then GPIO 5 in my code can sometimes be a bit annoying.<br />
<br />
The original RPi.GPIO library allows you to choose BCM or Board numbers<br />
<br />
<span style="font-family: Courier New, Courier, monospace;"> import RPi.GPIO as GPIO </span><br />
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<span style="font-family: Courier New, Courier, monospace;">GPIO.setmode("GPIO.BCM")</span><br />
or<br /><span style="font-family: Courier New, Courier, monospace;">GPIO.mode("GPIO.BOARD")</span><br />
<br />
Giving the user the choice.<br />
<br />
With the fantastic <b><a href="https://gpiozero.readthedocs.io/en/stable/" target="_blank">GPIOZero</a></b> BCM numbering is enforced and there is no option to use board numbering.<br />
GPIOZero is a great library and makes controlling motors, working with MCP3008 (analog input) and distance sensors a lot easier.<br />
<br />
For those who want to use board pin numbers and want to take advantage of GPIOZero the use of the BCM numbering can be annoying.<br />
<br />
To make it easier I decided to do a similar lookup table like I did for the Arduino.<br />
Mapping Pin number variables to BCM numbers.<br />
<b><a href="https://github.com/winkleink/PiGPIOPin" target="_blank">The code and an example is on GitHub.</a></b><br />
<br />
It's straight forward to use.<br />
<br />
Have PiGPIOPin.py in the same folder as your code or in the python path.<br />
<br />
Put the following line at the top<br />
<br />
f<span style="font-family: Courier New, Courier, monospace;">rom PiGPIOPin import *</span><br />
<br />
Then instead of using something like<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">red = LED(17) # 17 is the BCM number that is at board pin 11</span><br />
<br />
use<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">red = LED(PIN11) </span><br />
<br />
Each BCM number is mapped a PIN* variable.<br />
<br />
The rest of the code then works as normal.<br />
<br />
Using this gives the option back to use board pin numbers and not BCM numbers.<br />
<br />
<br />
<br />
<br />
<br />Winkleinkhttp://www.blogger.com/profile/10921617680353539604noreply@blogger.com0tag:blogger.com,1999:blog-2902197163807965393.post-25795017346263953002018-02-08T18:40:00.005+00:002018-02-08T18:55:47.002+00:00More cheap stuff from eBay - Gaming Player Handheld Video Tetris Game Console Kids Children Boy Portable Toy<br />
<br />
I'm drawn to the underside of eBay. The placed where strange bits of electronics are sold. This interest comes from making things and needs odd bits of electronics to realise my (awful) creations.<br />
<br />
On one of my regular trawls of ebay I found this.<br />
<br />
<span style="color: #333333; font-family: "helvetica neue" , "helvetica" , "verdana" , sans-serif; font-size: 18px; font-weight: 700;"><a href="http://ebay.to/2H1V1tw" target="_blank">Gaming Player Handheld Video Tetris Game Console Kids Children Boy Portable Toy</a></span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://ebay.to/2H1V1tw" target="_blank"><img border="0" data-original-height="800" data-original-width="800" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUEoR7ZB74gQ5Lt_EkP6dTSx9bZzWx63WB90jHDo0iEkpXbh-9sOh7DSqZEjegcAR_xvY3arwqocwUbKo5-GtPmofhFdYY0RE5qEGtGWslsn5eYGcOrBzt9gU5hyphenhyphen7HflbzpyZS0c1Mi77U/s320/Tetrisjpg.jpg" width="320" /></a></div>
<br />
<br />
Looked interesting. OK the display is obviously mono-colour LED and not back lit but for £1.39 I thought it was worth a punt.<br />
<br />
From the Listing the dimension are:<b> Product size: 14*8*2cm</b><br />
Bigger than the Sony PSP Go 12.8*6.9*1.64cm<br />
If Sony can squeeze a 4.3" widescreen display in the PSP Go then this could be a very useful case to work from. A nice sized case with 10 buttons.<br />
<br />
For reference a Raspberry Pi Zero is 6.5cm x 3 cm. An easy fit and with dimensions greater than the PSP Go one of the many 3.2" LCD displays I see running from a Pi should fit nicely.<br />
<br />
£1.39 for a case with 10 buttons that should easily take a Raspberry Pi Zero and 3.2 " screen with space for other bits is a bargain.<br />
<br />
I see a plan coming together so I ordered one two weeks ago and it arrived today.<br />
<br />
The packaging is the same as the listing which is always a good start.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicsP3oyN8-JzqEWQoccXCxJ27PlmN0LclnWljWWvXbs8y-Vvgq5xHmqXovShrUrcYgNY-QewxeA9dsEEjy6Zj9mEIuSWxFDZeOIBslqsfDaQDpA6TU3_wJTV92srxydrMe7BqKtTutUtnD/s1600/IMG-5535.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicsP3oyN8-JzqEWQoccXCxJ27PlmN0LclnWljWWvXbs8y-Vvgq5xHmqXovShrUrcYgNY-QewxeA9dsEEjy6Zj9mEIuSWxFDZeOIBslqsfDaQDpA6TU3_wJTV92srxydrMe7BqKtTutUtnD/s320/IMG-5535.JPG" width="320" /></a></div>
<br />
<br />
Opened the box and inside was the actual console. OK a bit rough and the sticker isn't straight. Not a problem as I plan to remove all that anyway.<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOBxQKYrSdwV3PEfuHo6Fcb3RVRtgoWSfGIsI7utwtGzIkn4_GL6BL3blJqGKtoyHyzO8vnRegilHauTJj6bTdOc6GPy27plyrXfVcU9SQMpHmy-J_NrYJ_Ixj85LscKcAXpmVmqhX59EC/s1600/IMG-5537.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOBxQKYrSdwV3PEfuHo6Fcb3RVRtgoWSfGIsI7utwtGzIkn4_GL6BL3blJqGKtoyHyzO8vnRegilHauTJj6bTdOc6GPy27plyrXfVcU9SQMpHmy-J_NrYJ_Ixj85LscKcAXpmVmqhX59EC/s320/IMG-5537.JPG" width="320" /></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;">
But there was something else not right. I checked the listing again and confirmed the dimension <b>Product size: 14*8*2cm</b></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The dimensions on the actual one I received seem a bit off. Annoyingly I don't have a ruler with me at the moment so I'm using AAA (not AA) as the standard measure.</div>
<br />
An AAA battery according to <b><a href="https://en.wikipedia.org/wiki/AAA_battery" target="_blank">Wikipedia </a>is </b>4.45cm long.<br />
<div class="separator" style="clear: both; text-align: left;">
From the picture below it looks like this may not be 8cm wide or 14 cm in length.</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: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4TnwvBalpHKBJi4mw9zMXauuc54t3lyOn7whxND1dro_uy_UcvAja5lcmGnaWLZ51EPtrQtUrdKBcgGkA7X7n2dLGAi2SLTVMHVBj_yOQK4mD6dpyO-nGZLY_E4QhtM4LhhjIp1uHCMha/s1600/IMG_5541.HEIC" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4TnwvBalpHKBJi4mw9zMXauuc54t3lyOn7whxND1dro_uy_UcvAja5lcmGnaWLZ51EPtrQtUrdKBcgGkA7X7n2dLGAi2SLTVMHVBj_yOQK4mD6dpyO-nGZLY_E4QhtM4LhhjIp1uHCMha/s320/IMG_5541.HEIC" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
It is more like 9cm in length so a Raspberry Pi Zero may still fit inside and 5cm in width.<br />
There goes the plans for a 3.2" LCD display. Maybe one of the <a href="http://ebay.to/2EbcYI3" target="_blank">0.96" OLED displays</a> might fit.<br />
<br />
<br />
I almost forgot. What about the 999 games.<br />
It does have Tetris, a variety of Breakout games, a Tank combat game and a Driving game.<br />
<br />
The driving game is especially bad as there are only 2 lanes and you just move from left to right as the cars come down the screen.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3-AnkhoBcDieE6wgYhK5DGQdl9tZZzzgBNQo5fsRphhl9lZdMaIiu_JSvn9JuZGqYdLCn1EBFuTssD5ErOeiAuOcvP8O5Vc3X-OekfWAZWp0gLwatkJ5lPTfddGkxvS4tfUlrlgkTICi-/s1600/IMG_5544.HEIC" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3-AnkhoBcDieE6wgYhK5DGQdl9tZZzzgBNQo5fsRphhl9lZdMaIiu_JSvn9JuZGqYdLCn1EBFuTssD5ErOeiAuOcvP8O5Vc3X-OekfWAZWp0gLwatkJ5lPTfddGkxvS4tfUlrlgkTICi-/s320/IMG_5544.HEIC" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<br />
<br />
<b>In summary how does it compare to the listing title.</b><br />
<br />
<a href="http://ebay.to/2H1V1tw" style="font-family: "Helvetica neue", Helvetica, Verdana, sans-serif; font-size: 18px; font-weight: 700;" target="_blank">Gaming Player Handheld Video Tetris Game Console Kids Children Boy Portable Toy</a><br />
It is a game playing handheld video Tetris Game Console.<br />
No kids, children or boys included, but it definitely is portable and a toy.<br />
<br />
As an added bonus you also get the amazing driving game, breakout and tank combat games, so in a way it over delivers on the gaming promise. I didn't count whether there are 9999 but I suspect we all know the answer to that.<br />
<br />
But, if your reason for getting it is to have a 14cm x 8cm x 2cm case with an opening to put a 3.2" display and a Raspberry Pi Zero you will be very disappointed as it's most definitely a lot smaller than the listing.<br />
<br />
It is held together with screws so maybe a teardown is needed to see what's inside and if there is anything I can salvage from it.<br />
<br />
<br />
<br />
<b>UPDATE:</b><br />I think I may have found an actual correct listing for the one I purchased<br />
<b><a href="http://www.ebay.co.uk/itm/272730431909">http://www.ebay.co.uk/itm/272730431909</a></b><br />
Listing states the dimensions are: 10 x 4.5 x 2.4cm<br />
<br />
Then there's also this listing for £1.79<br />
<b><a href="https://www.ebay.co.uk/itm/222452404318">https://www.ebay.co.uk/itm/222452404318</a></b><br />
With the dimension listed as: 15.5*6.5*2.5cm<br />
<br />
If the larger one really is those dimensions then a project may be on to use it as a shell for something more fun.<br />
<br />
<br />
<br />
<br />
<br />Winkleinkhttp://www.blogger.com/profile/10921617680353539604noreply@blogger.com0tag:blogger.com,1999:blog-2902197163807965393.post-31323811722954451502017-11-09T18:45:00.001+00:002017-11-09T18:45:13.555+00:00White Wii Nunchuck shaped Bluetooth Joystick - £1.85/£1.99 on eBayWhen I attended <a href="http://piwars.org/" style="font-weight: bold;" target="_blank">PiWars </a>(a great event for people who like to build robots using the Raspberry Pi)<b> </b>earlier this year I saw a whole range of controllers being used for controlling Raspberry Pi based robots. With many using USB dongle ones and others using Bluetooth or even apps on phones. Expecting to see some <b><a href="http://bluedot.readthedocs.io/en/latest/" target="_blank">BlueDot </a></b>next year a great Android App for controlling things over Bluetooth.<br />
<br />
Since my phone is iPhone (too long to explain) BlueDot isn't an option for me and with my continuing goal of finding cheap solutions to a problem I found a<b><a href="http://ebay.to/2hoDzap" target="_blank"> £1.85 Bluetooth controller from eBay - 3D Bluetooth Virtual Reality Glasses VR BOX Game Remote Control Gamepad Handles</a></b><br />
<br />
What I liked about it is that it uses AAA batteries so if at an event the batteries died I could swap them out. No need to wait for recharging.<br />
<div>
<br /></div>
It's billed as being for mobile gaming and virtual reality and no mention of working with a regular computer or even Raspberry Pi, so I took a punt for £1.85, well actually £3.70, as I bought two. (walking on the wild side). <br />
<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/AVvXsEipVW_EKN4WiVdI3fegrmEqNbuQN3Bh-Qxm3iV_PCmMbbZGqdteX0axUXGFDLR84ZgYQ1wP3ofI2iLXXtFe7kZQOsruBzToFc14prD5wveawAuY9PbBtAxhQQl7Cizr-otYNSudwuMxNVeQ/s1600/VR_box_order.PNG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="347" data-original-width="784" height="141" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipVW_EKN4WiVdI3fegrmEqNbuQN3Bh-Qxm3iV_PCmMbbZGqdteX0axUXGFDLR84ZgYQ1wP3ofI2iLXXtFe7kZQOsruBzToFc14prD5wveawAuY9PbBtAxhQQl7Cizr-otYNSudwuMxNVeQ/s320/VR_box_order.PNG" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">eBay order confirmation</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<b>NOTE</b>: The listing I bought from has ended but the <b><a href="http://ebay.to/2Apd7BB" target="_blank">same seller has a new listing at £1.99</a></b><br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
I've seen some similar listing with switches on the side. This is not the model I have bought. Mine has no switch.<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://ebay.to/2hoDzap" style="margin-left: auto; margin-right: auto;" target="_blank"><img border="0" data-original-height="369" data-original-width="500" height="235" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhncI-HJPOnEt9anpygzNL-5l2gXEzZXjwkDA3iJCiSbWeQdy5HHFp4V5aPr8zedL_wUyg7FoBnwxkjs2FMJUPN3T6HruWzHJb4so3lwad2vOKWttGql7hkBjkM8UCiJtPldihQr0v1olzC/s320/white+nunchuck+bluetooth+gamepad.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">What it looks like on eBay listing</td></tr>
</tbody></table>
<br />
They arrived and actually look good. Plastic is definitely cheap, but they don't feel flimsy.<br />
Below are a couple of pictures of the real thing. A little different to the render but I'm happy..<br />
<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/AVvXsEgTmnwZ-3_i2YSPeIX242L79Roejy_tDWKtL-theh_Cv_V99D9TL24o1lwg-j794Cu6mwdM1bIJwwlYbGZt8-UY4gD1sI9POBm8kW12YVq647Sp57rV7DaJjSJFLL8zt4k0G1MZ6spQGlHX/s1600/IMG_5151.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTmnwZ-3_i2YSPeIX242L79Roejy_tDWKtL-theh_Cv_V99D9TL24o1lwg-j794Cu6mwdM1bIJwwlYbGZt8-UY4gD1sI9POBm8kW12YVq647Sp57rV7DaJjSJFLL8zt4k0G1MZ6spQGlHX/s320/IMG_5151.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Top. Joystick, power button, mode change button and 4 facing buttons.</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<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/AVvXsEgR6Xqdwgqy3m-m3qjE6wpJ-JqMXeT1LYmWNSx2dPZ5cb2M4IdWKSo4bDZz2GgoK1OMXvjV0BQin41FDlpz_8eqlwy5vHnKhC_vmo7y2Uo__h6jhd2pbMBthi2HRS2ZTowP5v05sskgoU4T/s1600/IMG_5152.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgR6Xqdwgqy3m-m3qjE6wpJ-JqMXeT1LYmWNSx2dPZ5cb2M4IdWKSo4bDZz2GgoK1OMXvjV0BQin41FDlpz_8eqlwy5vHnKhC_vmo7y2Uo__h6jhd2pbMBthi2HRS2ZTowP5v05sskgoU4T/s320/IMG_5152.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Front has 2 additional buttons for when held straight rather than sideways</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: left;">
Time to start testing.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Setting up a new Raspbian image and using Raspberry Pi ZeroW I added the two AAA batteries and it came on. Blue light flashes to say ready to pair.</div>
<br />
Using the Bluetooth Add Device in Raspbian the device VR BOX was found and paired successfully. The unusal name actuallymakes sense as the listing on eBay is for "3D Bluetooth Virtual Reality Glasses <b>VR BOX</b> Game Remote Control Gamepad Handles"<br />
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<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/AVvXsEjzUocjPu0zwXn-96VjkJsEigwhRAY0q4NGxnj9AgeXLS1nstXDUCxdsd1AcPCLNpb84mPPvkl7aqZw7oYS6by3-Xt6vslpitduU9OyKR2SPLowRQwR7xB5VxsYObjaUqMhZyiNPSXrNHaO/s1600/IMG_5153.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzUocjPu0zwXn-96VjkJsEigwhRAY0q4NGxnj9AgeXLS1nstXDUCxdsd1AcPCLNpb84mPPvkl7aqZw7oYS6by3-Xt6vslpitduU9OyKR2SPLowRQwR7xB5VxsYObjaUqMhZyiNPSXrNHaO/s320/IMG_5153.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Bluetooth on Raspbian paired with VR BOX</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
From the eBay listing and the single sheet of instructions the Gamepad/Nunchuck has 4 modes that you select with a combination of the @ and the relevant button.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="background-color: white; font-family: "arial"; font-size: 13px;">A : Function Select (Music Video Mode.)</span></div>
<div style="background-color: white; font-family: Arial, Helvetica, sans-serif; font-size: 13px;">
<span style="font-family: "arial";">B : Function Select (game mode)</span></div>
<div style="background-color: white; font-family: Arial, Helvetica, sans-serif; font-size: 13px;">
<span style="font-family: "arial";">C : Function Selection (VR video self-timer mode.)</span></div>
<div class="separator" style="clear: both;">
<span style="background-color: white; font-family: "arial"; font-size: 13px;">D : Function Select (mouse self-timer mode.)</span></div>
<div class="separator" style="clear: both;">
<span style="background-color: white; font-family: "arial"; font-size: 13px;"><br /></span></div>
<div class="separator" style="clear: both;">
<span style="background-color: white; font-family: "arial"; font-size: 13px;">It starts up in Music mode, so to use as a gamepad you have to change this after it pairs.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
As I wanted to test in game mode I did [@]+[B]</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
I previously created a small python/pygame program to help with the testing. <b><a href="https://github.com/winkleink/pygame_test_gamepad" target="_blank">It's available on GitHub</a>.</b></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
I downloaded it to the PiZeroW (one of these days I'll do the proper git clone thing) and ran the program.</div>
I run from the command line as the terminal window prints the details in text while the pygame window gives a graphic representation of the gamepad so I can see if multiple button presses are possible and which button numbers are pressed. The code includes an analogue joystick so it will show the full range of movement for the gamepad joystick.<br />
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<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/AVvXsEjDUgBjREaG3G6pfe5uzrP4ZSDERE6Vs2Bt-pHsXoE6bn4AgBI8bcWqMawzx9PT1abhhLEF8-AMt3TTmbcXDcFg-5MckMMan3fFk7_NPKx0IcrWj3vGInjcpbmsALU9F3stSYGpqU4sPSDs/s1600/IMG_5150.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDUgBjREaG3G6pfe5uzrP4ZSDERE6Vs2Bt-pHsXoE6bn4AgBI8bcWqMawzx9PT1abhhLEF8-AMt3TTmbcXDcFg-5MckMMan3fFk7_NPKx0IcrWj3vGInjcpbmsALU9F3stSYGpqU4sPSDs/s320/IMG_5150.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">python2/pygame gamepad tester</td></tr>
</tbody></table>
<br />Pressing the buttons the appropriate red square appeared and the terminal window stated which button was pressed or released. Success! It's being detected as a gamepad and the buttons are working.<br />
<br />
I then used the joystick which looks like an analogue stick you see on many projects. Only it's not. The joystick is digital. Up, Down,Left,Right. No range in values. Except for a strange thing.<br />
The positive values are 0.999969482422 and the negative values are -1, so you can't test for 1 for down and right when in gamepad (sideways) mode as 0.999969482422 is not 1. A little gotcha for coding.<br />
<br />
<b><u>The different modes</u></b><br />
<br />
As listed above there are 4 different modes for the controller.<br />
<br />
<b>[@]+[A] for music</b><br />
Nothing happened on the Pi. I haven't figured out what Bluetooth Music Mode is yet.<br />I tried this mode with my phone and it does provide volume up/down, mute an play so does what is expected with the target device.<br />
<br />
<b>[@]+[B] game mode</b><br />
This is gamepad in horizontal mode, like a traditional controller with the joystick on the left and the buttons on the right.<br />
For example, if you push up the Up joystick is detected<br />
<br />
<b>[@]+[C] <span style="background-color: white; font-family: arial; font-size: 13px;">VR video self-timer mode</span></b><br />
<span style="background-color: white;"><span style="font-family: arial;"><span style="font-size: 13px;">This is a gamepad in Nunchuck mode. So vertical.</span></span><br /><span style="font-family: arial;"><span style="font-size: 13px;">For example, if you have the controller held vertically and press up then Up Joystick is detected.</span></span></span><br />
<span style="background-color: white;"><span style="font-family: arial;"><span style="font-size: 13px;">All the buttons are the same as for game mode.</span></span></span><br />
<span style="background-color: white;"><span style="font-family: arial;"><span style="font-size: 13px;"><b><br /></b></span></span></span>
<b><span style="background-color: white;"><span style="font-family: arial;"><span style="font-size: 13px;">[@]+[D] </span></span></span><span style="background-color: white; font-family: arial; font-size: 13px;">mouse self-timer mode</span></b><br />
<span style="background-color: white; font-family: arial; font-size: 13px;">Guess what the joystick operates like a mouse held like a Nunchuch (vertical) with the lower front button (trigger) being left click and the higher front button (trigger) being right click.</span><br />
<span style="background-color: white; font-family: arial; font-size: 13px;">In mouse mode buttons A and B still get recognised as gamepad buttons so that could be useful.Not sure how or when but extra buttons are always useful. </span><br />
<span style="background-color: white; font-family: arial; font-size: 13px;"><br /></span>
<b style="font-family: arial; font-size: 13px;"><u>Button combinations</u></b><br />
<span style="background-color: white; font-family: arial; font-size: 13px;"><b><u><br /></u></b></span>
<span style="background-color: white; font-family: arial; font-size: 13px;">In game mode some of the buttons could be pressed at the same time while others could not.<br /></span><br />
@ and Power are reserved so have no button function.<br />
<span style="background-color: white; font-family: arial; font-size: 13px;"><br /></span>
<span style="background-color: white; font-family: arial; font-size: 13px;">Bottom trigger and top trigger could not be pressed at the same time. Lower trigger always took priority even if upper was pressed first.</span><br />
<br />Bottom trigger could be pressed with any of the face bottoms (A,B,C,D). Same for Top Trigger.<br />
<br />
A could be pressed with C, but not B or D. A stays active and the others do not show.<br />If you press B or D first and then press A, A will be activated and the other will be released.<br />
<br />
B and C can be pressed at the same time<br />
<br />
D is over ridden by all face buttons, so if you have D pressed and then press any of the other their function is activated and D is released.<br />
<br />
Also, either trigger and two button face combinations that were noted to work above will also work.<br />So, if you need 2 buttons at the same time and one is the master and the second one needs to be one of 4 I'd recommend using a trigger as the master and the face buttons as the secondary as this works for all face buttons.<br />
If you need 3 buttons then there are a small number of combinations that will work.<br />
Top button, A and C worked for me.<br />
<br />
<i>Future Note: I have a feeling this section may need a chart of some nature. Need to figure out how to represent it.</i><br />
<br />
For Python/Pygame and I expect other system the buttons are numbered:<br />
<br />
<b><u>Gamepad Mode</u></b><br />
<b><u><br /></u></b>
<b><u><br /></u></b>
<b>Face button arrangement</b><br />
<span style="font-family: Courier New, Courier, monospace;"><b> A </b></span><br />
<span style="font-family: Courier New, Courier, monospace;"><b>C D</b></span><br />
<span style="font-family: Courier New, Courier, monospace;"><b> B</b></span><br />
<span style="font-family: Courier New, Courier, monospace;"><b><br /></b></span>
<b><u><br /></u></b>
Top Trigger: button 7<br />
Bottom Trigger: button 6<br />
A: button 4<br />
B: button 0<br />
C: button 3<br />
D: button 1<br />
<br />
<b><u>VR mode (Nunchuck)</u></b><br />
<b><u><br /></u></b>
<div>
<b>Face button arrangement</b></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><b> C</b></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><b>B A</b></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><b> D</b></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><b><br /></b></span></div>
Top Trigger: button 7<br />
Bottom Trigger: button 6<br />
A: button 1<br />
B: button 3<br />
C: button 0<br />
D: button 4<br />
<div>
<br /></div>
<div>
When I saw it changed I thought the button values would have turned clockwise 90 degrees so the buttons were in the same position (top, left, right, bottom) would have the same values but they don't. Top and bottom shift correctly, but left and right are mirrored.</div>
<div>
<br />Where did 2 and 5 go. I wonder if they're on the board and not broken out. Might be a tear down thing</div>
<br />
<br />
<span style="background-color: white; font-family: arial; font-size: 13px;"><u><b>Summary</b></u></span><br />
<span style="background-color: white; font-family: arial; font-size: 13px;"><u><b><br /></b></u></span>
For £1.85, or <b><a href="http://ebay.to/2Apd7BB" target="_blank">£1.99</a>,</b> last time I checked if your need is digital controls then I think this is a hit. It paired easily. The instructions though really sparse are enough to change modes.<br />With a phone it does the media things promised from mode A and on the Raspberry Pi and expect and device that supports a Bluetooth Gamepad and Mouse it does exactly what it says on the tin.<br />
<br />
For controlling robots it's ideal (except for no analog).<br />
Joystick for direction control and then buttons for other functions. Maybe take a picture, fire a missile, change mode from piloted to auto mode for different challenges at an event like PiWars.<br />With the advantage of using regular AAA batteries there is no fear that at an even the controller will run out of power and need to be charged.<br /><br /><br /><b><u>A little but extra</u></b><br /><br />As each controller having a unique Bluetooth Device ID it's possible to set up a cronjob on Linux to pair with a specific gamepad when the Raspberry Pi (ZeroW) is booted/rebooted so at events if you had 5 robots, 5 controllers each controller would be set up to work with a specific controller<br />It's not too complicated to do.<br /><br />Get the device ID for the VR Box using the command <span style="font-family: Courier New, Courier, monospace;">bluetoothctl</span><br />
Mine was FF:FF:70:00:76:8B<br />
<br />
Run <span style="font-family: Courier New, Courier, monospace;">crontab -e</span><br />
Select your editor if running for the first time. I use Nano<br />
<br />
Go to the end and add the line<br />
<pre style="color: #333333; padding: 0px;"><span style="font-family: Courier New, Courier, monospace;">@reboot echo "connect <span style="color: black; white-space: normal;">FF:FF:70:00:76:8B</span>" | bluetoothctl</span></pre>
<br />
If using Nano do a [ctrl]-[x] to exist and 'y' to save.<br />
Reboot an you're done.<br />
<br />
This will try to auto pair when the Pi boots.<br />
<br />
You can also do a cronjob to continuously try to reconnect and not just at boot.<br />
This is useful if the Pi has completed booting before the gampad has been turned on or if the controller hasn't been used for 10 minutes or in pairing mode fails to pair after 3 minutes and so needs to repair when the controller is turned back on<br />
<br />
<br />
<br />
<div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<div>
<br />
<br />
<br />
<br />
<br />
<br />
<br /></div>
</div>
Winkleinkhttp://www.blogger.com/profile/10921617680353539604noreply@blogger.com0tag:blogger.com,1999:blog-2902197163807965393.post-41805624513362249342017-05-10T20:20:00.001+01:002017-05-10T21:20:36.058+01:00Raspberry Pi 3 with Google AIY VoiceHatI was lucky enough to get a copy of <a href="https://www.raspberrypi.org/magpi/issues/57/" target="_blank"><b>Issue 57 of The MagPi</b></a> with the VoiceHat from Google on the cover.<br />
<br />
This is a great bit of kit with Raspberry Pi Hat, speaker, microphone, and a cardboard box to put it in.<br />
For a bit of fun I fitted it into a cardboard R2D2 that I had from before Christmas.<br />
<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/AVvXsEh5mThoEi5lt3oodcHPmbNUm7jfE4BUoUw3SkRRQaF47UEaI-csS_fsgySwBfZAFxCl2fPaWHgnN7SkKPFEYFJQHkjM3R_EqIGjrGUWjKbD2DSTDSGpImChjkApq2lwVqjSQszo0xEfXOvb/s1600/IMG_3897.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5mThoEi5lt3oodcHPmbNUm7jfE4BUoUw3SkRRQaF47UEaI-csS_fsgySwBfZAFxCl2fPaWHgnN7SkKPFEYFJQHkjM3R_EqIGjrGUWjKbD2DSTDSGpImChjkApq2lwVqjSQszo0xEfXOvb/s320/IMG_3897.jpg" width="240" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">This is not the droid you're looking for</td></tr>
</tbody></table>
After doing the usual of asking it to tell a joke and give me the weather and details of what's nearby I was wondering what I could use the VoiceHat for.<br />
<br />
We have an Amazon Dot and it's main purpose in the house is playing radio station. I tried this out and nothing played. Seems streaming radio support isn't built in.<br />
<br />
Then keeping up with what others were doing Mike Redrobe posted on the Raspberry Pi forum that he had it playing YouTube audio. <b><a href="https://www.raspberrypi.org/forums/viewtopic.php?f=114&t=182665">https://www.raspberrypi.org/forums/viewtopic.php?f=114&t=182665</a></b><br />
<br />
With a bit of assistance I got this working. If you're careful with the name of the video you can get it to play fairly much any song. My kids loved this.<br />
<br />
But I still wanted to play streaming radio. You know, one command and it's off rather than needing to keep telling it new songs to play.<br />
<br />
In a later post Mike mentions using VLC as the player and armed with his example I began looking to see if I could get streaming radio to work.<br />
<br />
I did. Yeah! Then I went on the trail to add playing podcasts. Again a success. <br />
You need to install VLC<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">sudo apt update</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">sudo apt upgrade</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">sudo apt install vlc</span><br />
<br />
<b>Radio Stations supported are:</b><br />
Absolute Radio<br />
Absolute 80s<br />
Absolute 90s<br />
Absolute 00s<br />
Eagle Radio<br />
BBC Radio 1<br />
BBC Radio 2<br />
BBC Radio 3<br />
BBC Radio 4<br />
Capital FM<br />
<br />
<br />
<b>Podcasts Supported are:</b><br />
Good Job Brain<br />
No Such Thing As a Fish<br />
Freakonomics<br />
<div>
<br /></div>
<br />
Here is a little video of it working. I recorded it in Portrait as the cardboard R2D2 it is in is portrait shared so if viewing on a phone will fill the screen, while of viewing on a computer it will have the side bars which is probably better than seeing the messy table.<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/UAw0nvfMxZ8/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/UAw0nvfMxZ8?feature=player_embedded" width="320"></iframe></div>
<br />
<br />
The action.py file that's needed with the commands built in is available on GitHub<br />
<b><a href="https://github.com/winkleink/RPi_AIY">https://github.com/winkleink/RPi_AIY</a></b><br />
<br />
<br />
<b><u>Other useful bits and pieces</u></b><br />
<b><br /></b>
<b>Knowing what Google is actually hearing</b><br />
<b><br /></b>While setting up the radio stations Absolute 90s was interpreted by Google as Absolute 90s, but Absolute 00s was interpreted as absolute noughties<br />
It took me a while to figure this out and command that helped me was:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">sudo journalctl -u voice-recognizer -n 20 -f</span><br />
<br />
This shows what's happening when you issue a command,<br />
Here's a small snippet showing what the voice command is converted to.<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/AVvXsEjH2TMS9tjph6NIQ4kQ3W1uKHEG0SWZffyUjTXjsqHNPG-wcgtGSfnXP8ZoYhi6JNJZ9JH49VavB7GTQ28gC3YcstPQY2B6rrjsXh5_9sCWcUvIHO6mCFvYQ_nDvZLLezpvDA3ayMLcbAbu/s1600/absolute_noughties.PNG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="100" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjH2TMS9tjph6NIQ4kQ3W1uKHEG0SWZffyUjTXjsqHNPG-wcgtGSfnXP8ZoYhi6JNJZ9JH49VavB7GTQ28gC3YcstPQY2B6rrjsXh5_9sCWcUvIHO6mCFvYQ_nDvZLLezpvDA3ayMLcbAbu/s320/absolute_noughties.PNG" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Absolute 00s or is that Absolute Noughties</td></tr>
</tbody></table>
<br />
<b>Make sure to stop and start the service after each change to action.py</b><br />
<div>
<br /></div>
<div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">sudo systemctl stop voice-recognizer && sudo systemctl start voice-recognizer</span></div>
<div>
<br /></div>
<div>
<b>Want to add more radio stations</b></div>
<div>
This website has a list of streaming radio stations and their urls. This is the UK list.</div>
<div>
<b><a href="http://www.listenlive.eu/uk.html">http://www.listenlive.eu/uk.html</a></b></div>
<div>
<br /></div>
<div>
<b>Stopping the playback</b></div>
<div>
<b><br /></b></div>
<div>
Since I'm using the button to stop the playback based on Mike Redrobe's code I decided to do the GPIO setup at the top so it is shared by all the commands rather than having it in each command.</div>
<div>
<br /></div>
<div>
The code is a while loop that keeps going until the button is pressed and then a kill statement to stop the process. To be truthful I'm not sue how the kill bit works, I just know it does, so thank you to Mike for sharing.</div>
<div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">while gpio.input(23):</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> time.sleep(1)</span></div>
</div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"></span><br />
<div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">pkill = subprocess.Popen(["/usr/bin/pkill","vlc"],stdin=subprocess.PIPE)</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">p.kill()</span></div>
</div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">
</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<br /></div>
<div>
<b>Doing the podcasts</b></div>
<div>
Getting the most recent podcast to play is a bit more hacky than the radio stream as the radio stream is always the same while each podcast episode has a different url. To achieve this I first had to find the relevant rss feed and then parse the file to find the start and end of the url to the mp3. audioboom.com podcasts aren't too bad, but the Freakonomics one based off the feedburner rss was a little more complex as the url to the mp3 is actually a redirect url and they don't work.</div>
<div>
<br /></div>
<div>
<span style="font-family: monospace; white-space: pre-wrap;">https://www.podtrac.com/pts/redirect.mp3/audio.wnyc.org/freakonomics_podcast/freakonomics_podcast050317.mp3</span></div>
<div>
<span style="font-family: monospace; white-space: pre-wrap;"><br /></span></div>
<div>
<span style="font-family: monospace; white-space: pre-wrap;">You can see in the middle there is redirect.mp3 and then what looks like a path to a different website audio.wnyc.org</span></div>
<div>
<span style="font-family: monospace; white-space: pre-wrap;">
This meant the parser had to first find "/redirect.mp3/" and then from there find "mp3" to get the main bit for the audio.wnyc.org link.</span></div>
<div>
<span style="font-family: monospace; white-space: pre-wrap;">Finally it needed to add back in "http://"</span></div>
<div>
<span style="font-family: monospace; white-space: pre-wrap;">You can see how this is done in the code below.</span></div>
<div>
<span style="white-space: pre-wrap;"><span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><br /></span></span></div>
<div>
<span style="white-space: pre-wrap;"><span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">url = 'http://feeds.feedburner.com/freakonomicsradio?format=xml'
response = urllib.request.urlopen(url)
data = response.read() # a `bytes` object
text = data.decode('utf-8')
startmp3 = text.find('/redirect.mp3/')+14
endmp3 = text.find('.mp3',startmp3+16)+4
if startmp3 > 0:
command = "http://"+text[startmp3:endmp3]</span></span></div>
<br />
<br />
Have a play and see what you can get the Raspberry Pi AIY to do.<br />
Just be sure to backup any files you modify before changing them.<br />
I didn't backup my action.py when I started playing but luckily google has made the original files available on GitHub <b><a href="https://github.com/google/aiyprojects-raspbian">https://github.com/google/aiyprojects-raspbian</a></b><br />
<br />
I'm really looking forward to seeing how this grows and expands.<br />
<br />
Just saw that <b><a href="https://twitter.com/k_tinkerer">https://twitter.com/k_tinkerer</a> </b>has been doing some great things with the AIY as well. Worth checking out if you want to do more.<br />
<br />
<span style="color: #0000ee;"><b><u><a href="http://ktinkerer.co.uk/">http://ktinkerer.co.uk/</a></u></b></span><br />
<br />
I'll definitely be adding the shutdown and reboot commands from here.<br />
<br />
<br /></div>
Winkleinkhttp://www.blogger.com/profile/10921617680353539604noreply@blogger.com0tag:blogger.com,1999:blog-2902197163807965393.post-20449493964392720272017-04-18T09:24:00.001+01:002017-04-18T10:58:47.199+01:003rd Wimbledon Raspberry Jam final agendaThe <a href="https://wimbledonrjam3.eventbrite.co.uk/" target="_blank">3rd Wimbledon Raspberry Jam on the 23rd April Agenda</a> has been finalised.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjFyWZ6o4MGuEYAzJ7IzdsMgSASi2vxQF4xg777oPlHFh6dZmFJC-usGL-6BO6I-RYpY-Ju1NfU4CQ_LhsYEXvau5FhzqdLW2OnhLj0rlie-4-RteAy0tyiPyezAqkN4nOugT5UHx-vxka/s1600/Wimbledon_23_Apr_2017.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="280" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjFyWZ6o4MGuEYAzJ7IzdsMgSASi2vxQF4xg777oPlHFh6dZmFJC-usGL-6BO6I-RYpY-Ju1NfU4CQ_LhsYEXvau5FhzqdLW2OnhLj0rlie-4-RteAy0tyiPyezAqkN4nOugT5UHx-vxka/s400/Wimbledon_23_Apr_2017.png" width="400" /></a></div>
<br />Winkleinkhttp://www.blogger.com/profile/10921617680353539604noreply@blogger.com0tag:blogger.com,1999:blog-2902197163807965393.post-3298847838843950202017-02-16T20:01:00.002+00:002021-09-09T16:31:37.109+01:00Green Screen photo booth using Raspberry PiWe've seen a number of photo booths <a href="http://makezine.com/projects/raspberry-pi-photo-booth/" style="font-weight: bold;" target="_blank">here</a>, <a href="http://www.instructables.com/id/Raspberry-Pi-photo-booth-controller/" target="_blank"><b>here</b></a> and even the <b><a href="https://twitter.com/theallseeingpi" target="_blank">All Seeing Pi</a> </b>being done with Raspberry Pi. All of these photo booths are based on taking a picture and maybe putting an overlay to add a banner or something like a funny hat or mustache.<br />
<br />
My thoughts were could the Raspberry Pi 3 do Green Screen. You know that special effect from the movies where the background is removed and a different image put in it's place.<br />
<br />
As a kid I think the first time I remember seeing this was Superman.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6uIbz-homB0u0CasZJLsravHEiJuYU6lyzS9q5BmVdRHaqLexKWDrnLdeRgUhWkBDsAELihYTdw9mp42Wdgj8_Fq9QYjKMkf3jwcFr5nWG9uQXSct5bRxCPt7cuRG9JWKtgQlVHjEM-_6/s1600/superman_returns_greenscreen.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6uIbz-homB0u0CasZJLsravHEiJuYU6lyzS9q5BmVdRHaqLexKWDrnLdeRgUhWkBDsAELihYTdw9mp42Wdgj8_Fq9QYjKMkf3jwcFr5nWG9uQXSct5bRxCPt7cuRG9JWKtgQlVHjEM-_6/s320/superman_returns_greenscreen.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
How cool would that be to make your own version of the special effects used in big budget movies.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
So, I started the search for tools under Linux that would permit the green screen to be done.</div>
<div class="separator" style="clear: both; text-align: left;">
As a short summary green screen<a href="https://en.wikipedia.org/wiki/Chroma_key" target="_blank">/<b>chroma key</b></a> is where a a single colour is removed from an image.</div>
<div class="separator" style="clear: both; text-align: left;">
Most often it is green as modern cameras are more sensitive to green and a bright green works best as it's less likely to be a colour in a natural scene. I remember when I was younger hearing it being done with blue screen as well. </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;">
After a bit of looking I found <a href="https://www.imagemagick.org/script/index.php" target="_blank"><b>Imagemagick</b></a> a jack of all trades image processing tool. It has a function to remove a single colour from an image and as importantly for my use includes a 'fuzzy' search for the colour which gave a bit of tolerance to the lighting. </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
In the code the most important line is:</div>
<table class="highlight tab-size js-file-line-container" data-tab-size="8" style="background-color: white; border-collapse: collapse; border-spacing: 0px; box-sizing: border-box; color: #333333; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-size: 14px; tab-size: 8;"><tbody style="box-sizing: border-box;">
<tr style="box-sizing: border-box;"><td class="blob-code blob-code-inner js-file-line" id="LC237" style="box-sizing: border-box; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; line-height: 20px; overflow: visible; padding: 0px 10px; position: relative; vertical-align: top; white-space: pre; word-wrap: normal;">os.system(<span class="pl-s" style="box-sizing: border-box; color: #183691;"><span class="pl-pds" style="box-sizing: border-box;">'</span>/usr/bin/convert -limit thread 4 <span class="pl-pds" style="box-sizing: border-box;">'</span></span> <span class="pl-k" style="box-sizing: border-box; color: #a71d5d;">+</span> folder <span class="pl-k" style="box-sizing: border-box; color: #a71d5d;">+</span><span class="pl-s" style="box-sizing: border-box; color: #183691;"><span class="pl-pds" style="box-sizing: border-box;">'</span>imagecam.png
-fuzz <span class="pl-pds" style="box-sizing: border-box;">'</span></span><span class="pl-k" style="box-sizing: border-box; color: #a71d5d;">+</span>fuzzpercent<span class="pl-k" style="box-sizing: border-box; color: #a71d5d;">+</span><span class="pl-s" style="box-sizing: border-box; color: #183691;"><span class="pl-pds" style="box-sizing: border-box;">'</span> -transparent "#<span class="pl-pds" style="box-sizing: border-box;">'</span></span><span class="pl-k" style="box-sizing: border-box; color: #a71d5d;">+</span>rgbnum <span class="pl-k" style="box-sizing: border-box; color: #a71d5d;">+</span><span class="pl-s" style="box-sizing: border-box; color: #183691;"><span class="pl-pds" style="box-sizing: border-box;">'</span> " <span class="pl-pds" style="box-sizing: border-box;">'</span></span> <span class="pl-k" style="box-sizing: border-box; color: #a71d5d;">+</span> folder <span class="pl-k" style="box-sizing: border-box; color: #a71d5d;">+</span> <span class="pl-s" style="box-sizing: border-box; color: #183691;"><span class="pl-pds" style="box-sizing: border-box;">'</span>imagecamt.png<span class="pl-pds" style="box-sizing: border-box;">'</span></span>) </td></tr>
<tr style="box-sizing: border-box;"><td class="blob-num js-line-number" data-line-number="238" id="L238" style="box-sizing: border-box; color: rgba(0, 0, 0, 0.298039); cursor: pointer; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; line-height: 20px; min-width: 50px; padding: 0px 10px; text-align: right; user-select: none; vertical-align: top; white-space: nowrap; width: 50px;"></td><td class="blob-code blob-code-inner js-file-line" id="LC238" style="box-sizing: border-box; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; line-height: 20px; overflow: visible; padding: 0px 10px; position: relative; vertical-align: top; white-space: pre; word-wrap: normal;"></td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: left;">
I know there is a lot going on in there. She short version is it takes <span style="font-family: "courier new" , "courier" , monospace;">imagescam.png</span>, makes transparent the colour <span style="font-family: "courier new" , "courier" , monospace;">rgbnum</span> with a tolerance of <span style="font-family: "courier new" , "courier" , monospace;">fuzzpercent</span> and saves it as<span style="font-family: "courier new" , "courier" , monospace;"> imagecamt.png</span></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
This <b><a href="http://www.imagemagick.org/discourse-server/viewtopic.php?t=14394" target="_blank">forum thread was really useful</a> </b>in understanding how to use it.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Once I had my head around this it was then a matter of doing the rest of the code.</div>
<div class="separator" style="clear: both; text-align: left;">
Take the picture</div>
<div class="separator" style="clear: both; text-align: left;">
Remove the green</div>
<div class="separator" style="clear: both; text-align: left;">
Layer a background and the image with the green removed. </div>
<div class="separator" style="clear: both; text-align: left;">
For testing I used some of my kids PlayMobil and a piece of A0 green card. </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;">
All looks like it's working well even with the ability to change the background using the arrow keys</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Now for the next level.</div>
Scale it Up to Life Size !!!!<br />
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
This of course means I needed a <a href="http://ebay.to/2kD3MOi" style="font-weight: bold;" target="_blank">green screen background with standard</a> that I bought from eBay. No idea when I'll use the black or white backgrounds that came with this kit, but I have them now.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
And then Tweet the pictures.</div>
<div class="separator" style="clear: both; text-align: left;">
For Tweeting I used tweepy and followed the <a href="http://raspi.tv/2013/how-to-create-a-twitter-app-on-the-raspberry-pi-with-python-tweepy-part-1" target="_blank"><b>excellent guide</b></a> by Alex Eames <a href="https://twitter.com/RasPiTV" target="_blank"><b>@RasPiTV</b></a> </div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Finally, wouldn't it be great to have a little remote control and not have to rely on a keyboard. Since the Raspberry Pi 3 has Bluetooth I thought this might be the ideal solution. No wires and no messing about. Since Pygame was already being used for the displaying of the images and I knew Pygame had joystick support built in this looked like the obvious choice.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Again, on eBay I found this small little <a href="http://ebay.to/2lQ9Rf3" target="_blank"><b>Bluetooth gamepad</b></a> and thought it would be perfect. Super small which means you can have it in your hand but not interfere with your final picture.</div>
<div style="text-align: left;">
<br /></div>
<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/AVvXsEjjSqrngcI_jUKuiZlUOv_evDBISEzOx8WrCon6VH_kBQDGPP0N1GrJOvFTubqjeVm2eDgIvMDY-_UdlruRTnLs5wwKFupots8EoUPb4tewPksdxd0V_FRK75NwNyMHGsZ07BeFVT-QKgeN/s1600/IMG_2815.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjSqrngcI_jUKuiZlUOv_evDBISEzOx8WrCon6VH_kBQDGPP0N1GrJOvFTubqjeVm2eDgIvMDY-_UdlruRTnLs5wwKFupots8EoUPb4tewPksdxd0V_FRK75NwNyMHGsZ07BeFVT-QKgeN/s320/IMG_2815.JPG" width="240" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Iddy biddy, teeny weeny, black gamepad </td></tr>
</tbody></table>
<div style="text-align: center;">
<br /></div>
<div style="text-align: left;">
My usual style is before bring a new feature into a project I like to test it standalone to make sure it works. For the gamepad I created a small <a href="https://github.com/winkleink/pygame_test_gamepad" target="_blank">Python/Pygame program to test the gamepad</a> </div>
<br />
<div class="separator" style="clear: both; text-align: left;">
It paired with the Raspberry Pi first time and worked perfectly with the gamepad test program. So, 100% sure it will function with the chromaCam setup.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Now all the parts are in place. PiCamera to take the picture. Imagemagick to remove the background colour. Pygame to merge background, foreground picture with green removed and finally an overlay with the background images changed with the keyboard or the super small gamepad. (Oh yeah, the circular thing at the bottom is an analogue joystick)</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The chromaCam set up got it's outing at the last Wimbledon Raspberry Jam. Here are some pictures.</div>
<div class="separator" style="clear: both; text-align: left;">
On the day I used a camera tripod and a lot of tie wraps to hold the Pi Display and the Pi Camera onto the tripod. I would definitely recommend a more secure mounting method </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<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/AVvXsEiAKB_2QmqqraHW0Dsg3C4OkdnAOj1DFZEOH-Wr2K8TNWNwrwKZNpL7tUuwO80CU6knubESmuL1m-E5wJvnOQfIRkJRXvjHH3w-Cgrq4wv3lCNXILvmHbi0JzAEdaqYvrYYS3lZWsaLc3fZ/s1600/IMG_2928.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAKB_2QmqqraHW0Dsg3C4OkdnAOj1DFZEOH-Wr2K8TNWNwrwKZNpL7tUuwO80CU6knubESmuL1m-E5wJvnOQfIRkJRXvjHH3w-Cgrq4wv3lCNXILvmHbi0JzAEdaqYvrYYS3lZWsaLc3fZ/s320/IMG_2928.JPG" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Getting set up https://twitter.com/MrTomsWorld</td></tr>
</tbody></table>
<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/AVvXsEiPbHkXQE5A4jtUCCsdR-mcUlE3D2TD8CLV425BNGPO0te09T5g86bEubxUa5Xt6qcpcAb0GTTFSYBdgNd1_eGO8IFmver766lzjfxdtCG8NqtGg7YI4kNYZHTXESnu-U427WsvH5gQHwFb/s1600/harry_potter.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPbHkXQE5A4jtUCCsdR-mcUlE3D2TD8CLV425BNGPO0te09T5g86bEubxUa5Xt6qcpcAb0GTTFSYBdgNd1_eGO8IFmver766lzjfxdtCG8NqtGg7YI4kNYZHTXESnu-U427WsvH5gQHwFb/s320/harry_potter.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Who doesn't love a bit of Harry Potter - https://twitter.com/rdhayler</td></tr>
</tbody></table>
<br />
<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/AVvXsEh3XZAh1VrSKfGOt6rELN3LYjlJn1lw-1UrT0T_N37973RtHJksiceSKqIfyrPQxoas0Age0kQTScdT-reLDzUkH3U_OirJ9pdZcfYnHVAjNoL7hxxLYiz9s52Umiof_oHwRihezDjhIHv1/s1600/lion.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3XZAh1VrSKfGOt6rELN3LYjlJn1lw-1UrT0T_N37973RtHJksiceSKqIfyrPQxoas0Age0kQTScdT-reLDzUkH3U_OirJ9pdZcfYnHVAjNoL7hxxLYiz9s52Umiof_oHwRihezDjhIHv1/s320/lion.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Those Lions are dangerous</td></tr>
</tbody></table>
<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/AVvXsEi499ehfjHeXND_pEUDGvIIwajXjtH4LmfU4P1eU25aBUZw1AyyteKnCKteKK12CHWIAs8YUgJBtVr3DWQVFiGD2GhTzwH8o4JIxX5_fDpAXjFG0YSLEkns1AA75yMrJ-yHci3UtWuZeu_f/s1600/marcus_dinosaur.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi499ehfjHeXND_pEUDGvIIwajXjtH4LmfU4P1eU25aBUZw1AyyteKnCKteKK12CHWIAs8YUgJBtVr3DWQVFiGD2GhTzwH8o4JIxX5_fDpAXjFG0YSLEkns1AA75yMrJ-yHci3UtWuZeu_f/s320/marcus_dinosaur.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">That doesn't look like a sensible thing to do - https://twitter.com/HackHorsham</td></tr>
</tbody></table>
<br />
Final notes.<br />
If you did click the link above that explains Chroma Key/Green Screen then you'll have read that lighting is really important. The goal is to one specific colour. If your lighting is uneven then due to shadows or folds in the green screen the green will be different giving varying results.<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/AVvXsEh792mndnTmLFzibJPxk9k2ftXXOR3JKvaT7t8Q-A_N1LDsiohqKrV_ggujnYodXHYwTRXLOMJ2xz2QpA7P0fXmIlHQnuzXTHPcSHeBx8SjJnRXHXVUbfQJzWA7f2zuVQswQBPWcEx1JMTF/s1600/bad_2.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh792mndnTmLFzibJPxk9k2ftXXOR3JKvaT7t8Q-A_N1LDsiohqKrV_ggujnYodXHYwTRXLOMJ2xz2QpA7P0fXmIlHQnuzXTHPcSHeBx8SjJnRXHXVUbfQJzWA7f2zuVQswQBPWcEx1JMTF/s320/bad_2.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Taking out too much - https://twitter.com/Codepope</td></tr>
</tbody></table>
<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/AVvXsEjm_TqIB9U600s8kFPFucYanW0gY3jq-yYEN865xWFBMd_62F-JZDtj8od-Vu81THyXHcWIOg4Mj9bP4a5vHwjB9-DO8ZdX4XvBi2sXBZZymJSgxlr_4d7TBQ3kwhILgG_pPYt_WO7kbxc4/s1600/not_right.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjm_TqIB9U600s8kFPFucYanW0gY3jq-yYEN865xWFBMd_62F-JZDtj8od-Vu81THyXHcWIOg4Mj9bP4a5vHwjB9-DO8ZdX4XvBi2sXBZZymJSgxlr_4d7TBQ3kwhILgG_pPYt_WO7kbxc4/s320/not_right.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">I'm sure the top of the Raspberry Pi logo isn't transparent</td></tr>
</tbody></table>
<div>
<br />
<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/AVvXsEhestSWm2qIBX5QyLfAJvrOfU1M7NWpT7Ap70-pLDIf4X2l4E8zU8UvTt4ZVKVjyUCbE1ueUjgik6fPjWHS-FaUFdzcD3ALO_XO3zEEnBCCB3Fpw9jxCtfese2ugtYAeypjKhPzJlUYXA-k/s1600/grace.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhestSWm2qIBX5QyLfAJvrOfU1M7NWpT7Ap70-pLDIf4X2l4E8zU8UvTt4ZVKVjyUCbE1ueUjgik6fPjWHS-FaUFdzcD3ALO_XO3zEEnBCCB3Fpw9jxCtfese2ugtYAeypjKhPzJlUYXA-k/s320/grace.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">A few bits of rogue green - https://twitter.com/gowolade</td></tr>
</tbody></table>
<br />
If you want to make your own Green Screen Photo Booth then the code is available on <a href="https://github.com/winkleink/ChromaCam" target="_blank"><b>GitHub</b></a><br />
<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;">
<b>Final Thoughts:</b></div>
Yes, this project worked and was great fun to build and see people using it.<br />
<div class="separator" style="clear: both; text-align: left;">
For the project I limited the image size to 640x480 as even at that resolution it took about 2 seconds for the picture to be updated. This meant it took a little bit of patients to get the picture you wanted before pressing the button to Tweet the image.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
I took the set up to <a href="https://twitter.com/hackhorsham" target="_blank"><b>Hack Horsham</b></a> as well but I didn't bring my own lighting and the lighting in the room was perfect for a Jam but didn't give enough contrast for chromaCam to work. So, it didn't make the final cut and I stuck to <a href="http://www.winkleink.com/2016/08/buttonflash-game-made-with-raspberry-pi.html" target="_blank"><b>Button Flash</b></a>.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
You can see the setup in the mannequin challenge video tweet. </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<blockquote class="twitter-tweet" data-lang="en">
<div dir="ltr" lang="en">
<a href="https://twitter.com/Raspberry_Pi">@Raspberry_Pi</a> please can we get a retweet? Mannequin video of today's <a href="https://twitter.com/hashtag/horshampijam?src=hash">#horshampijam</a> pre-opening :) <a href="https://twitter.com/hashtag/rjam?src=hash">#rjam</a> <a href="https://twitter.com/hashtag/horshamdc?src=hash">#horshamdc</a> <a href="https://t.co/g9v0jl7NeM">pic.twitter.com/g9v0jl7NeM</a></div>
— Hack Horsham (@HackHorsham) <a href="https://twitter.com/HackHorsham/status/808009274337148929">December 11, 2016</a></blockquote>
<script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"></script>
<br />
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Again, this was a great learning experience for me and once the computing power for the Raspberry Pi enables it or access to the GPU is supported this will be amazing when the green screen transparency can be done in real time. </div>
<div class="separator" style="clear: both; text-align: left;">
I expect as new devices come out I'll be revisiting this project to see if the performance is improved. </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<br /></div>
Winkleinkhttp://www.blogger.com/profile/10921617680353539604noreply@blogger.com5tag:blogger.com,1999:blog-2902197163807965393.post-40754355914524978872017-02-16T14:55:00.000+00:002017-02-16T17:59:21.686+00:00Making Games with Scratch and Sense Hat on Raspberry Pi<br />
I'm a big fan of the Raspberry Pi <a href="https://www.raspberrypi.org/products/sense-hat/" target="_blank"><b>Sense Hat</b></a> and <a href="https://scratch.mit.edu/" target="_blank"><b>Scratch </b></a>for doing interesting things and learning to code.<br />
Previously I made a <a href="http://www.winkleink.com/2016/01/raspberry-pi-sensehat-game-sensecave.html" target="_blank"><b>Sense Hat Cave Game</b></a> using Python where you tilt the Sense Hat to move around as well as a <a href="http://www.winkleink.com/2016/07/toy-crane-controlled-from-raspberry-pi.html" target="_blank"><b>Crane controller programmed in Scratch</b></a>.<br />
This time the goal was to create game that uses the Sense Hat as the display while programmed in Scratch. The best of both world. The goal for me was to lean to control the pixels a bit better in Scratch.<br />
<br />
The result is Collect the Dots a simple game where you're a blue dot collecting red dots. It's kind of like snake without the tail.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJK-mBJHU7q6q2_Hh81HzOSSCiIKD05LyCEN-fucFj34STqedksviMDymylmja1dlEiz8Dbyb4HI8e3k-GfLNrBlUqpgcD4DHkBiOSWRpPseamI4ZTpWS3JS3yV4eP1_o-JmGBT3UcX28Y/s1600/collect_the_dots.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="179" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJK-mBJHU7q6q2_Hh81HzOSSCiIKD05LyCEN-fucFj34STqedksviMDymylmja1dlEiz8Dbyb4HI8e3k-GfLNrBlUqpgcD4DHkBiOSWRpPseamI4ZTpWS3JS3yV4eP1_o-JmGBT3UcX28Y/s320/collect_the_dots.png" width="320" /></a></div>
<br />
<br />
You control your dot using either the small joystick on the Sense Hat or use the keyboard on the computer. Press Down to start the game. You'll see in the video it tells you this on the Sense Hat, but if no Sense hat is attached and you're running on screen there is no prompt.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/E9xXODk0CCg/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/E9xXODk0CCg?feature=player_embedded" width="320"></iframe></div>
<br />
As can be seen in the video the on screen display mirrors on the Sense Hat dots, so either can be used.<br />
Strangely even though the screen display is bigger I found it easier to play if I only looked at the Sense Hat display.<br />
The game can also be played without the Sense Hat. Uploaded to Scratch website <a href="https://scratch.mit.edu/projects/144708660/">https://scratch.mit.edu/projects/144708660/</a><br />
<br />
Embedded from the Scratch Website<br />
<br />
<iframe allowfullscreen="" allowtransparency="true" frameborder="0" height="402" src="//scratch.mit.edu/projects/embed/144708660/?autostart=false" width="485"></iframe>
<br />
<br />
You can download the code from <b><a href="https://github.com/winkleink/Scratch_SenseHat_Collect_Dots" target="_blank">GitHub</a></b><br />
<br />
TIP: As the wonderful <a href="https://twitter.com/CatLamin" target="_blank"><b>Cat Lamin</b></a> points out in her blog post about using doing an<b> <a href="https://catlamin.com/2017/02/12/sense-hat-cat-using-scratch/" target="_blank">animation on the Sense Hat using Scratch</a> </b>you have to run the code once to enable the sensors and capability of the Sense Hat. So, the first time you run the program on a Raspberry Pi with a Sense Hat it may not work correctly. Just stop it and start again and all will be perfect<br />
<br />
A thought for an enhancement would be to control your dot by tilting the Sense Hat rather than using the joystick or keys.<br />
<br />Winkleinkhttp://www.blogger.com/profile/10921617680353539604noreply@blogger.com0tag:blogger.com,1999:blog-2902197163807965393.post-50961817074261512772017-01-30T20:28:00.001+00:002017-01-31T08:09:21.801+00:00Controlling screen brightness on pi-topCEED on Raspbian Jessie with guizero app and keyboard shortcutI backed the pi-topCEED during the crowd funding campaign and have used it a lot since.<br />
<div>
<br /></div>
<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/AVvXsEi37gZpYyFe4IYlTFmSe7woiMpfryAbE-wCMXyO5FCvF9KLybhh69rFo19jQ3K-Z745TMuE8rGu0ZK97BbRib5E_kJN4tjaJ84YTpQHCvmZCKmnVjEy5WIdeWJfyCwFDaAzz2cJU3goFjqb/s1600/IMG_3366.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi37gZpYyFe4IYlTFmSe7woiMpfryAbE-wCMXyO5FCvF9KLybhh69rFo19jQ3K-Z745TMuE8rGu0ZK97BbRib5E_kJN4tjaJ84YTpQHCvmZCKmnVjEy5WIdeWJfyCwFDaAzz2cJU3goFjqb/s320/IMG_3366.JPG" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">pi-topCEED</td></tr>
</tbody></table>
<div>
<div>
<br />
<div>
My kids also use it for homework and general Minecraft playing.</div>
<div>
As I like to make things I have a number of microSD which means I regularly use it with Raspbian Jessie.</div>
</div>
<div>
<br /></div>
<div>
There are a couple of drawback to using Raspbian on the pi-topCEED. The pi-topHUB doesn't shutdown the power completely leaving the backlight on and the Raspberry Pi in kind of a suspecd mode. The red LED is still on. Also, there is no way to control the screen brightness.</div>
<div>
<br /></div>
<div>
Doing the usual Google to see if there was a way around this I came across this GitHub repository that looked like it would do the job. <b><a href="https://github.com/rricharz/pi-top-install">https://github.com/rricharz/pi-top-install</a></b></div>
<div>
It includes code to shutdown the pi-topHUB which also completely shuts down power to the display and to the Pi as well as provide a program called<span style="font-family: "courier new" , "courier" , monospace;"> 'brightness'</span> to control the screen brightness.</div>
<div>
<br /></div>
<div>
After following the instructions in the README.md I had the pi-topHUB shutting down correctly and if from the terminal I type <span style="font-family: "courier new" , "courier" , monospace;">brightness increase</span> the screen brightness would go up and vice versa <span style="font-family: "courier new" , "courier" , monospace;">brightness decrease </span>did what you'd expect.</div>
<div>
<br /></div>
<div>
All very good, but not very user friendly if you're running the GUI which is where I spend most of my time. </div>
<div>
<br /></div>
<div>
With that in mind and having recently heard good thing about guizero (<b><a href="https://github.com/lawsie/guizero">https://github.com/lawsie/guizero</a></b>) which is based on tkinter and is said to make building GUI apps in Python easier.</div>
<div>
<br /></div>
<div>
It looked to me like a simple app with 2 buttons [Darker] [Brighter] is all I needed so I read up a little on guizero. Using the App using grid layout example (<b><a href="https://lawsie.github.io/guizero/app/">https://lawsie.github.io/guizero/app/</a></b>) I soon has a small app that did exactly what I wanted.<br />
Code available on Git Hub (<b><a href="https://github.com/winkleink/pi-top-brightness">https://github.com/winkleink/pi-top-brightness</a></b>)</div>
<div>
<br /></div>
<div>
The program itself is quite short. Code below. This makes 2 buttons. Button1 and Button2. When you press them they run the relevant system comment to change the brightness. </div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">from guizero import *</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">from subprocess import call</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new", courier, monospace;">def brighter():</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> call(["brightness", "increase"])</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">def darker():</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> call(["brightness", "decrease"])</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">app = App(title="pi-top", height=50, width=145, layout="grid", bgcolor=None)</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">button1 = PushButton(app, brighter, text="Brighter", grid=[0,1])</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">button2 = PushButton(app, darker, text="Darker", grid=[0,0])</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">app.display()</span></div>
</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
Here is a video showing it working.</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/y4O2Av7dUUE/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/y4O2Av7dUUE?feature=player_embedded" width="320"></iframe></div>
<div>
<br /></div>
<div>
After a quick <span style="font-family: "courier new" , "courier" , monospace;">chmod +x </span><span style="background-color: white; color: #333333; font-size: 16px;"><span style="font-family: "courier new" , "courier" , monospace; font-weight: 600;">pi-top-brightness-gui.py </span><span style="font-family: inherit;">the program was executable and so I could run it directly.</span></span></div>
</div>
<div>
<span style="background-color: white; color: #333333; font-size: 16px;"><span style="font-family: inherit;"><br /></span></span></div>
<div>
<span style="background-color: white; color: #333333; font-size: 16px;"><span style="font-family: inherit;">Then I added the program to the main menu under the System Tools section.</span></span></div>
<div>
<span style="background-color: white; color: #333333; font-size: 16px;"><span style="font-family: inherit;">In the video you can see I have a pi-top icon. This I took from their Twitter account (</span></span><span style="color: #333333;"><a href="https://twitter.com/GetPiTop" style="font-weight: bold;">https://twitter.com/GetPiTop</a>) I expect they'll be OK with that as I'm adding even more branding to my pi-topCEED.</span></div>
<div>
<span style="color: #333333;">I explained in a recent post on backing up Minecraft Worlds how to add a program to the menu (<b><a href="http://www.winkleink.com/2016/07/minecraft-pi-backup-worlds-on-exit.html">http://www.winkleink.com/2016/07/minecraft-pi-backup-worlds-on-exit.html</a></b>)</span></div>
<div>
<span style="color: #333333;"><br /></span></div>
<div>
<span style="color: #333333;">It's great to have a little gui app to change the brightness of the screen and even better to learn a new skill with guizero.</span></div>
<div>
<span style="color: #333333;"><br /></span></div>
<div>
<span style="color: #333333;">One thing I didn't mention is that when I rebooted the Raspberry Pi the first time after installing the programs the screen brightness was far lower than I wanted it be by default.</span></div>
<div>
<span style="color: #333333;"><br /></span></div>
<div>
<span style="color: #333333;">To fix this I added a single line cronjob. Crontab with cronjobs is a way to schedule when programs run automatically with one of the options being to run at boot up. It's a simple way to get something running each time you login. It's the system used by people who lets say want to check their network connection every hour. Just setup a cronjob to run every hour and it will take care of it for you. I used this previously to enable the Bluetooth keyboard and trackpad or the NexDock. (<b><a href="http://www.winkleink.com/2016/10/nexdock-thoughts.html">http://www.winkleink.com/2016/10/nexdock-thoughts.html</a></b>)</span></div>
<div>
<br /></div>
<div>
So, I used crontab to set the brightness of the screen to 8 on startup.</div>
<div>
<br /></div>
<div>
In the terminal type:<br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">crontab -e</span></div>
<div>
<br /></div>
<div>
If this is your first time it asks which editor you want to use. I do [2] for nano.</div>
<div>
Then the crontab file is opened where you put the jobs you want to run.</div>
<div>
There are some comments in the file to help you get started, but if you want to do serious scheduled jobs then it's worth </div>
<div>
<br /></div>
<div>
Go to the bottom of the file and type</div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">@reboot brightness 8</span></div>
<div>
<br /></div>
<div>
Then the usual nano [CTRL]-[x] to save and close. Answering [y] to save the file with the same name</div>
<div>
<br /></div>
<div>
Now when I start up the pi-topCEED the default brightness is '8' which suits me.</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
Finally, finally, the rricharz GitHub explains how to set the keyboard shortcuts for the pi-top laptop so the brightness keys work. All good if I had a pi-top laptop, but I have a pi-topCEED where it's bring your own keyboard and the one I'm using doesn't have any fancy keys.</div>
<div>
So, I looked up how to add keyboard shortcuts. Again, it ends out to be not too hard. Just added a couple of entries into a config file.</div>
<div>
<br /></div>
<div>
First thing I had to do is decide what key combination I wanted to use. I settled on:<br />
[Shift]-[Windows Key]-[Up Arrow] for brighter</div>
<div>
[Shift]-[Windows Key]-[Down Arrow] for darker</div>
<div>
<br /></div>
<div>
To do this you need to edit the <span style="font-family: "courier new" , "courier" , monospace;">lxde-pi-rc.xml</span> file.</div>
<div>
The file is a in a hidden folder in your home folder. If using the default user pi then the following command will open it </div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">nano /home/pi/.config/openbox/lxde-pi-rc.xml</span></div>
<div>
<br /></div>
<div>
As the file is in the home folder it doesn't need <span style="font-family: "courier new" , "courier" , monospace;">sudo </span>to edit it</div>
<div>
<br /></div>
<div>
Then scroll down to the keyboard section and add the following to the end.</div>
<div>
Easiest way is in nano find the <span style="font-family: "courier new" , "courier" , monospace;"></keyboard></span> text using the command [Ctrl]-[w] to do a Where is</div>
<div>
<br /></div>
<div>
Make sure you use spaces for the indent and get the<span style="font-family: "courier new" , "courier" , monospace;"> <keybind> </span>to line up with the other <span style="font-family: "courier new" , "courier" , monospace;"><keybind> </span>entries</div>
<div>
<br /></div>
<div>
<pre style="background-color: #f7f7f7; border-radius: 3px; box-sizing: border-box; color: #333333; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.6px; font-stretch: normal; line-height: 1.45; margin-bottom: 16px; overflow: auto; padding: 16px; word-wrap: normal;"><code style="background: transparent; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.6px; line-height: inherit; margin: 0px; overflow: visible; padding: 0px; word-break: normal; word-wrap: normal;"> <keybind key="S-W-Up">
<action name="Execute">
<command>brightness increase</command>
</action>
</keybind>
<keybind key="S-W-Down">
<action name="Execute">
<command>brightness decrease</command>
</action>
</keybind></code></pre>
<br /></div>
<div>
To finish like above use [Ctr]-[x] to save and close.</div>
<div>
<br /></div>
<div>
To test select [shutdown] in the drop down menu and then [logout].</div>
<div>
No need to reboot to enable the keyboard shortcuts.</div>
<div>
Once you log back in the <span style="font-family: "courier new" , "courier" , monospace;">lxde-pi-rc.xml </span>setting will be re-enabled and the 2 new key bindings will be active giving you the ability to change the brightness of your pi-top/pi-topCEED using [Shift]-[Windows Key]-[Up Arrow] and [Shift]-[Windows key]-[Down Arrow]</div>
<div>
<br /></div>
<div>
This has been a fun little project to improve the use of the pi-topCEED.<br />
I like the work rricharz has done getting the pi-topHUB to turn off completely and to control the brightness as well as Laura Sach has done to make guizero so easy to use.</div>
<div>
<br /></div>
<div>
With the help of other peoples effort I now have the pi-topCEED completely shutdown as well as the Raspberry Pi and the ability to change the screen brightness using either a little gui app or with the keyboard. Not a bad result for a couple of hours.</div>
<div>
<br /></div>
<div>
If you have any questions let me know in the comments.</div>
<div>
<br /></div>
<div>
<br /></div>
Winkleinkhttp://www.blogger.com/profile/10921617680353539604noreply@blogger.com0tag:blogger.com,1999:blog-2902197163807965393.post-38509713999520203902016-10-12T12:00:00.001+01:002016-10-12T12:01:08.650+01:00Scratch 2.0 using Chromium on Raspberry Pi 3<br />
Playing with Scratch and thought now that Chromium is the default browser in Raspbian Pixel whether the web based Scratch would work.<br />
<br />
So, I went to http://scratch.mit.edu and picked a project to load. Up came the usual jigsaw piece saying a plug in was missing. Right clicked to enable the plug in and nothing happened. Oh, well nothing has changed. We still have NuScratch installed on the Pi.<br />
<br />
Before shutting down I did an update/upgrade, just to keep the machine up to date. <br />
A whole bunch of updates for LibreOffice and NuScratch were downloaded as well as an update to Chromium. Nothing looked too interested.<br />
<br />
Then a strange thing happened. Half way through the upgrade a screen appears asking me to confirm installing the Flash plugin. I accepted and let the upgrade take it's course.<br />
<br />
Intrigued by this I went back to the Scratch website and selected the project again.<br />
Again, the jigsaw piece appeared.<br />
Again, I selected to enable the plugin.<br />
Except this time the outcome was different. The panel went white and the familiar Scratch loading bar appeared. It was working and working well.<br />
<br />
See the video below.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/xS2L8MFvrlU/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/xS2L8MFvrlU?feature=player_embedded" width="320"></iframe></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;">
Mike Horne did a <b><a href="http://www.recantha.co.uk/blog/?p=15678" target="_blank">post on his website </a></b> this and Simon Long who does Raspbian and specifically Pixel </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/AVvXsEh_IdfMFJrIJaC2VG6KmJBs1_dWLO4WfmgHQ9B48G9bimcH8UCZRsqHdBFF4hKHP8IwVVED3Mfxs9KJ5Ki48y_KQtq0Q8thlAww89w4SnodqrNFgORFsLQOkBt8iUNFKDr8qwrZyyVdrbUP/s1600/simon_scratch.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="191" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_IdfMFJrIJaC2VG6KmJBs1_dWLO4WfmgHQ9B48G9bimcH8UCZRsqHdBFF4hKHP8IwVVED3Mfxs9KJ5Ki48y_KQtq0Q8thlAww89w4SnodqrNFgORFsLQOkBt8iUNFKDr8qwrZyyVdrbUP/s400/simon_scratch.PNG" width="400" /></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;">
Looks like Chromium had an update on the 11th and by chance I did an update to my machine soon after the release. From Simon's post this needs ARMv7 so only works on Raspberry Pi 2 and 3. Not an option for older Raspberry Pi or the PiZero.</div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
<br /></div>
Winkleinkhttp://www.blogger.com/profile/10921617680353539604noreply@blogger.com0tag:blogger.com,1999:blog-2902197163807965393.post-21676797067398552152016-10-05T11:50:00.000+01:002017-01-04T13:56:25.090+00:00NexDock thoughts on using with Raspberry Pi<br />
Earlier this year I backed the<b><a href="https://www.indiegogo.com/projects/nexdock-the-world-s-most-affordable-laptop-tablet-smartphone#/" target="_blank"> NexDock Indiegogo</a>.</b> The NexDock was primarily being promoted as a Windows Phone accessory as it supports Continuum, but since it has a miniHDMI some of us thought it might be a great partner for the Raspberry Pi.<br />
<br />
It took them 2 attempts to get funded but made it in the end.<br />
Then they had a fire at the factory which set the project back even further.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPwBcsDbtWmpsoe6Hs4qvxi-AA538HBC_W74EwRfxuBYx5TrB2eYvHEPzpVDrlU1LbYoMcZhCdJtGWtF2lutAT2z1ixBdZ8Icfb-cZ_phUCs-HndjYeE9tREp0wAggakiY-VoN1Sln03bN/s1600/ctkqdeap8t1it1lssif7.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPwBcsDbtWmpsoe6Hs4qvxi-AA538HBC_W74EwRfxuBYx5TrB2eYvHEPzpVDrlU1LbYoMcZhCdJtGWtF2lutAT2z1ixBdZ8Icfb-cZ_phUCs-HndjYeE9tREp0wAggakiY-VoN1Sln03bN/s320/ctkqdeap8t1it1lssif7.jpg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDEr93hWLajGD9Nkd0M-chUUxVDqPpkQCZbkJSoa_nVm177taOFY76C1d_kOJXYCNTmi3TLUQeyRHt1qGuTa6XmzwSs12CPZOfB9dqiqGArB8mVI7lzxemf12h79bmbhKp81pxjTOWEy6f/s1600/uzm2ymtu34elczsnzogw.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDEr93hWLajGD9Nkd0M-chUUxVDqPpkQCZbkJSoa_nVm177taOFY76C1d_kOJXYCNTmi3TLUQeyRHt1qGuTa6XmzwSs12CPZOfB9dqiqGArB8mVI7lzxemf12h79bmbhKp81pxjTOWEy6f/s320/uzm2ymtu34elczsnzogw.jpg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFREY8FARq-Rta7MekKlw9o_pkLIcwXALuPJedN6UPT7JrJFBKaqUHM0DDDkx9QzevsyFLoZlUE1Wa7Vt3pcTD5m1xjvYMPliDdQpGi27fnR4pDmfrcUgcvAIhsdBuN1BmctI1CHOFTT9r/s1600/vill0mqarddqnzw5xux6.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFREY8FARq-Rta7MekKlw9o_pkLIcwXALuPJedN6UPT7JrJFBKaqUHM0DDDkx9QzevsyFLoZlUE1Wa7Vt3pcTD5m1xjvYMPliDdQpGi27fnR4pDmfrcUgcvAIhsdBuN1BmctI1CHOFTT9r/s320/vill0mqarddqnzw5xux6.jpg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-w8sPv6iTfqXhiwOOdxunpqM-0-CUjYD9W-rooT4fp_O2_nqt8ir0YVY2gYGnFU98WJntYIhC4fBfWPiiAMAHOsCUwkq3nEecgNl96_14pEm2egOrQTEpDmMmr4LBcPAOj6jNSdjZ-xq9/s1600/yyswnfpuygbqv6jmp3t1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-w8sPv6iTfqXhiwOOdxunpqM-0-CUjYD9W-rooT4fp_O2_nqt8ir0YVY2gYGnFU98WJntYIhC4fBfWPiiAMAHOsCUwkq3nEecgNl96_14pEm2egOrQTEpDmMmr4LBcPAOj6jNSdjZ-xq9/s320/yyswnfpuygbqv6jmp3t1.jpg" width="320" /></a></div>
<br />
<br />
All respect to the NexDock team, instead of throwing in the towel they rallied and with their ODM partner picked up the pieces, had new NexDock manufactured and in the end I took delivery on the 9th of September and have been using the NexDock a fair bit since.<br />
<br />
<br />
<blockquote class="twitter-tweet" data-lang="en">
<div dir="ltr" lang="en">
<a href="https://twitter.com/NexComputer">@NexComputer</a> <a href="https://twitter.com/hashtag/NexDock?src=hash">#NexDock</a> arrived. Powering Pi3. Not sure what load it can take. <a href="https://t.co/5cT6QW99Fx">pic.twitter.com/5cT6QW99Fx</a></div>
— Albert Hickey (@winkleink) <a href="https://twitter.com/winkleink/status/774159643375349760">September 9, 2016</a></blockquote>
<script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"></script>
<br />
<br />
<b><span style="font-size: large;">Power, we have power. Oh!, maybe not</span></b><br />
<br />
My life with a NexDock didn't start too well when I noticed it wasn't charging.<br />
The charger did look a bit ropey but thought since it passed QA at the factory it must have been OK.<br />
<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/AVvXsEg8hIoHBg0zp1421mRtRcCTFEv3hQ1IoUgT1cfhKKyOYss3oY_8EwzvzMzQCd76hFr-i-2Fj3P15InSLdLZTn8-gZvwqp_M5YmS6JTOM2qDTAp-cQ7RE9ImmqCgFXJsBRxpNePPSgkvWtpv/s1600/Cr8AgFXXgAAdRzo.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8hIoHBg0zp1421mRtRcCTFEv3hQ1IoUgT1cfhKKyOYss3oY_8EwzvzMzQCd76hFr-i-2Fj3P15InSLdLZTn8-gZvwqp_M5YmS6JTOM2qDTAp-cQ7RE9ImmqCgFXJsBRxpNePPSgkvWtpv/s320/Cr8AgFXXgAAdRzo.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Not the cleanest. Should still be OK, right</td></tr>
</tbody></table>
<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/AVvXsEhF4SEZSj_lIb6hdHsWCNlJfgFapVRWO9Cqj2xgd-l5m-UZKHVVQLD2xKa_Z9gmPOe-gHdHfRsVzggnt_guiYPeILyRfkwL9jdNUnPyh00QeRsTKGCT8aNf72kLusDF_PCdnz8rOoJyfcqj/s1600/Cr8AizHXYAA2QS9.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhF4SEZSj_lIb6hdHsWCNlJfgFapVRWO9Cqj2xgd-l5m-UZKHVVQLD2xKa_Z9gmPOe-gHdHfRsVzggnt_guiYPeILyRfkwL9jdNUnPyh00QeRsTKGCT8aNf72kLusDF_PCdnz8rOoJyfcqj/s320/Cr8AizHXYAA2QS9.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">A bit of dirt never hurt anyone</td></tr>
</tbody></table>
<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/AVvXsEhbEPDumDXN5PrqnD6geyI2aqo9mdXnK1XFgjurCWg1tvHKKmGYEqnl6_FbjrYjHw-pXWITwsqTExSZgvCbHMnggCn-kKEkX60c9KdOZgnqmQ8k_P7PaO5gSDH6vxlncaIvlbrxeOFc9_om/s1600/Cr8AbzqVMAEiQfA.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbEPDumDXN5PrqnD6geyI2aqo9mdXnK1XFgjurCWg1tvHKKmGYEqnl6_FbjrYjHw-pXWITwsqTExSZgvCbHMnggCn-kKEkX60c9KdOZgnqmQ8k_P7PaO5gSDH6vxlncaIvlbrxeOFc9_om/s320/Cr8AbzqVMAEiQfA.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">I'm sure it's fine</td></tr>
</tbody></table>
<br />
Checked the power supply with a multimeter and it was dead.<br />
I submitted a Help Desk request on the support site and NexDock replied quickly that this shouldn't have happened and they were very sorry. Advising it would take a while to send me a replacement power supply so as an alternative if I was OK with it they would refund me $15 as that is the equivalent cost of a PSU on Amazon. Les Pounder who has blogged his experience here (<a href="http://bigl.es/nexdock-initial-impressions/">http://bigl.es/nexdock-initial-impressions/</a>) decided the US power supply with an adapter was not for him and he bought a suitable supply with 3.2A from CPC (<a href="http://cpc.farnell.com/stontronics/t5004st/ac-dc-power-supply-5v-3-2a-universal/dp/PW03046">http://cpc.farnell.com/stontronics/t5004st/ac-dc-power-supply-5v-3-2a-universal/dp/PW03046</a>)<br />
<br />
I still have to get a replacement power supply so in the short term I used a microUSB adapter board with the original cable to make a solution that would allow me to use any of the many microUSB chargers I have due to my Raspberry Pi addiction.<br />
<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/AVvXsEjhIzwGhjrAi2b5MB6_MRI5OVKQPeLDZWt-D7CvYAFpAWUPhl_tjNqdj_RQbd21hm8vEUTLu1Uah68iV85xlP69XeVd0jf5c6LugjsEvE3kTv2Co0E2SUTRNEfyiRs3EGVriNJiobjARMmq/s1600/CsBwk1wXgAA9kMl.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhIzwGhjrAi2b5MB6_MRI5OVKQPeLDZWt-D7CvYAFpAWUPhl_tjNqdj_RQbd21hm8vEUTLu1Uah68iV85xlP69XeVd0jf5c6LugjsEvE3kTv2Co0E2SUTRNEfyiRs3EGVriNJiobjARMmq/s320/CsBwk1wXgAA9kMl.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Functional, but maybe not a long term solution</td></tr>
</tbody></table>
<br />
This is what I have been using with the NexDock and it's served me well. The green light you can see is the power LED. Orange when charging and Green when fully charged.<br />
<div>
<br /></div>
<div>
Teething problems out of the way. What is the NexDock like to use.</div>
<div>
<br /></div>
<div>
<b><span style="font-size: large;">Keyboard and Trackpad</span></b></div>
<div>
<br /></div>
<div>
The keyboard is a decent size. The travel on the keys is comfortable.<br />
One irritation for me is the power button is where the [delete] key should be and the [delete] key has been placed below the [backspace] . So, when I make a mistake and blindly stab at [delete] I'm pressing [power] and no delete happens. Luckily the power button has to be held down for the usual 5 seconds to turn off the NexDock. What it did mean is for a while I kept thinking the keyboard unpaired from the Pi and so I went into the menu, disconnected and reconnect the NexDock. </div>
<div>
Once I figured out it was user error all was good. Still, funky placement of keys is becoming an ongoing annoyance on laptops as manufacturers pick different places for keys.</div>
<div>
Oh, and the keyboard layout is US. I'm in the UK. I can live with it as I am comfortable using different keyboard layouts, just something to be aware of.</div>
<div>
<br /></div>
<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/AVvXsEhIToh7NWNQJvxVyz1UEeoLuY_acyfz2uYTW4dREcrYccibuc2VA2vyvargYRaPyxC1K2xjRYv511lcDVERttqTK7ZeZmpMU9yP0t0-BU7aPlwzg3nnok-IK9zp9UtDFzUN5f4FAjHHWTEE/s1600/IMG_2453.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIToh7NWNQJvxVyz1UEeoLuY_acyfz2uYTW4dREcrYccibuc2VA2vyvargYRaPyxC1K2xjRYv511lcDVERttqTK7ZeZmpMU9yP0t0-BU7aPlwzg3nnok-IK9zp9UtDFzUN5f4FAjHHWTEE/s320/IMG_2453.JPG" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">You can see the keyboard layout here</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
<br /></div>
<div>
The trackpad works well once you up the speed of the 'mouse' on the Raspberry Pi. No idea why this is needed but it does work.</div>
<div>
<br /></div>
<div>
It's important to note the keyboard and trackpad are Bluetooth and not USB. So, for Pi users this works well for the Pi3, but not the Pi2 or PiZero as they do not have Bluetooth. More on this later.</div>
<div>
<br /></div>
<div>
<b><span style="font-size: large;">Screen</span></b></div>
<div>
<br /></div>
<div>
The screen, even though LCD and not IPS is sharp and works well for extended use. The resolution is the classic 1366x768. Fairly standard for laptops, but not a mode the Pi has automatically. (<b><a href="http://elinux.org/RPiconfig#Video_mode_options">http://elinux.org/RPiconfig#Video_mode_options</a></b>). Not a problem if auto selected from HDMI, but as noted below can cause some fun when working with realVNC.</div>
<div>
<br /></div>
<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/AVvXsEioDp790A3ABsQasViJPOt34nB84vAOJj5SQ1L7SEV7Utis3zhQHW8HKIPm43yDT9kpob-mvH0fpKNRmcnDfCitnJ3HSBpmK3BiAeZ0P_GTYCqmk8IJStIotCI6GoJ87jGp4NnAd8vKXLvH/s1600/Cr5eEr9UIAASwqj.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEioDp790A3ABsQasViJPOt34nB84vAOJj5SQ1L7SEV7Utis3zhQHW8HKIPm43yDT9kpob-mvH0fpKNRmcnDfCitnJ3HSBpmK3BiAeZ0P_GTYCqmk8IJStIotCI6GoJ87jGp4NnAd8vKXLvH/s320/Cr5eEr9UIAASwqj.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">First boot with Pi3 powered from NexDock</td></tr>
</tbody></table>
<div>
<br />
<b><span style="font-size: large;">Bluetooth and power </span></b><br />
<br />
As mentioned above the keyboard and trackpad are Bluetooth. They are not available over USB.<br />
With the Pi3 the NexDock is found when scanning and once paired works well.<br />
<br />
You can't back power the Pi3 through USB so it has to be powered from the microUSB power connection. This means when powering the Pi3 from the NexDock the USB devices built-in (webcam, microphone, microSD slot and USB port on the right) to the NexDock are not available. The USB port on the left that provides power is also the hub connection port.<br />
On the Pimoroni Bilge Tank they had a a frankin-cable that does power the Pi3 and connect USB so all devices are available.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/bM4fV-J1Vi8/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/bM4fV-J1Vi8?feature=player_embedded" width="320"></iframe></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Also, <b><a href="https://twitter.com/mikered" target="_blank">Mike Redrobe</a></b> did the diagram below showing the connections. </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<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/AVvXsEhaAwa4a1XJfbP4mxYzoWw26k8wdf5hw7YjSckihPo4h7LtHBZtR7gvBv0sAoJnfBvsFPHaNhlHh6HgnUq83T_0qCGb3K6RXQGFQ-6PQlYRwvo53EpTtH64EBcpeAT1-UirYA13SZGHRJFw/s1600/CsTjXOyXEAAWNQV.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhaAwa4a1XJfbP4mxYzoWw26k8wdf5hw7YjSckihPo4h7LtHBZtR7gvBv0sAoJnfBvsFPHaNhlHh6HgnUq83T_0qCGb3K6RXQGFQ-6PQlYRwvo53EpTtH64EBcpeAT1-UirYA13SZGHRJFw/s320/CsTjXOyXEAAWNQV.jpg" width="248" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Connections on NexDock</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
Personally, I haven't needed the webcam or other devices so it hasn't been a problem for me so far. <br />
I just use the USB ports on the Pi3 to connect my devices.<br />
<br />
We know that the PiZero can be back powered through USB so this looked like it could be ideal, except the keyboard and trackpad are Bluetooth.<br />
I connected a PiZero and powered it from the NexDock. Then connected a<a href="http://ebay.to/2dDSOso" target="_blank"> <b>Bluetooth dongle bought on eBay</b></a> to the port on the right.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvVlpNBcboxQP41RZax-KPyJ9pbO36SaZsDCVE5exYa0FLcTkKLQCj-dQgxwKNGpd3XR9DrP4GQIGC-qVtABgB8I4k7jhpUIF1JkkD3_Wj-sDAXul_8bsMrNhGfhKss7jswF3MCo9oL10Q/s1600/Cs4FaAAWgAQb3m0.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvVlpNBcboxQP41RZax-KPyJ9pbO36SaZsDCVE5exYa0FLcTkKLQCj-dQgxwKNGpd3XR9DrP4GQIGC-qVtABgB8I4k7jhpUIF1JkkD3_Wj-sDAXul_8bsMrNhGfhKss7jswF3MCo9oL10Q/s320/Cs4FaAAWgAQb3m0.jpg" width="320" /></a></div>
<br />
All booted, Bluetooth dongle seen, paired with NexDock. Working great, then Bluetooth device disappears. Icon in top bar grayed out. As an eBay purchase I suspected it might be faulty so used on a couple of PCs and plugged directly into a USB port on a Pi2 with the NexDock and all worked well.<br />
<br />
My conclusion is that even though there is a nice big battery inside the NexDock the USB port on the right is not a powered port and so doesn't have enough power to support the Bluetooth Dongle. It works great for an external mouse and other lower power devices, but this Bluetooth dongle seems to need more power than the port can handle.<br />
<br />
Continuing my adventure with the PiZero I used a <b><a href="https://ryanteck.uk/raspberry-pi/157-zero4u-4-port-usb-hub-for-raspberry-pi-zero.html" target="_blank">Zero4U USB hub</a></b> bought at Cambridge Raspberry Jam from Ryanteck.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBeylGk2Y3DSV3eBh8lbu6NK5dCRVCRwD96BIRAlwcOljkj1QGVY-KyhVKidEeQ_YCzxxJ6XZ42NL5PAz2Hhoj9OG2AokQwZK4Kqqr1DWCczM94uCuA_frHrqU0E2_1ORPmSJyYMDptFFT/s1600/011.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBeylGk2Y3DSV3eBh8lbu6NK5dCRVCRwD96BIRAlwcOljkj1QGVY-KyhVKidEeQ_YCzxxJ6XZ42NL5PAz2Hhoj9OG2AokQwZK4Kqqr1DWCczM94uCuA_frHrqU0E2_1ORPmSJyYMDptFFT/s320/011.jpg" width="320" /></a></div>
<br />
<br />
This attaches directly to the PiZero taking it's power from the 5V line directly to give a powered hub.<br />
With this and again back powering the PiZero from the NexDock the Bluetooth dongle worked great.<br />
Now I have a PiZero computer with keyboard/trackpad, webcam, microphone, speakers, 3.5MM headphone jack, another USB port and a microSD slot. <br />
<br />
One thing to note on Bluetooth with the Raspberry Pi is that in Raspbian Bluetooth is not set up to auto pair with devices on boot up, so for first set up you need an external mouse to pair the NexDock and the Pi.<br />
NexDock address this on their <b><a href="http://nexdock.com/support-raspberry-pi/" target="_blank">support page </a></b>and give instruction on how to set up a cronjob to enable the pairing each time your Raspberry Pi starts up.<br />
The support page also explains how to get the internal speakers working and a couple of other things.<br />
<br />
The longest time the NexDock was running was at the Cambridge Jam in September which runs from 10:30am to 4:30pm. The NexDock was set up with a Pi3 powered externally so the USB from the Pi3 was connected to the NexDock to enable the webcam. It was running Scratch Pac Man and a simple webcam viewer python program showing the person using the computer their image. <b><a href="https://github.com/winkleink/usbwebcam_pygame" target="_blank">Code on GitHub</a></b><br />
<br />
<br />
<b><span style="font-size: large;">Battery test</span></b><br />
<br />
The last thing is the battery in the NexDock. It's a 10,000mA battery, so a decent size.<br />
<br />
Powering a Pi3 idle it lasted ~6 hours and powering a Pi3 under load it lasted 3 1/2 hours..<br />
<br />
These were the times I expected using back of an envelope calculations.<br />
<br />
To run these tests I ran sysbench in one terminal window and in a second window ran a small python script that recorded to start time and every 60 seconds recorded the time.<br />
The Pi3/NexDock ran until it shut down. Then starting the Pi3 again it was just a matter of subtracting one time from the other.<br />
<br />
<br />
<b><span style="font-size: large;">Other findings</span></b><br />
<br />
I mentioned above about connecting over realVNC. Using the Pi3 on a NexDock as the client and then realVNC running on a PiZero as the server. realVNC by default sets the screen resolution to 640x480 and this function, but as you'd expect a bit painful to do anything constructive.<br />
You can change the Pi resolution by modifying the config.txt file in /boot.<br />
Problem is there is no 1366x768 resolution option, meaning full native NexDock resolution wasn't possible. I could do 1360x768(mode 39) and this worked but it did leave a few unused pixels either side of the screen. Not a massive thing, just worth noting.<br />
<br />
I also tried to enable the experimental OpenGL drivers and this failed completely. Black screen. No flashing cursor, no scrolling of the messages at start up (pre Raspbian PIXEL)<br />
To be fair to the NexDock I have the same problem with the pi-topCEED, so it might be something to do with the default non-standard (to the Pi) resolution.<br />
<br />
So, it looks like the experimental OpenGL drivers are not compatible with the NexDock display. Pity as this could have been fun for <b><a href="http://www.minetest.net/" target="_blank">Minetest</a></b>, the Minecraft-a-like open source game that is in the repo so can be installed with apt-get install minetest.<br />
It's not the latest version, but it plays great on a Pi3 with OpenGL enabled and 256MB set aside for the GPU. NOTE: Minetest makes the SOC run hot. If you are going to play Minetest on the Pi2/3 then you will need a fan. I have a heatsink on a Pi3 and that's not enough. <b><a href="http://www.winkleink.com/2016/04/minetest-on-raspberry-pi-3-with.html" target="_blank">Previous blog post about Minetest on the Pi3</a></b><br />
<br />
Also on Minetest, if you are walking/flying around and you use the trackpad to change direction you stop moving. I don't know if this is a Bluetooth keyboard/trackpad combo thing or if this is NexDock specific. Either way it means on the NexDock you can play Minecraft, but if you want to change direction while moving you have to release the forward/backward key and press it again<br />
<b><span style="font-size: large;"><br /></span></b>
<b><span style="font-size: large;">Conclusions and wish list</span></b><br />
<br />
With everything above I do like the NexDock. It feels nice to use. The keyboard and trackpad work well. For it's intended use with Windows Phone I expect it is a perfect match. With the Raspberry Pi the needs are a bit different but it does provide what I need to use it regularly.<br />
<br />
With that said for me it would go from being great to amazing as a Raspberry Pi device if:<br />
<br />
<ul>
<li>Left side had 2 USB ports. One capable of providing power and USB connection, second one USB connection at standard power rating.</li>
</ul>
<ul>
<li>Keyboard/trackpad with the option to connect as Bluetooth or USB</li>
</ul>
<ul>
<li>2 USB ports on the right.</li>
</ul>
<ul>
<li>Powered internal USB hub meaning the 2 (wish list) USB ports on the right would be able to handle devices that need power like the Bluetooth dongle and external hard drives.</li>
</ul>
<ul>
<li>UK Power supply instead of US with adapter</li>
</ul>
<ul>
<li>UK keyboard layout option</li>
</ul>
<div>
<br /></div>
<div>
I see myself using the NexDock as my primary Pi device and will over time be doing the expected nerd/geek activity of covering it in stickers which to me is a real sign of a keeper that you expect to have part of your life for a good while to come.</div>
<div>
<br /></div>
<br />
<br />
<br />
<br />
<br />
<br />
<br /></div>
Winkleinkhttp://www.blogger.com/profile/10921617680353539604noreply@blogger.com0tag:blogger.com,1999:blog-2902197163807965393.post-62946783878903493302016-08-23T13:07:00.003+01:002016-09-19T09:57:29.094+01:00buttonFlash - game made with Raspberry Pi and Arduino communicating using NRF24L01 modulesIMPORTANT: The code in this blog post is the original code which does work but may not have all the enhancements. If you're building your own I recommend grabbing the code from GitHub.<br />
GitHub link: <a href="https://github.com/winkleink/buttonFlash"><b>https://github.com/winkleink/buttonFlash</b></a><br />
<br />
<u>Update: 19th September:</u><br />Took buttonFlash to the Cambridge Raspberry Jam on the 17th of September and it got a proper outing.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe width="320" height="266" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/P50Zw_adcwo/0.jpg" src="https://www.youtube.com/embed/P50Zw_adcwo?feature=player_embedded" frameborder="0" allowfullscreen></iframe></div>
<br />
<br />
<br />
<u>UPDATE: 25th August:</u><br />
Made Raspberry Pi program look prettier<br />
Added sound effects<br />
<br />
<br />
A few years ago I thought it would be fun to come up with an outdoor game that would get people running around. The Whack-a-Mole/reflexes button game came to mind and this is the result. A game where you have to press buttons as quickly as possible.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/ZuES7ZMHF-M/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/ZuES7ZMHF-M?feature=player_embedded" width="320"></iframe></div>
<br />
<br />
Since then a great Raspberry Pi version called Whack-a-Pi was done by <b><a class="g-profile" href="https://plus.google.com/106113077613074668095" target="_blank">+ForToffee</a>. </b><br />
Here are his build instructions and videos. <b><a href="https://fortoffee.org.uk/2016/03/whack-a-pi/">https://fortoffee.org.uk/2016/03/whack-a-pi/</a></b><br />
<br />
Whack-a-Pi was in constant play at the Raspberry Pi 4th Party.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/N5e3G2eT1Ls/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/N5e3G2eT1Ls?feature=player_embedded" width="320"></iframe></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The concept for buttonFlash is similar to Whack-a-Pi but with the ability for the buttons to be much further apart. Goal is to get people running around. With the buttons further apart there was no way I was going to be managing physical wires as it would be a trip hazard and I didn't want to have to manage that many wires. So, wireless communication between the base and the buttons seemed the obvious choice.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Most fields don't have wifi. I could bring along my trusty <b><a href="http://vocore.io/" target="_blank">Vocore</a></b> and create a local WiFi hot spot but again I want this to be simple to set up and use.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<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/AVvXsEiia56BCNz4M4zD0GxfteNxLDXgP_AmFzTcz0BWZaskeBu0eNhRqmL97rXHQP9Ck-zQRjVOSa5XeC3MNWW3x2oUuC_XhCWRMSK5PoFuOuu9jTIkooOoxIJwySHOFBZROuwYKI3AxnQmc0nv/s1600/IMG_1844.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiia56BCNz4M4zD0GxfteNxLDXgP_AmFzTcz0BWZaskeBu0eNhRqmL97rXHQP9Ck-zQRjVOSa5XeC3MNWW3x2oUuC_XhCWRMSK5PoFuOuu9jTIkooOoxIJwySHOFBZROuwYKI3AxnQmc0nv/s320/IMG_1844.JPG" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">VoCore. Basically guts of a Wifi router</td></tr>
</tbody></table>
<br />
So, I thought the NRF24L01 would do the trick. They're a really cheap transceiver. They can transmit and receive signals making them ideal for short range two way communication.<br />
<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/AVvXsEg_RsW5qO8cvmc_UoTkNhMd7m3Z9w9z1ng2SRDEaWARk7KXoClzdyfGeEUydxJZSRoFwANGYGvBE3d-tEUPBmJkfNDNPdTvaOYxPj3AO60STEdqWDmYoS8NG8gYNxmr6J_xiRWpzYlXl-B5/s1600/nrf24l01.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_RsW5qO8cvmc_UoTkNhMd7m3Z9w9z1ng2SRDEaWARk7KXoClzdyfGeEUydxJZSRoFwANGYGvBE3d-tEUPBmJkfNDNPdTvaOYxPj3AO60STEdqWDmYoS8NG8gYNxmr6J_xiRWpzYlXl-B5/s320/nrf24l01.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">NRF24L01</td></tr>
</tbody></table>
<br />
This <b><a href="http://ebay.to/2byMnai" target="_blank">current UK eBay listing is for five NRF24L01 for £5.99</a></b><br />
Also, there are stable libraries for Arduino and Raspberry Pi available.<br />
<br />
On the Arduino I used the <b><a href="https://github.com/tmrh20/RF24" target="_blank">RF24 library</a>.</b> If you've the latest version of the Arduino IDE you can install this through the library manager or if you prefer you can go old school and download it from the GitHub repository at the link above. <b><a href="http://playground.arduino.cc/InterfacingWithHardware/Nrf24L01" target="_blank">More details on using the NRF24 with Arduino</a></b><br />
<br />
On the Raspberry Pi I used the following Library <b><a href="https://github.com/BLavery/lib_nrf24">https://github.com/BLavery/lib_nrf24</a></b><br />
<br />
The Arduino side was relatively straightforward to get working while the Raspberry Pi side had me stumped for a while. Then earlier this year I had a breakthrough when I met <a class="g-profile" href="https://plus.google.com/114474812906412320661" style="font-weight: bold;" target="_blank">+Elliot Pittam</a><b>.</b> He had seen the first Wimbledon Raspberry Jam and was interested in coming along. On email we discussed what we were working on and Elliot said he was using the NRF24L01 with the Pi and Arduino. We then met at a <b><a href="http://www.meetup.com/HackWimbledon/" target="_blank">HackWimbledon</a></b> event where he showed me his set up and shared his working code. Elliot helped me sort my circuit and pointed me to 2 great videos on using the NRF24L01 with both Arduino and Raspberry Pi.<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/_68f-yp63ds/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/_68f-yp63ds?feature=player_embedded" width="320"></iframe></div>
<div class="separator" style="clear: both; text-align: center;">
Tutorial 34 - Part 1</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/okdY4fIvysA/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/okdY4fIvysA?feature=player_embedded" width="320"></iframe></div>
<div class="separator" style="clear: both; text-align: center;">
Tutorial 35 - Part 2</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
With Elliot's assistance I successfully had the Raspberry Pi communicating with the Arduino.</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;">
Many of the example I found did not clearly identify which pins on the Arduino or Raspberry Pi were connected to which pins on the NRF24L01. Therefore, below is the wiring I used for the Raspberry Pi and the Arduino with the code provided. So, it all matches up nicely.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both;">
<span style="font-family: "courier new" , "courier" , monospace;"><b><u>NRF Pi GPIO Pin</u></b></span></div>
<div class="separator" style="clear: both;">
<span style="font-family: "courier new" , "courier" , monospace;">VCC 3.3V 1</span></div>
<div class="separator" style="clear: both;">
<span style="font-family: "courier new" , "courier" , monospace;">GND GND 6</span></div>
<div class="separator" style="clear: both;">
<span style="font-family: "courier new" , "courier" , monospace;">CSN GPIO8 24</span></div>
<div class="separator" style="clear: both;">
<span style="font-family: "courier new" , "courier" , monospace;">CE CPIO17 11</span></div>
<div class="separator" style="clear: both;">
<span style="font-family: "courier new" , "courier" , monospace;">MOSI GPIO10 19</span></div>
<div class="separator" style="clear: both;">
<span style="font-family: "courier new" , "courier" , monospace;">MISO GPIO9 21</span></div>
<div class="separator" style="clear: both;">
<span style="font-family: "courier new" , "courier" , monospace;">SCK GPIO11 23</span></div>
<br />
<b><u>NRF Arduino</u></b><br />
<span style="font-family: "courier new" , "courier" , monospace;">VCC 3.3V</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">GND GND</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">CSN Digital 10</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">CE Digital 9</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">MOSI Digital 11</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">MISO Digital 12</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">SCK Digital 13 </span><br />
<br />
For the Arduino to keep it compact I went with Arduino Nano compatible board on a small 170 pin breadboard. Easy build and easy maintenance.<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgM0KhHd2YI1AGp3GRnUTXknLgi-Vik758VjkzExWJmfwS-GpgjGFSAwDNmNhjBJjkWk9ldtzWa411eq2mHvj-8fjoNb3n_kTIYFIwWENXdw64NvVPX1ugrtwShNmaFpEhijfRNtI41UCa/s1600/IMG_1655.JPG" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgM0KhHd2YI1AGp3GRnUTXknLgi-Vik758VjkzExWJmfwS-GpgjGFSAwDNmNhjBJjkWk9ldtzWa411eq2mHvj-8fjoNb3n_kTIYFIwWENXdw64NvVPX1ugrtwShNmaFpEhijfRNtI41UCa/s320/IMG_1655.JPG" width="240" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Soldering on the headers to the Arduino Nano</td></tr>
</tbody></table>
<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/AVvXsEjdOtlr5BOKuXyxin46dPYTaKms-0XdopmAYWhf3jwFif6r62Z7vtv9hKZAZzC2D6seB_KiNhJSn06t6cVOKQuzsaW1Fy6JzLGFbap9pTbqt_8RCVwxfeJrqhZHbPqpjDxyZbHMe3TmPjKz/s1600/IMG_1656.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdOtlr5BOKuXyxin46dPYTaKms-0XdopmAYWhf3jwFif6r62Z7vtv9hKZAZzC2D6seB_KiNhJSn06t6cVOKQuzsaW1Fy6JzLGFbap9pTbqt_8RCVwxfeJrqhZHbPqpjDxyZbHMe3TmPjKz/s320/IMG_1656.JPG" width="240" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">All 5 completed</td></tr>
</tbody></table>
<br />
The <b><a href="http://ebay.to/2bwHjOQ" target="_blank">Arduino Nano Compatible with a suitable short USB cable are ~£4.5</a>0</b> from the UK but can be <b><a href="http://ebay.to/2bJnXa7" target="_blank">~£2.50 if time isn't an issue and you're happy to order from China/Hong Kong</a></b>.<br />
<div>
It's important to know these compatibles use the CH340G serial chip which is different to the Arduino branded. You will need <b><a href="http://www.wch-ic.com/download/list.asp?id=126%20OR%20http://www.5v.ru/ch340g.htm" target="_blank">additional drivers</a> </b>to get these working with some computers.</div>
<div>
<br /></div>
<div>
To make each of the buttons base I needed a suitable container to hold the button and the rest of the electronics and of course the button. I'd seen these great 60mm buttons with LEDs built in so I order some. Again from <b><a href="http://ebay.to/2bABySA" target="_blank">eBay UK these are about ~£7.00 for five</a></b>. </div>
<div>
<br /></div>
<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/AVvXsEic2FBIac8kFE2sP-HPwZpp1EUeNlwVMNfjd79uM59vKTUvAYpv-f0O56qPLYDWpN7cL7_ZIhJiK4ZSZCiI2fTrCRobiNvopBtyLcqmyXnMzvqH0TmsoO4YiMbDVWCAx7dc1bB9N2A2tnoB/s1600/600mm_LED_RED.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEic2FBIac8kFE2sP-HPwZpp1EUeNlwVMNfjd79uM59vKTUvAYpv-f0O56qPLYDWpN7cL7_ZIhJiK4ZSZCiI2fTrCRobiNvopBtyLcqmyXnMzvqH0TmsoO4YiMbDVWCAx7dc1bB9N2A2tnoB/s320/600mm_LED_RED.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">RED 60mm LED button</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
The ones I ordered are 12V rated which is the power for the LED. Opening it up these things just have a standard LED and a current limited resistors. The resistor was a 460 Ohm for the 12 volts. Without knowing the specific LEDs and their voltage drop and maximum current I played it safe and replaced the 460 Ohm with 150 Ohm resistors. The buttons did light very dimly with the 460s but were far brighter with the 150 Ohm. Below is the button being taken apart.</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRO72ShdUlXPiBohM7gaEf9J93VcIjLmTx4AeRuobfMglRruI7onzRwhlRFYPzyjrXux3vZBAVWIdX_HcfSoaMPYKpS29xJ16j8nGO4iV1qf-SgORU3OCx6TpD5uHtPWgD0AtP2JcH6Jmm/s1600/IMG_2382.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRO72ShdUlXPiBohM7gaEf9J93VcIjLmTx4AeRuobfMglRruI7onzRwhlRFYPzyjrXux3vZBAVWIdX_HcfSoaMPYKpS29xJ16j8nGO4iV1qf-SgORU3OCx6TpD5uHtPWgD0AtP2JcH6Jmm/s320/IMG_2382.JPG" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
button in place </div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyTXbX7lM6cFMF5jiXmPdfX45xheNeDLCD0_Sx2x3Sfrz8HiPXc-umO88JCdShj8ick32O5FwkevVC5ok7TnERpu6sdocfkqR8VbjmI2kL8w_WAIs13jH9vcuhQw2OEkeI0bNYNSB8Ba3u/s1600/IMG_2383.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyTXbX7lM6cFMF5jiXmPdfX45xheNeDLCD0_Sx2x3Sfrz8HiPXc-umO88JCdShj8ick32O5FwkevVC5ok7TnERpu6sdocfkqR8VbjmI2kL8w_WAIs13jH9vcuhQw2OEkeI0bNYNSB8Ba3u/s320/IMG_2383.JPG" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
unscrew the button/LED assembly</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjom-8OB9eCVUQTx_6rujcHqVKBsaM_7vNRRvWB2POS70GmJFXbpjzwrt6v7aJr1vxMZ_Xxdw-HhP38tBXTIFFbyof169K0GP-GFs9t1dpYKhRof4R1wN1Vt4zS0ot2GVUIMkV66hSDQTw-/s1600/IMG_2384.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjom-8OB9eCVUQTx_6rujcHqVKBsaM_7vNRRvWB2POS70GmJFXbpjzwrt6v7aJr1vxMZ_Xxdw-HhP38tBXTIFFbyof169K0GP-GFs9t1dpYKhRof4R1wN1Vt4zS0ot2GVUIMkV66hSDQTw-/s320/IMG_2384.JPG" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
pull out the LED (like Christmas lights)</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1i_euC4unFZ2N7ZSgZTbjOmk_iG-tyjysZuFvzvfwAr-1NP2xPvBveAEpr2ETfenakMcNFu8WieKT0_rAtFJeWX6ZuaFl9gmkw7XfVyCkmnQGMcDFSr_EiwjJVLGMorK_t4Bcy-6HnTrN/s1600/IMG_2385.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1i_euC4unFZ2N7ZSgZTbjOmk_iG-tyjysZuFvzvfwAr-1NP2xPvBveAEpr2ETfenakMcNFu8WieKT0_rAtFJeWX6ZuaFl9gmkw7XfVyCkmnQGMcDFSr_EiwjJVLGMorK_t4Bcy-6HnTrN/s320/IMG_2385.JPG" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
remove LED with resistor on Anode (+ side, other goes to GND)</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicHsCvP-nWIN6Cnqxpmr3_z3vfmQvMl-yTfN4BRKOrmkfPO3nPvoRTk0jj0YczATR3eLg7PhK7mAqoXHvzx0gmMRR3awOENsX9zG1AmfJeY1Hw78Y4VGFrjQUqtK3wpUrfTPs5xCoAvBEE/s1600/IMG_2386.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicHsCvP-nWIN6Cnqxpmr3_z3vfmQvMl-yTfN4BRKOrmkfPO3nPvoRTk0jj0YczATR3eLg7PhK7mAqoXHvzx0gmMRR3awOENsX9zG1AmfJeY1Hw78Y4VGFrjQUqtK3wpUrfTPs5xCoAvBEE/s320/IMG_2386.JPG" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
solder on replacement resistor and put it all back together</div>
<div>
<br /></div>
<div>
To test the LED at each stage I ran an Arduino with the blink sketched and wired the LED across pins GND and 13. Once all reassemble with the wires attached again I tested to make sure I didn't mess things up in putting it back together.</div>
<div>
<br /></div>
<div>
Next, for each Arduino I wired the NRF24L01 as per above. The LED was wired to Pin 2 and Button was wired to Pin 3. In code I activated the internal pull up resistor so the button is held high until you press it and then it goes low.</div>
<div>
<br /></div>
<div>
<br /></div>
<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/AVvXsEg81zgbq9fWAHmXMiK_BzwrP-hRYecz1fMeH-aA0-Gz6Yz6kq6oXpfgRKpA8-3pSfTi8j2IMcJ2cxPSHPNnDkAWRgXk7pkSrMY8yM5sKCMNGWwi0d6bToRSyrKkPO-1i4fIc-XFzwaTy8uB/s1600/IMG_2387.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg81zgbq9fWAHmXMiK_BzwrP-hRYecz1fMeH-aA0-Gz6Yz6kq6oXpfgRKpA8-3pSfTi8j2IMcJ2cxPSHPNnDkAWRgXk7pkSrMY8yM5sKCMNGWwi0d6bToRSyrKkPO-1i4fIc-XFzwaTy8uB/s320/IMG_2387.JPG" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">it all wired up.</td></tr>
</tbody></table>
<br />
As the Raspberry Pi needed to send a message to the Arduinos to let them know which one is to activate their button and wait for it to be pressed before replying I came up with a simple message that is extendable. Basically, the number of the Arduino followed by 'P' Examples: 1P, 2P, 3P, 4P, 5P<br />
<div>
This would be the message sent out.<br />
All Arduino would receive it and then using a simple IF statement would decide if it means they are to be activated. If not go back to listening. If yes light the button and wait for it to be pressed. Once pressed reply to the Raspberry Pi that the button has been pressed. </div>
<div>
In this way the Arduino are dumb. They only respond to a request for the button and reply it's been pressed. They don't care if they are the first, second, third,... button to be pressed in the game. All that is managed at the Raspberry Pi.</div>
<div>
<br /></div>
<div>
To make it easier to setup and to test I included a test mode.</div>
<div>
When you press 't' it sends the test message and all the Arduino flash their LEDs 5 time. Then Arduino 1 (as there will always be at least 2 Arduino) replies that it is completed.</div>
<div>
The Raspberry Pi doesn't do anything with this message as the test is to see if it is sent and replied to which the users sees in the console.</div>
<div>
This means Button/Arduino 1 has slightly different code to all the rest of the buttons.</div>
<div>
<br /></div>
<div>
Button/Arduino 1 code with the extra bit for Arduino 1 only highlighted in <span style="color: red;">RED</span></div>
<div>
For each Button/Arduino the text highlighted in <span style="color: blue;"><b>BLUE</b> </span>needs to be changed to matched the relevant reference in the Raspberry Pi list. This text is the same in all 3 locations so you can do a Find/Replace to do it in one go.</div>
<div>
<br /></div>
<div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">#include<SPI.h></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">#include<RF24.h></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">//ce. csn pins</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">RF24 radio(9, 10);</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">int buttonPin = 3;</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">int ledPin = 2;</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">int x;</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">void setup(void) {</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> pinMode(buttonPin, INPUT_PULLUP);</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> pinMode(ledPin, OUTPUT);</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> while (!Serial);</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> Serial.begin(9600);</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> radio.begin();</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> radio.setPALevel(RF24_PA_MAX);</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> radio.setChannel(0x76);</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> radio.openWritingPipe(0xF0F0F0F0E1LL);</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> const uint64_t pipe = 0xE8E8F0F0E1LL;</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> radio.openReadingPipe(1, pipe);</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> radio.enableDynamicPayloads();</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> radio.powerUp();</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">}</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">void loop() {</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> radio.startListening();</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> Serial.println("Starting Loop, Radio on <b><span style="background-color: white; color: blue;">1P</span></b>.");</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> char receivedMessage[32] = {0};</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> if (radio.available()) {</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> radio.read(receivedMessage, sizeof(receivedMessage));</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> Serial.print("Received Message: ");</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> Serial.println(receivedMessage);</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> Serial.println("Turning off the radio.");</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> radio.stopListening();</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> String stringMessage(receivedMessage);</span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">// Actual action if asked for button press</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> if (stringMessage == "<b><span style="background-color: white; color: blue;">1P</span></b>") {</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> digitalWrite(ledPin,HIGH);</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> while (digitalRead(buttonPin) == HIGH){</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> }</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> digitalWrite(ledPin, LOW); </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> Serial.println("looks like they want a string");</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> const char text[] = "Node <b style="background-color: white;"><span style="color: blue;">1P</span> </b>- Hello";</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> radio.write(text, sizeof(text));</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> Serial.println("We sent our message: " + String(text));</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> }</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">// Test scenario </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> if (stringMessage == "TEST") {</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> for(x=0; x < 5; x++){</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> digitalWrite(ledPin,HIGH); </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> delay(500);</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> digitalWrite(ledPin, LOW);</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> delay(500);</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> }</span></div>
<div>
<span style="color: red; font-family: "courier new" , "courier" , monospace;"> Serial.println("Test completed");</span></div>
<div>
<span style="color: red; font-family: "courier new" , "courier" , monospace;"> const char text[] = "Test done";</span></div>
<div>
<span style="color: red; font-family: "courier new" , "courier" , monospace;"> radio.write(text, sizeof(text));</span></div>
<div>
<span style="color: red; font-family: "courier new" , "courier" , monospace;"> Serial.println("We sent our message: " + String(text));</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> }</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> }</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> delay(100);</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">}</span></div>
<div>
<br /></div>
</div>
<div>
On the Raspberry Pi side the code is a little more interesting as it sets up the NRF24L01 and then creates a graphical window using pygame and finally runs the game. At this stage it displays Score and High Score.</div>
<div>
<br /></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgI89QcVXzXfZKalR3mZPUOJLpuZprOdRran5Zyb2CQRC7g0B5qvEmiDs73cmOIPPG8VcGXP-6hUFCV7VMAEEgHLsi-HfK9nK4s9254AsZmj8xEwJ5p_8wDHggu8s0beyOwsoLSlJjBd0Ik/s1600/buttonFlash_pygame.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="239" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgI89QcVXzXfZKalR3mZPUOJLpuZprOdRran5Zyb2CQRC7g0B5qvEmiDs73cmOIPPG8VcGXP-6hUFCV7VMAEEgHLsi-HfK9nK4s9254AsZmj8xEwJ5p_8wDHggu8s0beyOwsoLSlJjBd0Ik/s320/buttonFlash_pygame.PNG" width="320" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
The steps to get the Raspberry Pi ready are:<br />
Wire up the NRF24L01 as per above</div>
<div>
Use the Raspberry Po configuration program to enable SPI (you have to reboot after this)</div>
<div>
Then run the following commands.</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">sudo apt-get update</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">sudo apt-get upgrade </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">sudo apt-get install python-dev python3.dev -y</span></div>
<div>
<br /></div>
<div>
I'm assuming you're in hour home directory for the rest of this.</div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">mkdir buttonFlash</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">git clone https://github.com/Gadgetoid/py-spidev</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">cd py-spidev</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">sudo python setup.py install</span></div>
<div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">sudo python3 setup.py install</span></div>
</div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">cd ..</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">git clone https://github.com/BLavery/lib_nrf24</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">cd lib_nrf24/</span></div>
</div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">cp lib_nrf24.py ~/buttonFlash</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">cd ..</span></div>
</div>
<div>
<br /></div>
<div>
You should now have SPI working with the python SPI libraries installed for Python 2 and 3 as well as the required lib_nrf24 for working with the NRF24L01 from python.</div>
<div>
Finally the library file is copied to the buttonFlash directory.</div>
<div>
<br /></div>
<div>
Copy the Raspberry Pi code into the buttonFlash directory and run it.</div>
<div>
<br /></div>
<div>
All the necessary files and code are available on GitHub <b><a href="https://github.com/winkleink/buttonFlash">https://github.com/winkleink/buttonFlash</a></b></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">sudo python3 buttonFlash.py3</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: inherit;">Yeah. Now it all technically works</span></div>
<div>
<span style="font-family: inherit;">Here is a short example of it running after the initial build.</span></div>
<div>
<span style="font-family: inherit;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/3Ig7QSKWpdI/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/3Ig7QSKWpdI?feature=player_embedded" width="320"></iframe></div>
<div>
<span style="font-family: inherit;"><br /></span></div>
<div>
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">With the electronics sorted and the programs functioning the next requirement was a housing for the buttons. </span><span style="font-family: inherit;">I thought I found the perfect one when I got this </span>spaghetti container<span style="font-family: inherit;"> from Home Bargains. It all fit comfortable and the button was really secure.</span></div>
<div>
<span style="font-family: inherit;"><br /></span></div>
<div>
<span style="font-family: inherit;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdQmCHARVA8zlphaqca5mEXZrJiLcBxmXlsHzulT2-2BzmfB6bcHzLSZEOq8HYE4eCTLkWvoL5Wt2iPEzkeOIjr2r1p-2dlDGBcREb8WGXoWfAhxzAUCo9xahveMAbwU0-gLCw1pmuhPBM/s1600/IMG_1654.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdQmCHARVA8zlphaqca5mEXZrJiLcBxmXlsHzulT2-2BzmfB6bcHzLSZEOq8HYE4eCTLkWvoL5Wt2iPEzkeOIjr2r1p-2dlDGBcREb8WGXoWfAhxzAUCo9xahveMAbwU0-gLCw1pmuhPBM/s320/IMG_1654.JPG" width="240" /></a></div>
<div>
<span style="font-family: inherit;"><br /></span></div>
<div>
<span style="font-family: inherit;">Only problem was when I went back to get more they were out of stock with no idea when/if more would be coming in. Then I saw the Pringles can and tried it out and it worked. Pringles cans for the win.</span></div>
<div>
<span style="font-family: inherit;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7_0PRK3cx6ohNebxoxufKbRDgknxmVUfX1Nrk5fAIyAZR7dF5HTxWfwn7-w1VRnS7MDou_Tf3tuoesi9KLlDzfUAdB2iBUM9L6ZBO5sEH24AKQ4FVlnRx7BB_kZ5jxOym3dkoculCTpIh/s1600/IMG_1650.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7_0PRK3cx6ohNebxoxufKbRDgknxmVUfX1Nrk5fAIyAZR7dF5HTxWfwn7-w1VRnS7MDou_Tf3tuoesi9KLlDzfUAdB2iBUM9L6ZBO5sEH24AKQ4FVlnRx7BB_kZ5jxOym3dkoculCTpIh/s320/IMG_1650.JPG" width="240" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div>
<span style="font-family: inherit;"><br /></span></div>
<div>
Oh, and I had to eat another 4 cans of Pringles to get the 5 required. </div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCFPdz6-sMwWyBcgjdzWwMjpCzCtLgH6HYDbLVUesgukh6Qvb5Z_vu0SyBMYGew4jL1IIgiBvNxRmMhE5Wkm0yf0K4Johfd3dFgdvF85srVn-OD5nUifadVh79QwWfzWqj4mbqFnieTxHD/s1600/IMG_1660.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCFPdz6-sMwWyBcgjdzWwMjpCzCtLgH6HYDbLVUesgukh6Qvb5Z_vu0SyBMYGew4jL1IIgiBvNxRmMhE5Wkm0yf0K4Johfd3dFgdvF85srVn-OD5nUifadVh79QwWfzWqj4mbqFnieTxHD/s320/IMG_1660.JPG" width="320" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
As this is designed to be played indoors or outdoors I needed to fina a way to make them stable when placed in a field. I went super simple and bought 150mm bolts with nuts and passed them through the bottom of the Pringles cans. You'll notice I numbered each can and there is also a colour listed. I bought 5 different coloured breadboards so I could tell which Button/Arduino was in each can. </div>
<div>
You can see the bottoms of the tubes are deformed a bit. Ends up Pringles cans aren't super strong. Means I have to re-tighten the nuts as they work lose. Wonder if an application from a glue gun will sort this out.<br />
<br />
<br /></div>
<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/AVvXsEj1rr6aHpJUGQwq6a1TKL0GwuxK6BdzkwZiEG3Qnb3N0Bckgj50wh3pLPXpFK5_du6UPZGZeU7HIe2TUclJUwlBIV1hoDiGCLMzCbovfhaTaokh5cl3-klUXGkg2gjJ8Omg1ycGDb9iKTVa/s1600/IMG_2388.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1rr6aHpJUGQwq6a1TKL0GwuxK6BdzkwZiEG3Qnb3N0Bckgj50wh3pLPXpFK5_du6UPZGZeU7HIe2TUclJUwlBIV1hoDiGCLMzCbovfhaTaokh5cl3-klUXGkg2gjJ8Omg1ycGDb9iKTVa/s320/IMG_2388.JPG" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">bottom of each Tube with bolt, number and colour </td></tr>
</tbody></table>
<div>
<br /></div>
<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/AVvXsEhI6Uuq-Kk2henwOkHyEyU0cU1CpLGIS3Xnz9yXEu5X2d-9bZp22soZe9ZN9IcJ9o5C3qbKc_t3zzqRC-jISdDDbuCNOG5OfocDkXIRAJdmi4IP0o1J9q2OzMrJ6MpGkvzAi8gYvAg213PQ/s1600/IMG_2389.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhI6Uuq-Kk2henwOkHyEyU0cU1CpLGIS3Xnz9yXEu5X2d-9bZp22soZe9ZN9IcJ9o5C3qbKc_t3zzqRC-jISdDDbuCNOG5OfocDkXIRAJdmi4IP0o1J9q2OzMrJ6MpGkvzAi8gYvAg213PQ/s320/IMG_2389.JPG" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">all the bits outside the can.</td></tr>
</tbody></table>
<br />
If you watched the video at the top or the video at the bottom you might have noticed the Pringles cans have a bit of a base to keep them stable for indoor use. In the rush to push the buttons the Pringles cans were falling over. The solution was some microwave pots that tapered from the bottom to the top turned upside down and with a hole cut int he bottom. This gives a nice wide base. If further stability is needed these pots could be filled with sand or stones to weigh down the bottom even more.<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/AVvXsEgiUqn0LqDFNIecxhYxdQktc-Z-TwXPVR8kgf-gpK3E6lV-XZNmZQ6JQBLLPZ9yVTVBlBCKUTwLpViI8SbbwjzNTwNX0rvuMUTGe6mO9v8dHOfGePipTyjm52vdV2sa1PzA22rVSLtAAwQw/s1600/IMG_2485.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiUqn0LqDFNIecxhYxdQktc-Z-TwXPVR8kgf-gpK3E6lV-XZNmZQ6JQBLLPZ9yVTVBlBCKUTwLpViI8SbbwjzNTwNX0rvuMUTGe6mO9v8dHOfGePipTyjm52vdV2sa1PzA22rVSLtAAwQw/s320/IMG_2485.JPG" width="240" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">microwave pot used as base</td></tr>
</tbody></table>
<br />
This was an interesting build as I never used NRF24L01s before. Finding the information on how to get them to work and wire them up was interesting as most of the guides nearly provided the full details and they all seemed to provide slightly different information. So, I enjoyed solving that riddle and end up with a playable game that scales in the number of buttons and also the space.<br />
This could be set up as 10 buttons on a table with all the cans tied to each other or as 20 buttons around the outside of a field. You'll hear in the video below that the Raspberry Pi can call out the button numbers. This definitely made it a bit easier as you quickly learn which button is which position. For outdoor use if it is very sunny I have a feeling the LEDs in the buttons will not be bright enough. So, next I will be adding more lights and indicators to the buttons so they can be identified outdoors. <br />
<br />
<br />
Here's another video of the game being played at the Cambridge Raspberry Jam.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe width="320" height="266" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/D4C1RjscIZM/0.jpg" src="https://www.youtube.com/embed/D4C1RjscIZM?feature=player_embedded" frameborder="0" allowfullscreen></iframe></div>
<br />
If you have any questions or comments let me know.<br />
<br />
<br />
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
Winkleinkhttp://www.blogger.com/profile/10921617680353539604noreply@blogger.com3tag:blogger.com,1999:blog-2902197163807965393.post-36575811263420628332016-08-22T21:41:00.002+01:002016-08-25T13:07:46.820+01:00eBay USB soldering iron in use<br />
Sometimes I've to do a little bit of soldering. Usually only a few wires and since at present I have no place to leave an iron set up permanently this requires for me to either unpack my rework station or even just a simple mains powered soldering iron.<br />
Even doing this has resulted in me pushing back soldering jobs as the extra time for setup<br />
as a ratio against actual build time doesn't feel like time well spent.<br />
<br />
Then on eBay UK I came across a listing for <a href="http://ebay.to/2bZWcP6" style="font-weight: bold;" target="_blank">USB soldering iron</a> for £3.39<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgu9cN8bM5z73czrBlNPXb_qV9-Nm-SF0MvxJvKV69C2EDfH6Fn7clU-xyCeA4tClR5yhajjM6fC8iPPn-hVgz0te9JggdwP-Qbc14yUoUmv5vqV7m1al99BsIK7KkgUVfcq0ybeJlEuGJr/s1600/usb_soldering_iron.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgu9cN8bM5z73czrBlNPXb_qV9-Nm-SF0MvxJvKV69C2EDfH6Fn7clU-xyCeA4tClR5yhajjM6fC8iPPn-hVgz0te9JggdwP-Qbc14yUoUmv5vqV7m1al99BsIK7KkgUVfcq0ybeJlEuGJr/s320/usb_soldering_iron.jpg" width="320" /></a></div>
<br />
Since my electronics is usually tied to an Arduino or Raspberry Pi project I will have a computer up and running and I thought for less than £4.00 including shipped from Hong Kong it was worth a punt.<br />
Well, it arrived this week and as per the picture it includes the soldering iron with a plastic cover for the top. A USB to 3.5mm jack for power. A really small stand made from a folded piece of metal with a bit taken out and just enough solder to know it's working. Actually I soldered about 30 wires using the solder provided and have a bit left over. Still you'll need to get some solder.<br />
<br />
First impressions were positive. Packed in a proper retail packaging box and not just a jiffy bag like many cheap things on eBay from Hong Kong.<br />
<br />
The iron heated up quickly and has a red LED to let you know it's on.<br />
It was definitely hot enough to melt the solder and do the job I required.<br />
Since the original outing I have used it again to replace some current limiting resistors for 5 LEDs in a project I'm working on. Again all worked great.<br />
<br />
As I've only used it twice I can't speak for the long term reliability but from first impressions it is well worth the £3.39 it cost me.<br />
<br />
The only things I would change are:<br />
I would have liked the power to be microUSB and not 3.5mm jack. I've loads of microUSB cables but this is my only USB-3.5mm cable. If I lose it I'll have to get a new kit. Probably not a disaster at £3.39 and then I'd have a backup.<br />
<br />
The tip on the iron is a needle tip. My personal preference is a bevel tip. The ones where it's like they cut a diagonal slice off a flat tip.<br />
Here is a <a href="http://www.instructables.com/id/Uses-of-Different-Soldering-Iron-Tips" target="_blank"><b>nice instructable explaining the different tips</b></a>. My preference is called a C series tip in the guide. Rarely do really fine work and even then a bevel can still be used quite well for most things.<br />
<br />
Saying all this for less than £4.00 it feels nice to use and means I can set up, do the rework and pack away in minutes. Which is ideal when only soldering a few wires at any one time.<br />
<br />
UPDATE: after posting this I was sent a link to a great video by bigclivedotcom where he tests, tearsdown reverse engineers the circuit diagram. Let's just say his review is way better than mine.<br />
Here's the video.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe width="320" height="266" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/o-8D5t6TJYU/0.jpg" src="https://www.youtube.com/embed/o-8D5t6TJYU?feature=player_embedded" frameborder="0" allowfullscreen></iframe></div>
<br />
<br />Winkleinkhttp://www.blogger.com/profile/10921617680353539604noreply@blogger.com0tag:blogger.com,1999:blog-2902197163807965393.post-37692712289069329972016-07-19T20:29:00.000+01:002016-07-19T20:52:33.887+01:00Toy crane controlled from Raspberry Pi Zero with SenseHat using Scratch<br />
Since the micro:bit was launched one of the demos that I kept seeing was the <b><a href="https://www.kitronik.co.uk/blog/bbc-microbit-controlled-crane/" target="_blank">toy crane controlled using the motion sensing in the micro:bit</a></b>. The kids loved it and was very interactive. <br />
<br />
Since the SenseHat on the Raspberry Pi has the motion sensors built in I thought this would a good project for a Raspberry Jam.<br />
<br />
So, off I went to <b><a href="http://www.homebargains.co.uk/products/9651-jcb-remote-control-tower-crane.aspx" target="_blank">Home Bargains and bought a crane</a></b>. From the picture, definitely the right age for me. This crane is normally controlled using two levers on the hand controller. It can rotate and raise/lower the bucket. <br />
<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/AVvXsEixca2SOZKluFXSXnE2T7gHJkJeYXEmut6p8s4dXHYHT0kF9Sgoo8r6I-1wpIuh3BAgbXiSaTscw_KywAZyXzMvZ_C60sMbK7AjctLTSmr60jeAydm4GPYSX0MaMvcMkhfpwjQhcCHHJL2g/s1600/crane_box.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixca2SOZKluFXSXnE2T7gHJkJeYXEmut6p8s4dXHYHT0kF9Sgoo8r6I-1wpIuh3BAgbXiSaTscw_KywAZyXzMvZ_C60sMbK7AjctLTSmr60jeAydm4GPYSX0MaMvcMkhfpwjQhcCHHJL2g/s400/crane_box.jpg" width="300" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Didn't come with the hard hat</td></tr>
</tbody></table>
First order of business was to figure out the wiring and cut the cable as the final build would be battery powered to work the same as the micro:bit version.<br />
<br />
<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/AVvXsEi5DqLCRL05QuomFLkZTu8uwyJELA34eXPMAAM29lxnenx5YIrOqwyFJgkVDVYUOYJ-xMF92P3kU8tYg1a77kEyB9-4P9aSucqa9NAc2kbBv4gO3OJgwQFalWEMw8-vTy1f4lf-uXYbVRSU/s1600/crane_wiring.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5DqLCRL05QuomFLkZTu8uwyJELA34eXPMAAM29lxnenx5YIrOqwyFJgkVDVYUOYJ-xMF92P3kU8tYg1a77kEyB9-4P9aSucqa9NAc2kbBv4gO3OJgwQFalWEMw8-vTy1f4lf-uXYbVRSU/s400/crane_wiring.jpg" width="300" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Cut the red wire</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
From above the wiring is:</div>
<b>VCC - </b>Red wire<br />
<b>GND - </b>Brown wire (not black)<br />
<br />
<b>Rotate motor </b><br />
Orange and Yellow<br />
<br />
<b>Crane lift motor</b><br />
Blue and Green.<br />
<br />
For turning and crane the direction it goes depends on how you wire it up and how your code works so some adjusting may be needed later.<br />
<br />
To make sure I had this right I tested by touching Red to Orange and Brown to Yellow. Crane rotated one way. Swapped wires around and crane rotated the other way.<br />
Red to Blue and Brown to Green, Bucket went down. Swapped wires around and bucket went up.<br />
<br />
Wiring confirmed and tested.<br />
<br />
As the Raspberry Pi isn't designed to control motors directly I needed a small motor controller.<br />
The <b><a href="http://ebay.to/29RUhW6" target="_blank">L9110s</a></b> looked perfect for the job. Smaller than the L298N that I usually use so would be easier to accommodate in the final box.<br />
<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/AVvXsEiWuym8n3B2D29gmrMEvvQGFMXuoDiW9UcjAtGWmklKM36Mnm0YUTp39Ue0OVgbVv2fY4Wrm-d8XCVKsDumGDMgYiGpF6ISi2fz2TQUbnZdgLTusRruUjrm-BoAEQTeJqzjGfbsyXRoJ4JL/s1600/l9110s_2.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="286" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWuym8n3B2D29gmrMEvvQGFMXuoDiW9UcjAtGWmklKM36Mnm0YUTp39Ue0OVgbVv2fY4Wrm-d8XCVKsDumGDMgYiGpF6ISi2fz2TQUbnZdgLTusRruUjrm-BoAEQTeJqzjGfbsyXRoJ4JL/s320/l9110s_2.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">L9110s motor controller</td></tr>
</tbody></table>
The 2 terminal blocks on the left in the image are for the motors.<br />
On the right are the control pins and power.<br />
Top 2 connections are control for Motor A<br />
Bottom 2 connections are control for Motor B<br />
Then in the middle are VCC and GND<br />
<br />
NOTE: A really important thing is to make sure when using multiple boards that all the GND lines are tied together so that all the voltages have the same base reference. Otherwise strange things can happen.<br />
<br />
I wired up the motors. Turning uses GPIO 5 and GPIO 6 on the Raspberry Pi and Motor B on the L9110s while lifting uses GPIO 27 and GPIO 17 and Motor A.<br />
<br />
Again did some simple code to see if it would work from Scratch. Initially manually moving with the keyboard. It worked great and I brought it along to the Egham Jam in April 2016. As the organiser of the Jam I was a bit delinquent in taking pictures so the only one I have is of the crane, bottom left in the booth of the car before I went to the event. I promise the kids loved it and it was a massive hit, really. Actually, I had a different project called <b><a href="http://www.winkleink.com/2016/01/zero-ball-game-using-raspberry-pi-gpio.html" target="_blank">ZeroBall </a></b>that was finished so it took most of my time.<br />
<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/AVvXsEjawDsuSciLp-zVMRRV5H1C4UFJlKKaC7DOqsYAVVQv9jF8GRTi7HH3VQea8WTKP6VjvBBkRyKbhQCFyjl_SihjVpqNdmwzCjqpIM1lzHB_8sOPAJdE9HAn30WO8im7v_SHzSLDZeIhaVIW/s1600/IMG_1451.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjawDsuSciLp-zVMRRV5H1C4UFJlKKaC7DOqsYAVVQv9jF8GRTi7HH3VQea8WTKP6VjvBBkRyKbhQCFyjl_SihjVpqNdmwzCjqpIM1lzHB_8sOPAJdE9HAn30WO8im7v_SHzSLDZeIhaVIW/s400/IMG_1451.JPG" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Bottom leftis the crane</td></tr>
</tbody></table>
There were two technical reason I didn't have it all set up with motion sensing and coded in Scratch for the Jam.<br />
<br />
<ol>
<li>The SenseHat covers all the GPIO pins meaning I couldn't get at the pins to attach the wires for the motor controller. So, I could get the readings from the SenseHat but couldn't control the motors.</li>
<li>The Scratch at the time had a problem whereby it didn't support AddOn board. </li>
</ol>
<br />
<br />
The first problem was solved with Stacking Headers and great tutorial from <b><a href="http://www.pi-tutorials.co.uk/post/145521104849/i-have-been-playing-around-with-the-raspberry-pi" target="_blank">Keith's Pi Tutorials</a></b> even has a video.<br />
Also, a great reference site for Raspberry Pi board pin usage is pinout.xyz. They have loads of boards listed and this is where I got the <b><a href="https://pinout.xyz/pinout/sense_hat" target="_blank">details for the pins used on the SenseHat</a></b><br />
<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/AVvXsEhqNEZopJq4SwlQ7Yi446WhszGHipR1VRoCa8AdkR3pyOXviPa-7acmDhxNhH8EChVOOca2SOSvzxcuLo4xQVGeRfaVDPGHLpIHO3YA3q_fPDlzPFHhE4y0nOJ7UWrw7dMLZB-9LwGgM8PS/s1600/stacking_header.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqNEZopJq4SwlQ7Yi446WhszGHipR1VRoCa8AdkR3pyOXviPa-7acmDhxNhH8EChVOOca2SOSvzxcuLo4xQVGeRfaVDPGHLpIHO3YA3q_fPDlzPFHhE4y0nOJ7UWrw7dMLZB-9LwGgM8PS/s320/stacking_header.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Stackable Headers. Note the high tech blutac for holding it all in the tub</td></tr>
</tbody></table>
<br />
<br />
The second problem of Scratch not working at all with AddOn boards was <b><a href="https://github.com/raspberrypi/scratch/issues/183" target="_blank">reported and fixed in the May 2016 Raspbian update</a></b>.<br />
<br />
With the purchase of <b><a href="http://thepihut.com/products/stacking-header-for-raspberry-pi-2x20-extra-tall-header" target="_blank">Stackable Headers from The Pi Hut</a></b> and a freshly imaged SD card both of these technical problems were overcome and the way forward was sorted for the SenseHat to be used to control the crane.<br />
<br />
Since I wanted it to be battery powered the Raspberry Pi Zero was the obvious choice as it is low power. Only thing is Scratch is a GUI program and so I needed a desktop environment to run it (If you can run Scratch code without a GUI I'd love to know, but I suspect it kind of defeats the purpose of a drag and drop interface if you run it from the command line)<br />
<br />
To overcome this I used a USB wifi dongle to connect over the network to the PiZero and then on a laptop used <b><a href="https://github.com/RealVNC/raspi-preview" target="_blank">RealVNC </a></b>to get a desktop. Since this was going to be shown at the first Wimbledon Raspberry Jam I didn't know if I would have a wifi network to connect to so I brought my own in the shape of a <b><a href="http://vocore.io/" target="_blank">VoCore</a>. </b>A one inch cubed wireless router running openWRT. I backed this as a crowdfunding thing a while back and all I've used it for it to create a local wifi hotspot. At the Jams I can even power it from a powered Raspberry Pi USB port.<br />
<br />
<b>Side Notes:</b><br />
I think the number is the manufacturing order of the original batch and I've never seen one with a number lower than 26.<br />
The VoCore is only the top layer. The rest is an add-on that gives you USB, Ethernet, microUSB power socket and a microSD slot. IT also has it's own GPIO pins so can be used for embedded projects.<br />
<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/AVvXsEgibvW_YI2O1JTmqAK5nsqmC1QeF87OGy-WU9Kk_l6GPaFcmmwwfcBt1oAjJtzZnuclQfbKBmFgUHjjiGSyaI5-_6ZvrwdHATVnR6-YkQLh33w-njVA2e7UBvW1kE7A_UEx4zByh3Q7frNr/s1600/IMG_1844.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgibvW_YI2O1JTmqAK5nsqmC1QeF87OGy-WU9Kk_l6GPaFcmmwwfcBt1oAjJtzZnuclQfbKBmFgUHjjiGSyaI5-_6ZvrwdHATVnR6-YkQLh33w-njVA2e7UBvW1kE7A_UEx4zByh3Q7frNr/s400/IMG_1844.JPG" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Vocore. Basically, the guts of a wifi router</td></tr>
</tbody></table>
Obviously, as this was going to be standalone it had to be battery powered. I'd been picking up these 18650 Lithium Ion batteries in Poundworld and thought 4 of these in a case would make a decent power supply for the day. No idea why when I cracked them open one was pink. The battery case was from eBay and it all snapped together really easily.<br />
The case has 2 USB ports for power so could power the Raspberry Pi and the VoCore at the same time.<br />
<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/AVvXsEgVNBQUhPZNgWNG6VwDVgDIX6H3cg9rbryOclR4iCFKVNzUVyqOh0HqsB3kmgNjj5ZPn6TXjDmCWP_bZMZPa4NdQ8ZXXsXGXLcZOb-aYUuPDQ0Glq2_GzIrcSx17Mv8RuVXDgwub_9Co2Qu/s1600/IMG_1528.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVNBQUhPZNgWNG6VwDVgDIX6H3cg9rbryOclR4iCFKVNzUVyqOh0HqsB3kmgNjj5ZPn6TXjDmCWP_bZMZPa4NdQ8ZXXsXGXLcZOb-aYUuPDQ0Glq2_GzIrcSx17Mv8RuVXDgwub_9Co2Qu/s320/IMG_1528.JPG" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Batteries in their original cases</td></tr>
</tbody></table>
<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/AVvXsEhJ0hDjC0Tyd5Kd9XiBsvQgxwdQee34sr9bYsPls1HXbUjlvP0pFN22HfdteNzvfP4uq7o9ZI-bRjPC-QQfwl1JXtTzNQq7r-KvyE7-0CWgSST32VDaADHPlLzBS6SDN2LoN68-iyNsCTpl/s1600/IMG_1532.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJ0hDjC0Tyd5Kd9XiBsvQgxwdQee34sr9bYsPls1HXbUjlvP0pFN22HfdteNzvfP4uq7o9ZI-bRjPC-QQfwl1JXtTzNQq7r-KvyE7-0CWgSST32VDaADHPlLzBS6SDN2LoN68-iyNsCTpl/s320/IMG_1532.JPG" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Batteries in their new case</td></tr>
</tbody></table>
<br />
<br />
I mentioned above that all the Grounds need to be tied together. In this instance I have 3 circuits that need to all have the same GND. Crane, L9110s and Raspberry Pi Zero (The SenseHat is take care of through the Pi Zero)<br />
I tied the Crane GND (Brown wire directly to Pin 39 on the Raspberry Pi, then the GND pin on the L9110s was tied to Pin 6 on the Raspberry Pi. In this way all 3 had a common GND. <br />
<br />
It's good to be aware that in a circuit all GND can usually be treated as the same point. Especially for such low power and low frequency signals. If this was a high power high frequency circuit then the trace length between the different GND points could case harmonics. I cannot think of a project using the Pi that I would do where the length of the trace between GND pins would be a problem<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhf9CmBw8vPoXyKFkVIfx8cU3dB5CCcHdLqptXDDKQEDMpO7lyqvznjDoWyl6bJk_bb7i-u2Km6h1fGLJmgy6w4Gwfq5KuvYQqJtk7_hca1S920UIDfU9k6f7_anvteeXaTMrgKavHHD8ga/s1600/all_bits.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhf9CmBw8vPoXyKFkVIfx8cU3dB5CCcHdLqptXDDKQEDMpO7lyqvznjDoWyl6bJk_bb7i-u2Km6h1fGLJmgy6w4Gwfq5KuvYQqJtk7_hca1S920UIDfU9k6f7_anvteeXaTMrgKavHHD8ga/s320/all_bits.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
So, now I have power, local network, a way to run Scratch so people can see the code and all the bits wired up. Last of all was the actual Scratch code.<br />
<br />
From the image you'll see the code isn't very complex. The main thing I'd to figure out was which one of the sensors I needed to read. It's the Accelerometer.<br />
I believe the range is -4095 to + 4095 on each axis.<br />
When the program is run a base "flat' reading for Lifter and Turning is taken so any movement in the sensor doesn't carry from one person to the next. This is what the middle block of code does.<br />
The block of code on the right is there if it all goes wrong and I can just press [space] to turn off the motors.<br />
<br />
Th middle block is where the magic happens. It checks if Accelerometer X is 1000 less or 1000 more than the flat reading for Lifter and/or Turning and then activates the appropriate motor to either turn the crane or raise/lower the bucket.<br />
<br />
Not shown below is a second costume for the crane that just says "Put Pi on a flat surface" at the start of the calibration.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRN6nWRB4WHARF0_kaT7_VfeXUlQ8S7qgzi4uHHDNAbFZcXDq_ORdeVhtXdF3Ftz5rWDJSBkKTzQFznBas7nkhEsjPJ5hLyLzs2qvKefRuX_nJoFGdcDPpD6NEIUKCtcoZfu5d8ozN6q21/s1600/scratch_code.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="233" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRN6nWRB4WHARF0_kaT7_VfeXUlQ8S7qgzi4uHHDNAbFZcXDq_ORdeVhtXdF3Ftz5rWDJSBkKTzQFznBas7nkhEsjPJ5hLyLzs2qvKefRuX_nJoFGdcDPpD6NEIUKCtcoZfu5d8ozN6q21/s400/scratch_code.PNG" width="400" /></a></div>
<br />
If you're not up for trying to copy the code from the image you can <b><a href="https://github.com/winkleink/SenseCrane" target="_blank">download the Scratch code from GitHub</a>.</b><br />
<br />
To make it hand held I stuffed all the bits in to a plastic Chinese takeaway box. You can see the L9110s on the left, wifi dongle on a short microUSD to USB cable and the SenseHat with the Stackable Headers so the wires for the motor controller can could be added.<br />
<br />
Finally, here is a boy totally engrossed in playing with the crane at the Wimbledon Jam. It all ended really well.<br />
<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/AVvXsEj7ZbsNrXJsaBf-4VDXYUkQWSTvWpRHR9Oto_RkwTau69P0QvSynQaVGV787NsOGMN1iThmiDaFINDaWauMbaHZUg3y46MRJTMRTPsXYWTI7W5QUTzCWJpaoKxdCYVc-zZrx9j9z_JTbmqF/s1600/kid_playing.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7ZbsNrXJsaBf-4VDXYUkQWSTvWpRHR9Oto_RkwTau69P0QvSynQaVGV787NsOGMN1iThmiDaFINDaWauMbaHZUg3y46MRJTMRTPsXYWTI7W5QUTzCWJpaoKxdCYVc-zZrx9j9z_JTbmqF/s400/kid_playing.JPG" width="300" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Hours of fun transporting monkey from one place to another</td></tr>
</tbody></table>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />Winkleinkhttp://www.blogger.com/profile/10921617680353539604noreply@blogger.com0tag:blogger.com,1999:blog-2902197163807965393.post-51216612880339531152016-07-18T17:32:00.000+01:002016-07-18T17:33:23.098+01:00Minecraft Pi backup Worlds on exitMy kids love building cities on the Raspberry Pi version of Minecraft. They're not programming them yet, but they spend hours placing blocks and designing houses, hotels, swimming pools, and other building and gardens.<br />
All of which is great.<br />
Except I also use the Raspberry Pi for programming and other things where due to my fumbling around I end up borking the SD card and have to start again.<br />
<br />
That's OK. If you backup all the files in ~/.minecraft/games/com.mojang/ and then put them on the new SD card all is good. Really simple backup.<br />
Only problem is I keep forgetting this step and delete weeks or months or effort.<br />
<br />
Rather than expecting somehow that I will remember in the future I thought it would be a good idea to solve the problem with a bit of code and a little modification to the menu.<br />
<br />
The goal is to replace the command that runs minecraft-pi with a command that runs minecraft-pi and then on exit archives the worlds and sends them to an ftp server.<br />
In this way the backup is off the Pi and even if I do reformat it I can get the backup minecraft worlds and just reinstate them. <br />
<br />
All this is being done with Raspbian as the OS.<br />
<br />
For the ftp server I have OSMC set up on a Raspberry Pi (1) B+ that I use mainly as a media server for a couple of Blu-Ray player and tablets in the house so it is on 24x7.<br />
<br />
The code is quite short made up of a python script that does the archiving and ftping of the file and a bash script that runs minecraft-pi and then runs the backup script.<br />
The code is available at <b><a href="https://github.com/winkleink/MinecraftPi_backup">https://github.com/winkleink/MinecraftPi_backup</a></b><br />
<br />
Just copy it into pi user home folder '<b>/home/pi</b>'<br />
If you copy the code somewhere else then you will need to modify the bash script and the files to take it in to account.<br />
Once copied change the file preferences to permit execution. Since you're in the GUI the easiest way to do this is right click on the file and select [Properties].<br />
The go to Permissions and set Execute. I chose Anyone, but if you're only going to run as user pi then you can select 'Only owner'<br />
<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/AVvXsEhSbDzdblYNGLWiGYlcHgfwqDa96UqoK6KBf-5wXMJPaAnuAsZGL-boIs8DGITfTUmyJ1JJVl-SIRAzXZjqlO2AJPMMnW6vKkk037jhZRT1lHXxL7PIfih_KvNZsKpElKIKj0vwPBeJXC0j/s1600/permission.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSbDzdblYNGLWiGYlcHgfwqDa96UqoK6KBf-5wXMJPaAnuAsZGL-boIs8DGITfTUmyJ1JJVl-SIRAzXZjqlO2AJPMMnW6vKkk037jhZRT1lHXxL7PIfih_KvNZsKpElKIKj0vwPBeJXC0j/s400/permission.png" width="382" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Change Execute permissions so this is a program that can be run</td></tr>
</tbody></table>
<br />
You need to do this for the 2 files (minec.sh and ftpzipminecraft.py)<br />
<br />
minec.sh is the bash script to run the 2 commands. With the semicolon at the end of the first command it knows to run them in sequence (one after each other) rather than potentially at the same time. No modification is needed unless you save the ftpzipminecraft.py program somewhere other than the pi home folder<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;"><b>minec.sh</b></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><b><br /></b></span>
<span style="font-family: "courier new" , "courier" , monospace;">#!/bin/bash</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">minecraft-pi; </span><br />
<span style="font-family: "courier new" , "courier" , monospace;">/home/pi/ftpzipminecraft.py</span><br />
<b><br /></b>
<span style="font-family: inherit;">ftpzipminecraft.py runs after minecraft-pi closes and this does the archiving to local file in the pi home folder and then connects to the ftp server and transfers the archive to the server.</span><br />
<span style="font-family: inherit;">You have to change 3 items in the file for it to work. I've highlighted them in red below.</span><br />
<span style="font-family: inherit;"><br /></span>
FTP SERVER NAME/IP ADDRESS<br />
USERNAME<br />
PASSWORD<br />
<b><br /></b>
<span style="font-family: "courier new" , "courier" , monospace;"><b>ftpzipminecraft.py</b></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><b><br /></b></span>
<span style="font-family: "courier new" , "courier" , monospace;">#!/usr/bin/python3</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"># Script to backup the MinecraftPi worlds and then upload them to an FTP server</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"># By Winkleink (July 2016)</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"># https://github.com/winkleink/MinecraftPi_backup</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"># MIT Licence</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"># This is a quick fix so use at your peril</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">import os</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">import zipfile</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;">import ftplib</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">now = datetime.datetime.now()</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">year= str(now.year)</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">month = str(now.month)</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">day = str(now.day)</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">hour = str(now.hour)</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">minute= str(now.minute)</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">uploadfile = "minecraft"+year+"-"+month+"-"+day+"-_-"+hour+"-"+minute+".tar.gz"</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">print(uploadfile)</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">os.system ("tar zcvf " + uploadfile + " /home/pi/.minecraft/games/com.mojang")</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;"># Enter your FTP Server Name or IP address, Username and Password in the following line</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">session = ftplib.FTP("<span style="color: #990000;"><b>FTP SERVER NAME/IP ADDRESS</b></span>","<span style="color: #990000;"><b>USERNAME</b></span>","<b><span style="color: #990000;">PASSWORD</span></b>")</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">file = open("/home/pi/"+uploadfile, "rb")</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">session.storbinary("STOR " + uploadfile, file)</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">file.close()</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">session.quit()</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">print("Done")</span><br />
<div>
<br /></div>
<br />
<br />
<br />
<br />
Once both files are in place and are set to executable we need to modify the menu entry for Minecraft so it runs our new script minec.sh<br />
<br />
From the main menu select [Preferences] [Main Menu Editor]<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-k_gAAhApd7g0SWxzfwi7nRm-lK3TLpse-eRbuMpjkpddjsDKWcqdsZtRcLSmrmca66yAwVcOkOfXpmI04WAmHlii_SP3FkmlG461KCI7KDgykoGKv74tGO52Z3H-mIbNM39307S1iN3Y/s1600/mainmenu.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-k_gAAhApd7g0SWxzfwi7nRm-lK3TLpse-eRbuMpjkpddjsDKWcqdsZtRcLSmrmca66yAwVcOkOfXpmI04WAmHlii_SP3FkmlG461KCI7KDgykoGKv74tGO52Z3H-mIbNM39307S1iN3Y/s400/mainmenu.png" width="373" /></a></div>
<br />
Then on the left select [Games] and pick [Minecraft] and then click [Properties] on the right.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiY4I-rZLYt7DzKBwSoymXu83TgNEWh3G48C4M13NOdH4JO_84jR9y9pJQqlXpMv-hcI8Fbk0LWIz0B9SRXSv2Bihcel_nvpCSJSW-1piFs0oie8oG2puij5lYrNLi9keCaEtbyGmKCeaPG/s1600/main_menu_editor.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="333" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiY4I-rZLYt7DzKBwSoymXu83TgNEWh3G48C4M13NOdH4JO_84jR9y9pJQqlXpMv-hcI8Fbk0LWIz0B9SRXSv2Bihcel_nvpCSJSW-1piFs0oie8oG2puij5lYrNLi9keCaEtbyGmKCeaPG/s400/main_menu_editor.png" width="400" /></a></div>
<br />
Finally, replace the 'minecraft-pi' command with '/home/pi/minec.sh'<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4RlhQRaVcWL2MRCUJCmYgmXoLyoV5inKPrdxcMvgIA9ql8neSC-hH7tyIqAk9K2B34S5I02edkjLlPyLjGCtMj19EqXPHjySsWycNKd7vzTbYlB4s1AN4RjKqDAjX9dkVo9SeVpiwOx5s/s1600/modify_minecraft_script.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="326" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4RlhQRaVcWL2MRCUJCmYgmXoLyoV5inKPrdxcMvgIA9ql8neSC-hH7tyIqAk9K2B34S5I02edkjLlPyLjGCtMj19EqXPHjySsWycNKd7vzTbYlB4s1AN4RjKqDAjX9dkVo9SeVpiwOx5s/s400/modify_minecraft_script.png" width="400" /></a></div>
<br />
Its not shown here, but so I know it's the one I've changed I modified the Comment to 'Minecraft + Backup' so when I mouse over the menu entry I can see it the one with the backup.<br />
<br />
With this little change I will hopefully never lose my kids amazing creations in Minecraft on the Raspberry Pi.<br />
<br />
<br />Winkleinkhttp://www.blogger.com/profile/10921617680353539604noreply@blogger.com0tag:blogger.com,1999:blog-2902197163807965393.post-69551389590429387502016-06-22T09:47:00.002+01:002017-05-16T19:56:51.808+01:00Spider Chart maker using Python and Pygame<b>16th May 2017 </b>- Updated to make the output an A4 landscape page.<br />
Also, provided Inkscape created SVG file so you can prepare you can add your own School or Club name. Make sure the final PNG resolution for __spider.png is 3508 x 2481 as the dot locations are hand coded for the spider to be in the location it is on this size of image.<br />
<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/AVvXsEgTPla2a8EQfW8F09mXRhSX1eAIsSRXCs64jBMw30wUGZuxADvem9BEtE8twFryds-SuNfd1auLO7umIiKf5bjUcakpmk1NBrd_XvHwAWOxDDxLhWIpq4u_CGUK_6PNP-IZ1j0CE5n3O-0A/s1600/Bob+Murphy.jpeg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="282" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTPla2a8EQfW8F09mXRhSX1eAIsSRXCs64jBMw30wUGZuxADvem9BEtE8twFryds-SuNfd1auLO7umIiKf5bjUcakpmk1NBrd_XvHwAWOxDDxLhWIpq4u_CGUK_6PNP-IZ1j0CE5n3O-0A/s400/Bob+Murphy.jpeg" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Example of improved chart.</td></tr>
</tbody></table>
<br />
<br />
<br />
A few days ago a call went on out on Twitter for how to make lots of Spider Charts, also known as Radar charts in a programmatic way. I decided to take up the challenge.<br />
<br />
<blockquote class="twitter-tweet" data-lang="en">
<div dir="ltr" lang="en">
Twitter, help! Skill hexagon things...what are they called? How could I get a computer to make them based on data? <a href="https://t.co/WL4Bf7vvjy">https://t.co/WL4Bf7vvjy</a></div>
— Sway Grantham (@SwayGrantham) <a href="https://twitter.com/SwayGrantham/status/744486919707430912">June 19, 2016</a></blockquote>
<br />
The code and associated files are available to <a href="https://github.com/winkleink/spiderchart" target="_blank"><b>download from GitHub</b></a><br />
<br />
Below is a sample completed chart <br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9ugR99GQRSf8sJTjXhuxrm4AYbOaQNw7AswLkav0SYtGdd3DJb_qGZxTIkQeJMXKJfcopJ7hSFmVO0teajOGDWH8CP1UXT2rEKt9dcnAPmRtcNbtFbiArHf4-bkJm1pIqahw-l0jHMJMD/s1600/Bob+Murphy_600.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="258" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9ugR99GQRSf8sJTjXhuxrm4AYbOaQNw7AswLkav0SYtGdd3DJb_qGZxTIkQeJMXKJfcopJ7hSFmVO0teajOGDWH8CP1UXT2rEKt9dcnAPmRtcNbtFbiArHf4-bkJm1pIqahw-l0jHMJMD/s320/Bob+Murphy_600.jpeg" width="320" /></a></div>
<br />
To do this I started with a blank version of the chart and added the person name top left and the red dots and lines for the individual scores.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgy6-lJ5Bi3ZXAHMyTrNf2dYDEHryFnVagA5BpjPKKxtm5ppv9cFeJc9gXSQwLxl7dpkhxm1qNKTbcLT0rlwTIbWgQ2MHwt306_ALIu1l06UKlGSWbH-SXicaXDDDfhgpBeSSpT3d-v_fGw/s1600/spider600.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="258" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgy6-lJ5Bi3ZXAHMyTrNf2dYDEHryFnVagA5BpjPKKxtm5ppv9cFeJc9gXSQwLxl7dpkhxm1qNKTbcLT0rlwTIbWgQ2MHwt306_ALIu1l06UKlGSWbH-SXicaXDDDfhgpBeSSpT3d-v_fGw/s320/spider600.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The program is written using Python and Pygame and was developed on the Raspberry Pi.</div>
Since it doesn't use any other external libraries I'd expect it to work on other systems with Pygame installed. <br />
<br />
To achieve this 2 external CSV files and a large (3508 x 2481) blank chart image are used.<br />
<div>
<br /></div>
The image file is: <b>__spider.png</b><br />
<br />
<b>spider_data_points.csv</b> is a comma separated variable list of the co-ordinates on the 3508 x 2481 image for the individual points. By using a separate lookup if this was to be adapted to a different chart then you can just use a new master image and a different set of co-ordinates.<br />
<br />
<b>Student_Scores.csv</b> is the file with the individual student (in this case) names and scores for the different skills. There is no limit to the number of students that can have charts created as the code just goes through the csv line by line and creates a chart for each one.<br />
<br />
Rather than creating the csv files manually it is so much easier to use a spreadsheet for data entry and then [Save As] a .csv<br />
To facilitate this I've include .xlsx versions of the files.<br />
These can be open and saved on the Raspberry Pi using OpenOffice.<br />
<br />
Meaning if you needed to make 100 of these charts it would be a simple matter of:<br />
Place all the code in a single directory<br />
Enter the data in the spreadsheet. <br />
Save as a .csv<br />
execute spiderchart.py<br />
Watch as all the charts are created automatically with the student name as the filename<br />
<br />
Don't worry if the image is mainly off screen it is still being done correctly.<br />
<br />
In the code there is a 1 second sleep after each chart is created. If you are doing lots then it might be worth commenting out the sleep. It's useful for seeing what's going on.<br />
<br />
As a complete side note: I was one of the backers of the <a href="https://www.google.co.uk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwjf_Muim7vNAhWKmh4KHfBkDc8QFgggMAA&url=https%3A%2F%2Fwww.indiegogo.com%2Fprojects%2Fpi-topceed-the-first-99-raspberry-pi-desktop&usg=AFQjCNFFbpbhoctUcgGpLTWuAoBgjvy16Q&sig2=CUJ1D2JPpsorAw95WNkeEQ" style="font-weight: bold;" target="_blank">Indiegogo pi-topCEED</a><a href="https://www.google.co.uk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwjf_Muim7vNAhWKmh4KHfBkDc8QFgggMAA&url=https%3A%2F%2Fwww.indiegogo.com%2Fprojects%2Fpi-topceed-the-first-99-raspberry-pi-desktop&usg=AFQjCNFFbpbhoctUcgGpLTWuAoBgjvy16Q&sig2=CUJ1D2JPpsorAw95WNkeEQ" target="_blank"> </a>an All-in-One form factor for a Raspberry Pi desktop and it was delivered and set up on Monday. It came with a Raspberry Pi 3. This was the set up I used to develop and run the code. I was very impressed by the quality of the 14" screen on the CEED. This is now set up as the permanent home computer that my kids can use for playing Minecraft and exploring the CEEDuniverse, a game that teaches you about computers, coding and electronics. <br />
<br />
<script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"></script>
Winkleinkhttp://www.blogger.com/profile/10921617680353539604noreply@blogger.com0tag:blogger.com,1999:blog-2902197163807965393.post-16931488467878381262016-05-03T22:45:00.001+01:002016-05-03T23:40:30.501+01:00Minecraft on Raspberry Pi Zero using OTG USB Ethernet connection with RealVNC server and client<br />
In my previous post I connected to a Raspberry Pi 3 using RealVNC to connected over Ethernet.<br />
To achieve this you would need:<br />
Laptop<br />
Raspberry Pi<br />
PSU for Pi<br />
Ethernet cable<br />
<br />
What if you could replace the PSU and Ethernet with just a microUSB cable and replace the Pi3 by a PiZero.<br />
Well, this is absolutely possible and quite simple due to the hard work of a number of people including <a href="https://twitter.com/gbaman1" target="_blank"><b>Andrew Mulholland</b></a> who created a guide on setting up Ethernet over USB using OTG that I hope to make even more simple here. Then it's a matter of installing RealVNC to get the Raspbian desktop on your laptop.<br />
<br />
OTG stands for On-The-Go or it's full name <b><a href="https://en.wikipedia.org/wiki/USB_On-The-Go" target="_blank">USB On-The-Go</a></b><br />
Put simply OTG allows a USB device to act like a host and have peripherals such as keyboard and external storage attached to the device or act like a slave so it can be a network device or a mass storage device.<br />
This is most used on phones an tablets where it's great to be able to plug in a USB stick and access the files (host) or plug the phone into your computer and download the files (slave)<br />
<br />
For OTG is enabled by the ID-pin which is available on the PiZero as the USB port is directly connected to SOC and it uses a microUSB connector which has the extra pin for the ID.<br />
<br />
Back in December <b><a href="https://gist.github.com/gbaman/50b6cca61dd1c3f88f41" target="_blank">Andrew posted a guide</a></b> on setting up OTG.<br />
It includes a lot extra information that is worth reading and understanding, but here I want to just do the facts and steps needed to enable Ethernet over USB.<br />
<br />
I'm assuming you have already <b><a href="https://www.raspberrypi.org/downloads/" target="_blank">installed Raspbian on your PiZero</a> </b><br />
<br />
Next you need your PiZero to be connected to the network to be able to download and install some files. For this I used an Wii USB Ethernet adapter. This adapter is supported by default. They're about £10 on eBay. Just search Wii USB Ethernet.<br />
<br />
With the PiZero connected to the network I found the Pis IP address using <b><a href="http://lifehacker.com/fing-shows-you-all-the-devices-connected-to-your-networ-1655438240" target="_blank">Fing </a></b>on my phone.<br />
With the IP address known I used <b><a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/" target="_blank">putty </a></b>to ssh in. (Yes, this is the correct link for downloading)<br />
<br />
Once logged in do the usual housekeeping.<br />
<span style="font-family: "courier new" , "courier" , monospace;">sudo raspi-config to expand the filesystem and set GPU memory to 128MB</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">sudo apt-get update</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">sudo apt-get upgrade</span><br />
<br />
Then it's a matter of running the following commands one after another to get Ethernet over USB set up. Andrew's guide explains what they do and also the other OTG options available.<br />
<br />
<br />
<span style="background-color: rgba(0 , 0 , 0 , 0.0392157); color: #333333; line-height: 21.76px;"><span style="font-family: "courier new" , "courier" , monospace;"><b>sudo BRANCH=next rpi-update</b></span></span><br />
<span style="background-color: rgba(0 , 0 , 0 , 0.0392157); color: #333333; line-height: 21.76px;"><span style="font-family: "courier new" , "courier" , monospace;"><b><br /></b></span></span>
<span style="background-color: rgba(0 , 0 , 0 , 0.0392157); color: #333333; line-height: 21.76px;"><span style="font-family: "courier new" , "courier" , monospace;"><b>echo "dtoverlay=dwc2" | sudo tee -a /boot/config.txt</b></span></span><br />
<span style="background-color: rgba(0 , 0 , 0 , 0.0392157); color: #333333; line-height: 21.76px;"><span style="font-family: "courier new" , "courier" , monospace;"><b><br /></b></span></span>
<span style="background-color: rgba(0 , 0 , 0 , 0.0392157); color: #333333; line-height: 21.76px;"><span style="font-family: "courier new" , "courier" , monospace;"><b>echo "dwc2" | sudo tee -a /etc/modules</b></span></span><br />
<span style="background-color: rgba(0 , 0 , 0 , 0.0392157); color: #333333; line-height: 21.76px;"><span style="font-family: "courier new" , "courier" , monospace;"><b><br /></b></span></span>
<span style="background-color: rgba(0 , 0 , 0 , 0.0392157); color: #333333; line-height: 21.76px;"><span style="font-family: "courier new" , "courier" , monospace;"><b>echo "g_ether" | sudo tee -a /etc/modules</b></span></span><br />
<span style="background-color: rgba(0 , 0 , 0 , 0.0392157); color: #333333; line-height: 21.76px;"><span style="font-family: "courier new" , "courier" , monospace;"><b><br /></b></span></span>
<span style="background-color: rgba(0 , 0 , 0 , 0.0392157); color: #333333; line-height: 21.76px;"><span style="font-family: "courier new" , "courier" , monospace;"><b>echo -e "interface usb0 \nstatic ip_address=169.254.64.64" | sudo tee -a /etc/dhcpcd.conf</b></span></span><br />
<br />
Now Ethernet over USB should be set up.<br />
<br />
Next RealVNC server needs to be installed. The guide for installing the latest Alpha that supports Minecraft can be found here. <b><a href="https://github.com/RealVNC/raspi-preview">https://github.com/RealVNC/raspi-preview</a></b><br />
<br />
With the relevant commands being:<br />
<b><span style="font-family: "courier new" , "courier" , monospace;">curl -OL https://github.com/RealVNC/raspi-preview/releases/download/5.3.1.18206/VNC-Server-5.3.1-raspi-alpha1.deb</span></b><br />
<b><span style="font-family: "courier new" , "courier" , monospace;"><br /></span></b>
<b><span style="font-family: "courier new" , "courier" , monospace;">sudo dpkg -i VNC-Server-5.3.1-raspi-alpha1.deb</span></b><br />
<br />
<b><span style="font-family: "courier new" , "courier" , monospace;">sudo systemctl enable vncserver-x11-serviced.service</span></b><br />
<br />
These install RealVNC server and enable it as a service that starts at boot up.<br />
<br />
Shutdown your PiZero using<br />
<span style="font-family: "courier new" , "courier" , monospace;"><b>sudo shutdown 0</b></span><br />
<br />
Unplug the cabled.<br />
Plug single microUSB cable into the USB port on the PiZero and the other end into your laptop USB port. The PiZero uses so little power it can safely be powered from the laptop USB with no issues.<br />
Mine laptop is running Windows 10 and the device is automatically detected and the drivers installed. I didn't have to do anything.<br />
This creates a new Ethernet device.<br />
<br />
Download and install <b><a href="https://www.realvnc.com/download/viewer/" target="_blank">RealVNC Viewer </a></b><br />
<br />
Run RealVNC Viewer on your laptop and enter the fixed IP address of <b style="background-color: rgba(0, 0, 0, 0.0392157); color: #333333; font-family: 'Courier New', Courier, monospace; line-height: 21.76px;">169.254.64.64 </b>used when setting up the PiZero.<br />
It will ask for your login. On mine it defaults to the laptop username. so, just change to pi/raspberry assuming you haven't changed it.<br />
<br />
RealVNC should now login to the PiZero.<br />
It's that simple.<br />
<br />
RealVNC recommend some optimisation that I definitely found to improve performance.<br />
<br />
On the VNC Viewer toolbar (top of the Window), click the <b>Options </b>button.<br />
Click <b>Advanced</b>..., then the <b>Expert </b>tab.<br />
Set <b>PreferredEncoding </b>to JPEG, <b>AutoSelect </b>to False, and <b>ColorLevel </b>to Full<br />
<br />
These changes really make RealVNC smoother.<br />
<br />
If using Minecraft you have to make one more selection.<br />
Press [F8] to go back to the menu and select <b>Relative Pointer Motion</b><br />
Then start Minecraft as normal.<br />
All should work perfectly.<br />
<br />
You will notice that the RealVNC window is quite small this is because there is no resolution details set by a display so the Raspberry Pi defaults to 640x480 as the safest mode.<br />
<br />
To increase the resolution you have to make some minor changes to config.txt<br />
RealVNC give <b><a href="https://support.realvnc.com/knowledgebase/article/View/523" target="_blank">full details on this on the following support page</a></b><br />
<br />
But to put it simply to set the resolution to 800x600 do the following<br />
<br />
Open a terminal window<br />
cd /boot<br />
sudo cp config.txt config.txt.backup<br />
sudo nano config.txt<br />
<br />
This makes a backup of config.txt and then opens it with nano<br />
<br />
Remove the # in front of <span style="font-family: "courier new" , "courier" , monospace; font-weight: bold;">hdmi_force_hotplug </span><span style="font-family: inherit;">and set it to 1</span><br />
<b><span style="font-family: "courier new" , "courier" , monospace;">hdmi_force_hotplug=1</span></b><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">Enter the following line into config.txt</span><br />
<span style="font-family: inherit;"></span><br />
<b><span style="font-family: "courier new" , "courier" , monospace;">hdmi_ignore_edid=0xa5000080</span></b><br />
<b><span style="font-family: "courier new" , "courier" , monospace;"><br /></span></b>
<br />
<div>
No idea what it does and even RealVNC describe it as better safe than sorry. I've run without it and it worked.</div>
<div>
<br /></div>
<div>
Remove the # in front of <span style="font-family: "courier new" , "courier" , monospace;"><b>hdmi_group </b></span>and set it to 2.</div>
<div>
<b><span style="font-family: "courier new" , "courier" , monospace;">hdmi_group=2</span></b></div>
<div>
<b><span style="font-family: "courier new" , "courier" , monospace;"><br /></span></b></div>
<div>
<span style="font-family: inherit;">Remove the # in front of </span><span style="font-family: "courier new" , "courier" , monospace; font-weight: bold;">hdmi_mode</span><span style="font-family: inherit;"> and set it to 9 which is the value for 800x600.</span></div>
<div>
<span style="font-family: inherit;">You can look up all the values and adjust according to your needs on the <b><a href="http://elinux.org/RPiconfig" target="_blank">elinux.org page</a></b>. </span></div>
<div>
<span style="font-family: inherit;"><br /></span></div>
<div>
<span style="font-family: inherit;">Press [CTRL]-[x] to exit.<br />Select y for saving changes and then press [Enter]</span></div>
<div>
<span style="font-family: inherit;"><br /></span></div>
<div>
<span style="font-family: inherit;">Now your config.txt is up to date.</span></div>
<div>
<span style="font-family: inherit;"><br /></span></div>
<div>
<span style="font-family: inherit;">Restart the Raspberry Pi and it will restart with a resolution of 800x600 rather than 640x480 making everything a little easier.</span></div>
<div>
<span style="font-family: inherit;">If you want a higher resolution then </span><span style="background-color: #f9f9f9; line-height: 1.3em;"><b><span style="font-family: "courier new" , "courier" , monospace;">hdmi_mode=16</span></b><span style="font-family: inherit;"> is 1024x768 and </span></span><span style="background-color: #f9f9f9; line-height: 1.3em;"><span style="font-family: "courier new" , "courier" , monospace;"><b>hdmi_mode=39</b></span></span><span style="background-color: #f9f9f9; font-family: inherit; line-height: 1.3em;"> is 1360x768</span></div>
<div>
<span style="background-color: #f9f9f9; font-family: inherit; line-height: 1.3em;"><br /></span></div>
<div>
<span style="background-color: #f9f9f9; line-height: 20.8px;">Finally, here is a (low quality recorded from my phone) video of it all running. You can see the speed is good and even programming in Python works well.</span></div>
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/5fGXiUN6_-Y/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/5fGXiUN6_-Y?feature=player_embedded" width="320"></iframe></div>
<div>
<span style="background-color: #f9f9f9; line-height: 20.8px;"><br /></span></div>
<div>
<br /></div>
Winkleinkhttp://www.blogger.com/profile/10921617680353539604noreply@blogger.com0tag:blogger.com,1999:blog-2902197163807965393.post-27150339536349662072016-05-01T19:47:00.003+01:002018-04-30T10:33:52.379+01:00Using only Ethernet cable to connect Windows computer to Raspberry PiThe Raspberry Pi is designed to be used as a standalone computer only needing a monitor, keyboard and mouse to function.<br />
<br />
There are many guides on how to SSH or VNC into the Raspberry Pi with the network set up usually using a router.<br />
<br />
Well, what if you don't have a router because you're at an event or you don't want to put your Pi on the network. It's fun at a Raspberry Jam to see all the Raspberry Pi's with the same name and the same username and password on a network.<br />
<br />
For this situation there is a really simple solution. You give the computer's Ethernet port a fixed IP and you do the same on the Pi.<br />
The great thing with this is the computer and the Pi can still connect to the available network over wifi and if available connect to the internet. <br />
<br />
<br />
I use this configuration a lot for simple python development where a full GUI isn't needed and since my ability to remember things is limited access to the internet from my laptop is essential for tips and trouble shooting.<br />
<br />
<br />
For this to work the IP addresses you give the Ethernet ports cannot be on the same subnet as the router (if there is one)<br />
To check this on Windows do an <span style="font-family: "courier new" , "courier" , monospace;"><b>ipconfig</b></span> <br />
<br />
You'll get something like below which shows the Wireless has an IP address of 192.168.0.11 with a subnet mask of 255.255.255.0 and a gateway of 19.168.0.1<br />
<br />
The subnet mask says what range is usable. <br />
In this case 192.168.0.1 - 192.168.0.255 are all in the subnet so are part of this routers control. <br />
You can limit the IP controlled by the router, but for this it's safer to assume ALL IP addresses from 1-255 are out of bounds. There are more than enough other IP addresses to use safely<br />
<br />
<span style="background-color: #cccccc; font-family: "courier new" , "courier" , monospace;">Windows IP Configuration</span><br />
<span style="background-color: #cccccc; font-family: "courier new" , "courier" , monospace;"><br />Ethernet adapter Ethernet:</span><br />
<span style="background-color: #cccccc; font-family: "courier new" , "courier" , monospace;"> Media State . . . . . . . . . . . : Media disconnected<br /> Connection-specific DNS Suffix . :</span><br />
<span style="background-color: #cccccc; font-family: "courier new" , "courier" , monospace;">Wireless LAN adapter Local Area Connection* 3:</span><br />
<span style="background-color: #cccccc; font-family: "courier new" , "courier" , monospace;"> Media State . . . . . . . . . . . : Media disconnected<br /> Connection-specific DNS Suffix . :</span><br />
<span style="background-color: #cccccc; font-family: "courier new" , "courier" , monospace;">Wireless LAN adapter Local Area Connection* 5:</span><br />
<span style="background-color: #cccccc; font-family: "courier new" , "courier" , monospace;"> Media State . . . . . . . . . . . : Media disconnected<br /> Connection-specific DNS Suffix . :</span><br />
<span style="background-color: #cccccc; font-family: "courier new" , "courier" , monospace;">Wireless LAN adapter Wi-Fi:</span><br />
<span style="background-color: #cccccc; font-family: "courier new" , "courier" , monospace;"> Connection-specific DNS Suffix . :<br /> Link-local IPv6 Address . . . . . : fe80::501b:b10b:e1c4:62ff%5<br /> IPv4 Address. . . . . . . . . . . : 192.168.0.11<br /> Subnet Mask . . . . . . . . . . . : 255.255.255.0<br /> Default Gateway . . . . . . . . . : 192.168.0.1</span><br />
<span style="background-color: #cccccc; font-family: "courier new" , "courier" , monospace;">Tunnel adapter isatap.{70D5B1BF-BEE1-475B-9752-73772D3EA37A}:</span><br />
<span style="background-color: #cccccc; font-family: "courier new" , "courier" , monospace;"> Media State . . . . . . . . . . . : Media disconnected<br /> Connection-specific DNS Suffix . :</span><br />
<span style="background-color: #cccccc; font-family: "courier new" , "courier" , monospace;">Tunnel adapter Teredo Tunneling Pseudo-Interface:</span><br />
<span style="background-color: #cccccc; font-family: "courier new" , "courier" , monospace;"> Connection-specific DNS Suffix . :<br /> IPv6 Address. . . . . . . . . . . : 2001:0:5ef5:79fb:2c33:3c3f:3f57:fff4<br /> Link-local IPv6 Address . . . . . : fe80::2c33:3c3f:3f57:fff4%2<br /> Default Gateway . . . . . . . . . : ::</span><br />
<br />
With this kind of set up I usually go for the range 10.0.0.X<br />
Setting the IP for the computer to 10.0.0.100 and then the Pi's use IP addresses from there up.<br />
<br />
<br />
<b>Setting IP address on Windows Computer</b><br />
<br />
Go to the Setting and select [Network and Internet]<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjdtKVNUs5Z_G2UQKq3MlvM5fZxPW3PnXNeeSTSSnWNXGWg9t65Gqm-XpzAQHlT4_mn4WfGR3mcSGHH-ELFSJb3NhVdeIR8EYGVu8e9Wq3wstZnFmFqTop5Pp7gdSQqYPz1dvUX4sUgdiC/s1600/settings.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="252" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjdtKVNUs5Z_G2UQKq3MlvM5fZxPW3PnXNeeSTSSnWNXGWg9t65Gqm-XpzAQHlT4_mn4WfGR3mcSGHH-ELFSJb3NhVdeIR8EYGVu8e9Wq3wstZnFmFqTop5Pp7gdSQqYPz1dvUX4sUgdiC/s320/settings.png" width="320" /></a></div>
<br />
Then select Ethernet and [Change adapter settings]<br />
<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/AVvXsEinq915rvpAoc_9EgydJZWKrg8BpPUDy20nReg77nUfRK-pGJ1P0vcYKjXlkpvhjHIFLdcTS-hg-BB_FMzTdbR8Vn3uInnIaOvS9kLR8NIxXO2v7TRs1Z8_-lbhn1h5Hkfl47iwyJ8mC0Ty/s1600/Ethernet.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="252" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinq915rvpAoc_9EgydJZWKrg8BpPUDy20nReg77nUfRK-pGJ1P0vcYKjXlkpvhjHIFLdcTS-hg-BB_FMzTdbR8Vn3uInnIaOvS9kLR8NIxXO2v7TRs1Z8_-lbhn1h5Hkfl47iwyJ8mC0Ty/s320/Ethernet.png" width="320" /></a></div>
<br />
<br />
<br />
<br />
<br />
<br />
Right Click on the Ethernet adapter and select [Properties]<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiOoZns6mKDecVOEImZ98wae0ABOtLyGdYNUOA4xMdb3pX2T6B00cEy0eRInsm3tZ7Tzv5fVfCPSvDoKw_TYCPQ5rm7j5R2C6GJAC3NGtlh8w9GcSOM3PQOzm8RKdQNp4XNpiqnMw1KQbE/s1600/Adapter.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="140" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiOoZns6mKDecVOEImZ98wae0ABOtLyGdYNUOA4xMdb3pX2T6B00cEy0eRInsm3tZ7Tzv5fVfCPSvDoKw_TYCPQ5rm7j5R2C6GJAC3NGtlh8w9GcSOM3PQOzm8RKdQNp4XNpiqnMw1KQbE/s320/Adapter.png" width="320" /></a></div>
<br />
<br />
<br />
If you're not logged in as Administrator rights then you'll be asked to enter your Administrator password.<br />
<br />
Once done select Internet Protocol Version 4 (TCP/IPv4) and click [Properties]<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlMLDMAz7eT8QXz6yiG26t_8ZiwH6eZmGlp4z3kekgvECE2zOH_FTAkAFAAtoxBD1eoUG1c59XIlLfFeHoW49FiCcm_apk1ft_K9ZP3_JPuGpPKRFUqqSmixMn1AaDfqeRoAu_a04awke1/s1600/IP.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlMLDMAz7eT8QXz6yiG26t_8ZiwH6eZmGlp4z3kekgvECE2zOH_FTAkAFAAtoxBD1eoUG1c59XIlLfFeHoW49FiCcm_apk1ft_K9ZP3_JPuGpPKRFUqqSmixMn1AaDfqeRoAu_a04awke1/s320/IP.png" width="248" /></a></div>
<br />
By default it's probably set to Obtain IP address automatically with the same for DNS<br />
<br />
Click [Use the following IP address:] and enter the IP address you wish to use on the computer. <br />
As I mentioned I set mine to 10.0.0.100<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEOIUopq3g5NtKwIbLjN0b1-hFSPcKtREjIuajx3fhnzGW9D6uM0fyW06REPxPl_rg_f0ZpfOC6-8DAC6W8h-IkbBErD6iIjm3JsAL14Rx-7sVy87UzFRwkU7ByGf8p78umIP5A8oVuM-H/s1600/10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEOIUopq3g5NtKwIbLjN0b1-hFSPcKtREjIuajx3fhnzGW9D6uM0fyW06REPxPl_rg_f0ZpfOC6-8DAC6W8h-IkbBErD6iIjm3JsAL14Rx-7sVy87UzFRwkU7ByGf8p78umIP5A8oVuM-H/s320/10.png" width="281" /></a></div>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEOIUopq3g5NtKwIbLjN0b1-hFSPcKtREjIuajx3fhnzGW9D6uM0fyW06REPxPl_rg_f0ZpfOC6-8DAC6W8h-IkbBErD6iIjm3JsAL14Rx-7sVy87UzFRwkU7ByGf8p78umIP5A8oVuM-H/s1600/10.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"></a><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEOIUopq3g5NtKwIbLjN0b1-hFSPcKtREjIuajx3fhnzGW9D6uM0fyW06REPxPl_rg_f0ZpfOC6-8DAC6W8h-IkbBErD6iIjm3JsAL14Rx-7sVy87UzFRwkU7ByGf8p78umIP5A8oVuM-H/s1600/10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"></a></div>
When you click OK it might say a subnet isn't set and set a default of 255.0.0.0. Just accept the subnet. It is used to keep IP addresses in organised groups so it doesn't matter what it is for our purposes as long as our 2 IP addresses are included, which they will be.<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEOIUopq3g5NtKwIbLjN0b1-hFSPcKtREjIuajx3fhnzGW9D6uM0fyW06REPxPl_rg_f0ZpfOC6-8DAC6W8h-IkbBErD6iIjm3JsAL14Rx-7sVy87UzFRwkU7ByGf8p78umIP5A8oVuM-H/s1600/10.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"></a><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQXMGW6-eoimGCTlQ_sRnfDC6DcOF8ZddT69gnoO9AbkQEoxkBbgrk5BiA-BeT-t8kdRbQV3AU1eKP755o-zLgbscFnMzAUoCCQwV0gSN-bJ4Oeggislwq_Rtw0XyfbQUQmoQg4Ky2I1e1/s1600/error.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="109" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQXMGW6-eoimGCTlQ_sRnfDC6DcOF8ZddT69gnoO9AbkQEoxkBbgrk5BiA-BeT-t8kdRbQV3AU1eKP755o-zLgbscFnMzAUoCCQwV0gSN-bJ4Oeggislwq_Rtw0XyfbQUQmoQg4Ky2I1e1/s320/error.png" width="320" /></a></div>
<br />
Then just click OK and close all the windows that have been opened. All is now set for the computer. <br />
<br />
For the Pi side you will either need a monitor, keyboard and mouse or to have a router to connect to the Ethernet or have WiFi setup as this method uses the GUI desktop tool. <br />
<br />
<br />
I'm using RealVNC as I've been playing with Minecraft over VNC<br />
Connect using RealVNC to your WiFi or provided IP address for your Ethernet port.<br />
<br />
Top right in the task bar right click on the network/wifi indicator and select [Wifi network (dhcpcdui) Settings]<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLE5npUJakyNV98E-oLRUEGMfNnWYusmHNB4u3QQXKxG9XvQnmlxnXjlgb8bAG8F6zXafIjlLiFdEvY_bY98bw2RZ6Tf2kuKP9cJCSt7guLlIFfqHNnDgHCJdgQbpMnI3uooTg7AtklXnP/s1600/vnc_select_network.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="120" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLE5npUJakyNV98E-oLRUEGMfNnWYusmHNB4u3QQXKxG9XvQnmlxnXjlgb8bAG8F6zXafIjlLiFdEvY_bY98bw2RZ6Tf2kuKP9cJCSt7guLlIFfqHNnDgHCJdgQbpMnI3uooTg7AtklXnP/s320/vnc_select_network.png" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
This will open the Network Setting tool<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-zbFU8fMemtPzmfRBRqSTvA1aUwZQ4lMcqgLIaNLfpqIhOyy32DF_pinYRtbg5b3EOu_9OpfBT_7mLnuKAjc6pvE4Uuv1RlW6RpvuHH_SQIZCs9jgy5pdV0OHMx_9M15M13d6AwwWUwri/s1600/vnc_networks.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-zbFU8fMemtPzmfRBRqSTvA1aUwZQ4lMcqgLIaNLfpqIhOyy32DF_pinYRtbg5b3EOu_9OpfBT_7mLnuKAjc6pvE4Uuv1RlW6RpvuHH_SQIZCs9jgy5pdV0OHMx_9M15M13d6AwwWUwri/s320/vnc_networks.png" width="308" /></a></div>
<br />
It opens with the Configure: Interface option but with nothing selected. In the blank drop down select eth0<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuENiEd9vEFJ1MYOywjItq7VG2wOgwe3H3ksGyctZ-U2yUFDSF0klFlJeqHQ4sMb3uTvUMfbI7FYMOxM0xfCpiivE2Gsret8r0dDD3jaEdhcpyBr2dDo8xENn3ysOZQwmZ8qEOgwgMD1e_/s1600/vnc_eth0.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuENiEd9vEFJ1MYOywjItq7VG2wOgwe3H3ksGyctZ-U2yUFDSF0klFlJeqHQ4sMb3uTvUMfbI7FYMOxM0xfCpiivE2Gsret8r0dDD3jaEdhcpyBr2dDo8xENn3ysOZQwmZ8qEOgwgMD1e_/s320/vnc_eth0.png" width="301" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
Automatically configure empty options should be ticked with all fields empty.<br />
Now type the IP address you want to use in the IP Address: box. For this one I used 10.0.0.102<br />
<br />
Then [Apply] and [Close]<br />
<br />
At this point I usually restart the Raspberry Pi and connect the Ethernet port directly to the laptop.<br />
Of course my VNC session will disconnect. So I will have to connect again.<br />
<br />
Now if I run ipconfig on the laptop I get the following where the Ethernet IP is 10.0.0.100 (result)<br />
<br />
<span style="background-color: #cccccc; font-family: "courier new" , "courier" , monospace;">Ethernet adapter Ethernet:</span><br />
<span style="background-color: #cccccc; font-family: "courier new" , "courier" , monospace;"> Connection-specific DNS Suffix . :<br /> Link-local IPv6 Address . . . . . : fe80::b0ac:5dbe:415b:e7e3%11<br /> IPv4 Address. . . . . . . . . . . : 10.0.0.100<br /> Subnet Mask . . . . . . . . . . . : 255.0.0.0<br /> Default Gateway . . . . . . . . . :</span><br />
<span style="background-color: #cccccc; font-family: "courier new" , "courier" , monospace;">Wireless LAN adapter Wi-Fi:</span><br />
<span style="background-color: #cccccc; font-family: "courier new" , "courier" , monospace;"> Connection-specific DNS Suffix . :<br /> Link-local IPv6 Address . . . . . : fe80::501b:b10b:e1c4:62ff%5<br /> IPv4 Address. . . . . . . . . . . : 192.168.0.11<br /> Subnet Mask . . . . . . . . . . . : 255.255.255.0<br /> Default Gateway . . . . . . . . . : 192.168.0.1</span><br />
<br />
Reconnect RealVNC with 10.0.0.102 as the Raspberry Pi IP address and everything should work.<br />
Now no need for a router, or a WiFi. But if you have WiFi then the computer and Pi can still connect to the Internet using WiFi while maintaining their direct connection to each other over the Ethernet so wget and other updates can still be done.<br />
<br />
The great thing with this is also that since each Pis Ethernet connection will be on a different network if you have 10 laptops with 10 Pis you can do this setup on one Pi and then dd the microSDs on to the others and they will all work with no conflict.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEji9XJn-qNP7515n9MEbOiTNUUpVvNxtre1xxuwyLg-OXjw6ut_gQI_S-fxRAfK_tlQyhFS56TAlTxvNI4VKLsdmCTZXfPX9qfmD8zxvWNdOSsJtPqFPzGhlhow0AnPGrC_WZNwvvViqzKA/s1600/vnc_windows10_minecraft.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="179" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEji9XJn-qNP7515n9MEbOiTNUUpVvNxtre1xxuwyLg-OXjw6ut_gQI_S-fxRAfK_tlQyhFS56TAlTxvNI4VKLsdmCTZXfPX9qfmD8zxvWNdOSsJtPqFPzGhlhow0AnPGrC_WZNwvvViqzKA/s320/vnc_windows10_minecraft.png" width="320" /></a></div>
<br />
<br />
<br />Winkleinkhttp://www.blogger.com/profile/10921617680353539604noreply@blogger.com0tag:blogger.com,1999:blog-2902197163807965393.post-54866751317002379712016-05-01T11:31:00.000+01:002016-05-01T11:31:47.767+01:00Minecraft running over RealVNC from Raspberry Pi 3Back at the PiParty in March RealVNC showed Minecraft running over VNC. This doesn't seem like much of an achievement until you realise that Minecraft doesn't use X. It writes directly to the framebuffer, so for normal VNC Minecraft just comes up as black window.<br />
<br />
I posted a short video from the party. They had multiple sessions running on the one display.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe width="320" height="266" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/kSEnkYh-4vM/0.jpg" src="https://www.youtube.com/embed/kSEnkYh-4vM?feature=player_embedded" frameborder="0" allowfullscreen></iframe></div>
<br />
<br />
Last wee RealVNC released the public Alpha of the new RealVNC server that enable Minecraft to run over VNC.<br />
<br />
<a href="https://github.com/RealVNC/raspi-preview">https://github.com/RealVNC/raspi-preview</a><br />
<br />
I got a chance to install it today on a Pi3 and connect froma fairly low power laptop that cost £110.<br />
Acer ES1-131 Celeron N3050 1.6GHz with 2GB RAM running Windows 10.<br />
<br />
Firt run it went well, a little bit laggy (not sure if that's a real word). I assumed it was because running over wifi.<br />
Then I read the raspi-preview page again and noted there are a few optimisations available.<br />
<br />
With the optimisation completed it ran really well. Below is a short (sliglty out of focus) video of it running.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe width="320" height="266" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/ffrLxpldkqY/0.jpg" src="https://www.youtube.com/embed/ffrLxpldkqY?feature=player_embedded" frameborder="0" allowfullscreen></iframe></div>
<br />
<br />
Now I'm looking forward to seeing the finals release of RealVNC. Winkleinkhttp://www.blogger.com/profile/10921617680353539604noreply@blogger.com0