About James Muirhead

Impoverished Professional Photographer, hacker, maker and general weirdo!

A super simple way to copy files from a networked computer

Ok, so you’re wanting to extract files from your Raspberry Pi (or other networked computer) and you can’t be bothered to go find a USB flash drive (don’t feel guilty, I’ve been there too). How about you set up a temporary HTTP file server of the information and access it from any web browser on another computer? Impossible you say? Not quite apparently.

I’ve just found this trick and it is possibly going to become one of my most used methods of file transfer from a Raspberry Pi.

  1. Go to the folder you want to access from another machine in the command line of the Pi…
  2. Now type in the following line…
    python -m SimpleHTTPServer 8080
  3. That’s all you have to do, at least on the pi.
  4. On another computer, go to the following address in any web browser… http://<hostname or IP address of pi>:8080
    For example… http://raspberrypi.local:8080 or http://192.168.1.100:8080
  5. Once you’re done copying you’re files, go back to the Raspberry Pi and type…
    Ctrl+C
  6. Your HTTP Server is now gone, like it wasn’t even there.

Wasn’t that simple? I foresee this as being a stupidly useful tool for copying files in future (particularly copying to an Android or iOS phone). Admittedly it isn’t bi-directional, but that is what SSHFTP is for!

FYI, I have tested this on a Raspberry Pi, Mint Linux desktop and on Windows 10 (with Python installed) and they all work. Windows 10 does require you give Python permission to act as a server (there will be a popup).

Happy making folks, hope the above helped in your projects. Ask a question in the comments below if you haven’t succeeded with this useful trick.

MAKE:SHIFT:DO

On Friday October 23rd we took part in MAKE:SHIFT:DO. A creative open day run by the Craft Council. Also taking part at Portland Works was James Wallbank who was doing Laser Cutting tutorials.

We displayed a number of our ongoing projects and had a few interested parties. Photos below.

Portland Works was the only location in Sheffield to be taking part in MAKE:SHIFT:DO this year and 1 of only 4 locations in Yorkshire as a whole.

We hope to run a similar (if not much, much better) event next year.

Quite a a set up here with @shhmakers and @portland #MakeShiftDo

A Tweet mentioning us from the Craft Council.

A number of projects running including a 3D printer and pirc running in the background.

A number of projects running including a 3D printer and pirc running in the background.

A handful of our visitors.

A handful of our visitors.

3D Printing Examples

3D Printing Examples

A poster advertising the day.

A poster advertising the day.

Links…

DigiStump DigiSpark Arduino and Debian 8 64bit

UPDATE 2016-02-02: There is an updated version of the script below which also works with the DigiSpark Pro. See below.

In the space recently we’ve been playing with the super low cost Digistump Digispark 16.5MHz boards and the Arduino 1.6.5 environment.

Unfortunately there are some issues with these working out of the box with 64-bit versions of Linux (we use Debian 8 64-bit) as one of the attached binaries is compiled for 32bit only. However, after some major head scratching, I have managed to get them to work reliably.

To get them to work. You need to install the Digispark hardware library as normal and then follow the steps below.

Installing the DigiSpark library

Add the following line to the Additional Boards Manager URLs in File –> Preferences. If you have previously added boards to this list, you will have to separate them with a ; or use the button to edit it in list form. If you need an in-depth guide, there’s one in the links at the bottom from everyone’s favourite Adafruit.
http://digistump.com/package_digistump_index.json

Fixing the missing bits

Once you’ve done that, you will need to download the following script (I’d of included it as a downloadable file, but someone disabled it on our server)…

#!/bin/bash

# Adds necessary libraries and UDEV rule for using the Digistump DigiSpark boards in Arduino 1.6.5 on Debian 8 64-bit
# Written by James Muirhead. 2015-10-12

# This works on the 16.5MHz original Digispark. Has not been tested on other varients.

# Checks if you are root, as this is required.
if [ $(whoami) == "root" ]
then
# Updates apt then installs 2 necessary libraries and their dependencies
apt-get update
apt-get -y install libusb-dev lib32stdc++6

# Adds UDEV rule which adds the DigiSpark device to the dialout group, same as required by Arduino IDE.
echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="16d0", ATTR{idProduct}=="0753", MODE="0660", GROUP="dialout"' > /etc/udev/rules.d/99digispark.rules

# Restarts UDEV to enable the above.
service udev restart

echo "DONE!!!"31
else
echo "You need to be root to run this script, use su / root to try again."
fi

Right, once you’ve got the above copied into a file called e.g. digispark.sh you will need to make it executable. To do this, you will need to log in as root (type su at the command line and type your root password). Then type the following to make the file executable.

chmod a+x digispark.sh

Ok, once the file is executable, stay root and run the following…
./digispark.sh
This may (or more likely will) take some time, so leave it till it’s done what needs to be done.

Once finished, close and re-open the Arduino IDE.

DONE!!!

Once this is all done, you should be able to upload a sketch to your DigiSpark without problems.

Links

Update 2016-02-02

I’ve written a new version of the script above which also works for the Digispark Pro. Follow the same instructions as above, but use the script below instead. It is longer, but does a few more things.

And, just because I’m feeling nice, I’ve put it on GitHub to make life easier.
DOWNLOAD NOW

#!/bin/bash

# Digispark installer.
# Written by James Muirhead.
# 2015-10-12
# http://www.sheffieldhardwarehackers.org.uk

# CHANGE LOG
# 2015-10-16 - Only installs 32-bit extensions if 64 bit OS detected.
# 2015-11-04 - Now creates UDEV rule for DigiSpark & DgiSpark Pro.

if [ $(whoami) == "root" ]
then
apt-get update

# Installs required library.
apt-get -y install libusb-dev

# Checks for 64-bit environment and installs required 64-bit extensions.
uname -a | grep x86_64
if [ $? == 0 ]
then
apt-get -y install lib32stdc++6
fi

# Creates UDEV rule for DigiSpark
echo "# Rule to allow use of the basic DigiSpark (ATtiny85) board in the Arduino IDE 1.6.3+" > /etc/udev/rules.d/99digispark.rules
echo "# Written by James Muirhead (@PhantomFreak), 2015-10-12." >> /etc/udev/rules.d/99digispark.rules
echo "# http://www.sheffieldhardwarehackers.org.uk" >> /etc/udev/rules.d/99digispark.rules
echo "" >> /etc/udev/rules.d/99digispark.rules
echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="16d0", ATTR{idProduct}=="0753", MODE="0660", GROUP="dialout"' >> /etc/udev/rules.d/99digispark.rules
# Creates UDEV rule for DigiSpark Pro.
echo "# Rule to allow the use of DigiSpark Pro (ATtiny167) board in the Arduino IDE 1.6.3+" > /etc/udev/rules.d/99digispark-pro.rules
echo "# Written by James Muirhead (@PhantomFreak), 2015-11-04." >> /etc/udev/rules.d/99digispark-pro.rules
echo "# http://www.sheffieldhardwarehackers.org.uk" >> /etc/udev/rules.d/99digispark-pro.rules
echo "" >> /etc/udev/rules.d/99digispark.rules
echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="16d0", ATTR{idProduct}=="0753", MODE="16d0", GROUP="dialout"' >> /etc/udev/rules.d/99digispark-pro.rules

# Restarts UDEV
service udev restart

echo "All done, please close all open Arduino IDE windows & reopen before attemptting to upload code."
exit 0
else
echo "You are not root, please use sudo or su to continue."
exit 1
fi

Mam Tor Kite Aerial Photography

Several members of the group attended Geeks in the Peeks recently (4th-6th September 2015). As part of this on the Saturday, we decided to take my Kite Aerial Photography rig to the top of Mam Tor to see if we could take some photos. I brought along my Raspberry Pi based system (A model A with a camera module, air pressure sensor, USB wifi card (for the web UI preview and start/stop/shutdown buttons) and LiPo battery) which takes images every 7 seconds, on average while airborne.

The wind was nice and smooth and resulted in the Kite flying very stably. This helped produce some very clear and well focused images with little smearing effect (common in gustier winds). See below for some examples…

008

Image 8

022

Image 22

051

Image 51

066

Image 66

067

Image 67

Relative Altitude data for period of use.

Relative Altitude data for period of use.

NB: In the graph above, you can see that towards the end of the flight, the camera appears to be below the starting altitude. This is caused by the kite camera taking the initial reading on altitude (based on air pressure) while it is already some way up above it’s ground level starting point (it takes a little while for the Raspberry Pi to actually boot up to the point it can run the code to control the camera). However, as you can see the highest image was taken at 40m above the start altitude. From the spreadsheet the Pi makes, I can tell you it was image 29.

Image 29, highest in the series.

Image 29, highest in the series.

Kite and camera in flight above Mam Tor

Kite and camera in flight above Mam Tor

From the above you can see the Kite clearly in the sky as well as a brown spec hanging from it, this is the Raspberry Pi kite camera hanging from a Picavet device (this allows the camera platform to always be level while in flight suspended below the kite’s string).

Andy restraining AJ to prevent him being pulled away by kite.

Comedy moments… Andy restrains AJ to prevent him being pulled away by kite.

For more information of Kite Aerial Photography, start with Wikipedia and see how you get on. However, if you have any questions or a desire to see a full & in-depth article on KAP, please leave a message below and I’ll be sure to start work on it. There is also a great YouTube video from the folks at Make Magazine here, this was in fact the original inspiration for me to get into Kite Aerial Photography after I left University.

For more information on Geeks In The Peaks, please see their Twitter & attending.io pages.