Check out my new review:
Available January 2017.
Check out my new review:
Available January 2017.
Once again, time has gone on and I’ve not added much for a while to the site. However I’ve been playing around with a few things which have been lots of fun.
So I’ll keep adding to this post a little at a time and take you through a few of the interesting things I’ve got my hands on… No spoilers..yet..but a few really excellent things (at least I think so).
As usual I’ve written myself some notes on getting this setup, and I fully intend to share (once I get time to write it properly). However some very quick lessons learnt…
Lesson 1: Micro Python is very nice, and you can use a Python-like terminal with the device by connecting through the serial. Very swish…but frankly no cigar yet.
Lesson 2: Micro Python with a Wifi device like the ESP8266 on the NodeMCU board is great…but remember the ESP8266 Wifi settings are separate to the firmware, so you may need to ensure it is set to station mode first, before the micropython firmware will reset it.
Lesson 3: When you get webREPL running…we are getting better – developing over Wifi yes please! If it isn’t running once you’ve programmed the firmware (which it wasn’t on mine) you’ll never be able to connect using the webREPL console page (which is a html page – you can download a local copy or visit http://micropython.org/webrepl/). Don’t get annoyed it doesn’t work until you’ve started it!
Lesson 4: Use the serial python console to start webREPL on the device as follows:
>> import webrepl >>> webrepl.start() WebREPL daemon started on ws://192.168.4.1:8266 Started webrepl in setup mode >>>
Lesson 5: You must connect to the device via Wifi to use the web console! Connect to the device via the AP it provides “MicroPython-ffffff” with default password “micropythoN).
First time you connect via the console (using the address shown when it starts) you’ll set a new password. Then reset the board and reload webrepl as before.
Lesson 6: Unless you want to always manually start webrepl use the boot.py file and upload it. This will run on power up!
import webrepl webrepl.start()
Lesson 7: Micro Python is a little annoying…it supports files so you can upload .py files and import them…BUT there is no editing via the webREPL console. So edit and upload? No not quite!
Lesson 8: Uploading new files and “import mymodule” isn’t enough to update your code! Import will not reload a module if it is already loaded…deleting a module (using “del mymodule”) will remove it but it is still cached so it will still not update. WHAT A PAIN!
Lesson 9: After a few experiments (and a hint from @mnelsoneorm1 to checkout https://forum.micropython.org) managed to work out a way to do it. Sometime later, I wrapped up all the useful bits into a util.py file, which I loaded at startup as well.
import webrepl import util webrepl.start()
def readfile(file="boot.py"): with open(file,'r') as thefile: data = thefile.read() print(data) def delfile(file): import os os.remove(file) def reload(module): import sys del sys.modules[module]
Lesson 10: The upload might not upload a new version of your file…You may need to upload a different file first to ensure the newer one is reloaded into the browser.
Final lesson is NeoPixels are simply awesome (and deceptively easy)!
import machine,neopixel v=0.5 print(v) NUM=24 np=neopixel.NeoPixel(machine.Pin(4),NUM) OFF=off=(0,0,0) R=r=(255,0,0) G=g=(0,255,0) B=b=(0,0,255) Y=y=(255,255,0) C=c=(0,255,255) def clear(): all(OFF) def all(val): for i in range(NUM): np[i]=val np.write() def pattern(val1,val2,val3,val4): for i in range(NUM/4): np[(i*4)]=val1 np[(i*4)+1]=val2 np[(i*4)+2]=val3 np[(i*4)+3]=val4 np.write() def demo(): import time for i in range(10): pattern(R,R,G,B) time.sleep(0.1) pattern(B,R,R,G) time.sleep(0.1) pattern(G,B,R,R) time.sleep(0.1) pattern(R,G,B,R) time.sleep(0.1) np=(255,0,0) np=(0,128,0) np=(0,0,64) np.write()
I thought it was time I took at GPIOZero by Ben Nuttall. You can see my write up on my Guide to…Embracing GPIOZero.
This also includes a solution for using GPIO.BOARD (physical pin numbering) with the GPIOZero library. The best part is that you can keep using GPIO.BCM (BCM numbering) by default and just enable GPIO.BOARD when required. WIN-WIN-WIN!
I’ve also been playing around with my PiZero. Which still makes an excellent USB-LAN Device. You can see the whole Pi-Kitchen process in my Using Pi-Kitchen to “bake” a Raspberry Pi Zero as a USB LAN Device video.
Also, I’ve added some details of the Pi-Stop python module which I use in my workshops.
This allows easy plug and play without the wires and hassles with pin numbers. Just select one of the standard locations A, B, C and D (plus A+ and B+ for Model +/ RPi 2) and away you go!
I also got a nice little HDMI screen which although only being 5″ provides 800×480 resolution and a resistive touch screen. The config will get added to the Pi-Kitchen in the next update (proto-type recipe is working well).
The screen is from Bandgood.com and was about £20 (GBP) and runs well via a standard USB power pack (surprisingly low power and includes a switch to turn off the back-light too).
It is perfect for my Pi-Kitchen testing since unlike SPI/I2C/DSI interfaces, it works well enough without extra configuration. The additional configuration makes the display fill the screen and enable the touch screen.
This makes a Model A with keyboard a handy lightweight “kit-to-go” set-up.
That is all for now! Enjoy.
What a year it was for 2015. Taking a look my blog I’ve not posted for quite some time, but I have been very busy with a lot of other stuff.
Here’s a quick overview of the latest things on the plate for today…
First off we have a review of Learn to Program with Minecraft by Craig Richardson. I had a go with it yesterday and introduced some Python programming to our family Minecraft actives.
Minecraft on the Raspberry Pi – a small keyboard and mouse is ideal for smaller hands!
I’ve managed to package the required modifications to make a Pi Zero (and Model A/A+ Raspberry Pi) into recipes for the Pi-Kitchen.
For more details see the Git-Hub:
To get started use:
See the following video to see the whole Pi-Kitchen process in action and some of the features that can be pre-configured ready for power up.
Some other things I’ve been playing with…but not had time to post about…
Just a quick post (after a long but very fun day)…
Firstly many thanks for all those who attended the Pi-Stop workshop, a super-bright bunch you all were! Hope you all had as good a time as I did, I shall return will some more challenges next time.
The workshop materials are available on git-hub, along with other guides and information.
For those who had a browse of my books most should be available on Amazon – or for the No-Starch-Press books from their website)
Good news, my book (and others) is currently 25% off at Packt Publishing (using code PRINT25 at checkout, valid until 6th March 2015).
So you were lucky enough to receive a Raspberry Pi for Christmas or perhaps you’ve had one a while and wasn’t too sure what to do with it then read on for some tips on how you can do more with this wonderful little computer.
Even if your Raspberry Pi is a model B or B+ (which has a built in network connection) going wireless can have many advantages.
Not only does it make it easier to setup your Raspberry Pi in a location which is convenient for you (you don’t need to be next to a network socket or your router) but it means if you are using your Raspberry Pi remotely i.e. without a screen (see my Guide to Remote Connections) you just need to add power to run.
A Wifi adaptor will require some additional configuration, so be prepared to set it up before you use it (also be warned that you must plug in the Wifi dongle before you power up the Raspberry Pi – particularly for the older models – otherwise it will cause the Raspberry Pi to reboot).
The Pi-Kitchen can help greatly with the Wifi setup and can allow you to configure everything up front so when you install via NOOBS it will work immediately!
Although remember, if you are using an older model B or a model A (or A+) adding a USB Wifi dongle will take up a USB socket, so you may be limited to using either a mouse or a keyboard (or neither on a model A/A+). However there are ways around this limitation too:
Generally if you are planning on using the Raspberry Pi with your kids, then having a dedicated screen you can setup specifically for their use is by far the best solution. Don’t forget that the whole idea of having a cheap computer is so that kids can experiment freely with it without worrying about causing damage to expensive parts or hogging the use of the family computer/TV.
TIP: For particularly young kids it can even help to have a 2nd setup for you to use, that way you can go through the same steps as them and if they get stuck demonstrate the answer. By having a 2nd setup (even if you use a laptop and remote connection) you avoid the temptation to take hold of the mouse or keyboard and do it for them: you can show them and they can copy. That way the sense of achievement is far greater as everything they do has been totally their own work.
When the Raspberry Pi was first released HDMI to VGA adaptors were rather expensive, bulky and often required external power. This typically meant the best option was to find a screen which supported HDMI (such as a digital TV) and use that.
However these adaptors are now relatively cheap (£8 or less) very compact and will run directly from the Raspberry Pi. These low cost adaptors are ideal if you have a spare screen available or an old computer, as HDMI compatible monitors are still quite expensive and it probably overkill to run a £30 computer with. You may even find that your IT department or a local company will have unwanted VGA monitors or screens available, as newer PCs no longer support analogue connections they will still be ideal for the Raspberry Pi.
You may need to use slightly different settings with these adaptors, the config.txt file controls these settings (initially you can use hdmi_safe=1 to check everything is working).
For more details see config.txt file.
If you have a screen which supports DVI-D even better, as HDMI to DVI-D adaptors are around £2 at most and generally will result in a better signal (by remaining as a digital output).
Also remember if you use an adaptor for the HDMI output to convert to DVI-D or VGA audio will not be provided by the monitor so you may need additional speakers for sound (or a suitable cable if your screen has built-in speakers).
Again, there are a few other alternatives for display output:
The Raspberry Pi does have an analogue output (which can connect to older TVs though composite and SCART connections) but for most situations the display is low resolution and hard to see. I would not recommend this method for general use except as a fall back when configuring things. When using the Raspbian desktop you find that most programs will not physically fit on the screen making it impossible to click dialogue items or use them effectively.
This little board plugs (designed by the Raspberry Pi foundation’s Gert-van-Loo) directly onto the newer Model A+ or B+ Raspberry Pi GPIO header and allows you to drive a VGA monitor directly from the Raspberry Pi itself. This allows you to connect directly to a VGA screen and also supports a 2nd display (via HDMI for example). However it does use up most of the GPIO pins (4 are left over which can still used for hardware).
Note: If you have an older Raspberry Pi model (Model A or Model B) then this adaptor will not work (it required the newer 40 pin GPIO connection).
By using VNC, X11-Forwarding or SSH you don’t even need to have a screen (see my Guide to Remote Connections).
However, it is always helpful to have a screen available for those times when there is a problem connecting to the Raspberry Pi and you need to trouble-shoot the issue (you will fix your problem much quicker if you can see what is happening).
Generally if you are planning on using the Raspberry Pi with your kids, then having a dedicated screen you can setup specifically for their use is by far the best solution. Don’t forget that the whole idea of having a cheap computer is so that kids can experiment freely with it without worrying about causing damage to expensive parts or hogging the use of the family TV/computer.
TIP: For particularly young kids it can even help to have a 2nd setup for you to use, that way you can go through the same steps as them and if they get stuck demonstrate the answer. By having a 2nd setup (even if you use a laptop and remote connection) you avoid the temptation to take hold of the mouse or keyboard and do it for them: you can show them and they can copy. That way there is a far greater sense of achievement as everything they do has been entirely their own work.
Everyone needs to start somewhere and using some of the vast array of resources available is an excellent way to get started.
This community led magazine is available for download for FREE from the MagPi website, and is a perfect resource for those starting out with the Raspberry Pi and also to get some more advanced ideas too. You can support the MagPi by purchasing printed versions of the magazine from the many retailers (see the site for details).
The Raspberry Pi website has a whole section of resources available, a perfect place to get started and learn the basics of using the Raspberry Pi and starting your own projects.
For those bigger projects and a more complete guide a good book makes an excellent resource. Ideally you will find that you will often find the solutions to what you need just by grabbing it off the shelf and looking the answer up (a good reference book will keep being useful long after you’ve read it once).
There are lots of great Raspberry Pi books out there, but I would like to recommend my own one as a comprehensive guide to what you can achieve with the Raspberry Pi.
You can read more about in the sections above on this site, and also see what other’s think by reading the excellent reviews (of which I am very thankful for) I’ve had on Amazon. The book is also available from other retailers, or direct from the Packt website.
As any hardware or embedded software engineer will tell you, the first step to any project is to get some lights flashing. For kids the ability to control something which they can physically pick up and handle is a huge incentive and can make following guides and tutorials far more engaging.
The Pi-Stop is an excellent starting point, fitting directly onto the Raspberry Pi it provides a excellent starting point for interfacing with hardware on the Raspberry Pi. There are lots of resources available to get you started and also a number of workshops and tutorials to follow.
The Pi-Stop was jointly designed by PiHardware (this site!) and 4Tronix as a low-cost and easy to use add-on for workshops and home use. Of course once you’ve got used to controlling hardware they are excellent for debugging and indicating different operations while the Raspberry Pi is running, and can also be used with other micro-controllers too.
More tips to supercharge your Raspberry Pi coming soon!
The Pi-Kitchen grows to 10 recipes. I’ve also tested with the latest version of NOOBS 1.3.11 and everything works as it should. The Pi-Kitchen allows everything to be setup automatically, so all my settings are recreated following a clean install of NOOBS.
This recipe allows the Raspberry Pi to share the Pi home directory on the network as a Windows Shared Folder. This makes it easy to manage your files and back them up etc.
For more details see…Recipe: 007-Create Network Share
This recipe enables VNC so we are able to remote connect and control the Raspberry Pi using a VNC connection.
For more details see…Recipe: 008-VNC
This recipe allows the Raspberry Pi to map a Windows Shared Folder as a local directory.
For more details see…Recipe: 009-Map Network Share
This recipe allows the Scratch GPIO to be setup as part of the Pi-Kitchen.
For more details see…Recipe: 010-Scratch GPIO