Sunday, 17 September 2017

Raspbian back ups and shrinking

After backing up a 16GB SD card from my Raspberry Pi, it wouldn't restore on any other card, even though they are all 16GB???

Here is what I did: 

1:  Shrink the image on the SD card - use gparted to look at the image, select the main partition, then select resize and slide the arrow to just before where your image is written, (the darker part) leave about 10MiB of blank space to be sure your not going to overwrite your image and apply. 

2: Back up the image from SD card  sudo dd bs=4M if=/dev/sdb of=raspbian.img
this creates a backup image in your home folder 

3: Cut off the unused space from your backed up image with the following method.

a) fdisk -l myimage.img - this outputs the start and end of the image.

b) Use the end figure of the image in the next command to cut off that amount from the backup.
I will use the figure 4434269 as an example in the command below but make sure you 
replace my figure with your own one

c) run the next command to cut off the unused space on your image
 truncate --size=$[(4434269+1)*512] myimage.img 

(make sure you replace 4434269 with your fdisk end figure)

Now you can copy your image to another card to test, you should have saved a nice amount of space,
my image is now small enough to use an 8GB card card.

Tuesday, 16 May 2017

Ransomware precautions

lots of talk about the wanacry encryption virus that has spread lately, if you do the next steps regularly you should cut down your chances of getting hit, no need for paid antivirus, the default windows defender is fine and has been updating to keep up with this on a daily basis.

1 keep all devices updated & antivirus updated
(this will include patches to help prevent viruses)

2 don't open email attachments or pop ups.
(one of the easiest ways to get infected)

3 don't run as admin user
(most malware etc. will not install on your system if your running as a normal user without admin privileges)

4 back up offline and keep backup device offline.
(If you do get infected, you can wipe your hard drive and start again with your backup nice and safe, the virus will also encrypt your backup/s if connected to your network or PC in any way, so keep separate) a complete image backup is best, it's just 10 minutes to install the whole system back to the way it was this way and worth the planning ahead.

Sunday, 16 April 2017

Robot list

Iv'e been building robots lately, because I'm forgetful this is a checklist of stuff to install on SD cards.

1 Flash raspbian
2 Add ssh file to boot menu (so I can immediately login from SSH)
3 Add WiFi config file (so I dont have to set up on gui).
4 Add python files such as line follower program and set preferences to run as program

Boot and login via SSH

1 Run sudo raspi-config ...
change password
enable camera
enable SSH
enable I2C
enable remote gpio

2 Install explorer hat (or whatever motor controller your using)
3 Install inputs (sudo pip install inputs)
4 Update and reboot
5 Check everything works.


My WiFi config for quickness: (wpa_supplicant.conf)

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network=
{
ssid="your ssid"
psk="your ssid password"
key_mgmt=WPA-PSK
priority=10
}

Saturday, 1 April 2017

My favorite Raspberry Pi projects

A list of my favorite Raspberry Pi projects.

PiDP-8
A clone of the PDP-8 computer, the face plate and switches are available as a kit from "Obsolesence guaranteed" website, it's an expensive kit at just over £100 (Raspberry Pi not included) with lots of tinkering longevity, avoid if you don't like soldering and a good few hours work, but the end result will give you a thing of retro beauty.


ISS-Above
A simple ISO image from ISS-Above, which you copy to an SD card, put in your Pi, connect to a monitor or TV for an out of this world live feed from the International space station, watching the sunrise it truly magnificent. 


Volumino
Limitless internet radio stations to listen to whatever your taste in music. I found "volumino" to be a great choice to write to an SD card, you will need some sort of Pi add-on to connect to speaker/s such as a Pirimoni speaker hat or for more power a Hi-Fi Berry amp, a nice simple interface, set your board type and wireless settings from your PC, phone or tablet, then lay back and enjoy a bit of Zen radio, bliss!


Retro Pi
The amount of games available for the Retro Pi image is staggering, I have a 32gb SD card almost full! Add different rom's once you have set up the main Retro Pi image for a trip back in time to Sonic the hedgehog or a classic ZX Spectrum game.


Pi Desktop
The latest Raspbian pixel image is perfectly usable for an every day computer now, the early Pi's were slow but the Pi 3 with Raspbian is a lot more polished, decent learning software by default and Minecraft is always great fun.

Friday, 31 March 2017

Arduboy

Learning to write code has never been so much fun!

The Arduboy is a credit card sized Game boy style console with a basic OLED 128x64 screen, which has an Arduino chip at it's heart (ATmega 32u4), so it can be programmed in the same way as an Arduino using the Arduino IDE.

I originally bought this as a learning platform, writing a game I could share as the end result I had a good incentive to give this a go, the first thing I came across was a friendly and helpful community and website (Arduboy)
I found programming hard (and still do) but found it's important to aim for something that you have an end goal to and to keep motivated, for me the Arduboy was it, I have never learnt as much about programming than when I just dived in and started to give it a go, reading all the books in the world doesn't make up for experience, I had and still do have a large amount of errors in my code, but it's getting better, my friend Les Pounder taught me about failing F.A.I.L = First attempt in learning, and you sure need to be prepared to some "why on earth isn't this working" moments, but please keep going, it's worth it!

If you have or are going to get an Arduboy, please enjoy my game, click on the title below.

Boris goes skiing

A big thank you to my friend Mike McRoberts (The Arduino guy) for all your help.