Setting up an iPod for a non-adult (unofficial guide)

Apple for legal reasons do not allow minors to setup an Apple ID and purchase music, apps, games etc. If you try and create an Apple ID for a minor apple will say thanks but no thanks. The next best solution is to setup the iPod with a parents Apple ID and share music and content to the device on a file by file basis (this is a pain), but what happens when the child grows up and leaves home ? There is no way you can split years of paid music/videos into a different account. Also sharing a parents Apple ID causes issues with purchasing content as an adult and child, Apple Gift cards received at XMAS would have to be handed to the parent to then make purchases.

This guide is not the official method for setting up an iPod for a (responsible) child but I see this as the best way to setup a new iPod for a minor.

Steps to Setup an iPod for a minor (“joe blogs”) but with age appropriate restrictions

  1. Create a separate desktop (Windows or Mac) login for “joe blogs”.
  2. Download the latest version of iTunes.
  3. Plugin the iPod into the computer.
  4. Allow the iPod to backup and update the iPod operating system to the latest version (e.g 7.0.4).
  5. Create an email address for “joe blogs” (I recommend you buy your own domain (e.g http://www.bloggs.com ) they you can create email accounts for your family (e.g joe@bloggs.com)
  6. On the Desktop (Windows or Mac) open iTunes and click the Store then Create Apple ID Account. Link the apple ID to the new email account and set the age to the parents age (not the child’s). Set a VISA Debit as the payment type (don’t worry we won’t be making any purchases) this is just a temporary measure to verify the account is an adults.
  7. Verify the apple ID email that was sent to the email address.
  8. Open the Music app on the iPod, Click store then scroll to the bottom of the screen. Click Sign In. Sign in with the apple ID.
  9. Redeem a gift card ($30 would be fine).
  10. Go to the Apple Music store and make a purchase, Apple will ask you to verify the debit card CCV before making purchase. The purchase should come from the gift card credit and not the debit card.
  11. Open the music app, click store, scroll down to payment information and remove VISA card from payment information (select none).
  12. Open iTunes on the desktop and open the store menu then view account, sign in and click Payment Information. Remove and debit cards from the payment list.
  13. Now on the iPod go to Settings, general, Restrictions, select a password that only the adults will know).
  14. Specify age appropriate settings in the restrictions screen (Go hard and lock things down, worst case you can unlock features later).
  15. Go back to settings then general and set a passcode lock.
  16. Educate you kids on using gift cards, not buying in app purchases and virtual goods.
  17. Monitor your kids often.

Now the minor can have a locked down age appropriate iPod but still receive gift cards and purchase under their own name instead of searching for shifty/free content.
Hope this helps someone.

Connecting a Freetronics Twenty Ten to a HanRun Ethernet Adapter

Connecting a Freetronics Twenty Ten to a HanRun Ethernet Adapter (ENC28J60 Ethernet LAN+Network Module)

hanrun2

hanrun1

What hardware you will need

  • 1x Freetronics TwentyTen
  • 1x HanRun HR911105A 12/18 Ethernet Board (eBay)
  • Misc Solder-less breadboard cables (Male/Female)

Router Configuration

I prefer to assign static IP’s to any of my test devices (Arduino or Raspberry Pi). This way I know what the IP is in case I need to connect to it. If you want to use your arduino in a Dynamic IP network then you may not have much luck with this guide as I am configuring the arduino to use an static ip that I have reserved in my router.

    Arduino Static

The HanRun Ethernet adapter does not have a mac address built in so I made one up ( 00:12:34:43:21:00 ), you can generate mac addresses here http://www.miniwebtool.com/mac-address-generator/.

Software Configuration

  • Arduino.cc IDE (Set the ‘Board’ to ‘Arduino Nano w/ ATMmegda 328’ and the virtual serial port for your USB cable)
  • Download ‘Ethercard’ from https://github.com/jcw/ethercard (add it as a library into arduino.cc IDE)

The Wiring

HanRun Side | Arduino Side

    GND = Power Ground
    SCK = Pin 13
    SO = Pin 12
    VCC = Power 3V3
    CS = Pin 8
    SI = Pin 11

photo 2

    The Code
    Now this is my code solution for returning a date from a website (php script). Yu can change the IP, Gateway, Server Name, IP and Path to your server if need be.

    // This demo does web requests to a fixed IP address, using a fixed gateway.
    // 2010-11-27 http://opensource.org/licenses/mit-license.php
    // 2013-11-23 Modified by Simon Fearby

    #include
    #include

    #define SLEEP_TIME_AFTER_SETUP 10000 // How often do we poll the server

    //static long timersetup; // Used to remember the last millisecond for the last call (during setup)
    static long timerloop; // Used to remember the last millisecond for the last call (after setup)

    static byte mymac[] = { 0x00, 0x12, 0x34, 0x43, 0x21, 0x00 }; // ethernet interface mac address
    static byte myip[] = { 192,168,1,201 }; // ethernet interface ip address
    static byte gwip[] = { 192,168,1,1 }; // gateway ip address
    static byte hisip[] = { 175,107,162,121 }; // remote website ip address and port

    char website[] PROGMEM = "fearby.com"; // remote website name

    byte Ethernet::buffer[1000]; // a very small tcp/ip buffer is enough here

    void setup () {
    Serial.begin(57600);
    while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
    }
    Serial.println("Ready");
    if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
    Serial.println( "Error Failed to access Ethernet controller");

    ether.staticSetup(myip, gwip); // Our router has a Static IP already setup for us so dont ask for a IP via DHCP
    ether.copyIp(ether.hisip, hisip); // Is it the IP we expect?

    ether.printIp("My Gateway: ", ether.myip); // Output the routers IP (Gateway)
    ether.printIp("My IP: ", ether.gwip); // Output the Arduino's IP)
    ether.printIp("Remote Server: ", ether.hisip); // Output the IP of the remote server.

    while (ether.clientWaitingGw()) // Check to see if the gateway is up before moving on.
    ether.packetLoop(ether.packetReceive());

    Serial.println("Gateway found"); // Congrats, Move on

    Serial.println("Waiting 10 seconds before polling data."); // Congrats, Move on

    }

    static void my_result_cb (byte status, word off, word len) { // called when the client request is complete
    Serial.print("<<< reply "); // We got a reply from the web server Serial.print(millis() - timerloop); // Time Stuff Serial.println(" ms"); // Print the time diff between the call and data received Serial.println((const char*) Ethernet::buffer + off); // Ok print the contents of the webpage } void loop () { ether.packetLoop(ether.packetReceive()); // Process Incoming Packets if (millis() > timerloop + SLEEP_TIME_AFTER_SETUP) { // Do we need to sleep? We dont want to load a website 10,000 a second.
    timerloop = millis(); // Remember the last time we loaded the webpage
    Serial.println("\n>>> Webpage Request Sent.."); // Lets get a Webpage
    ether.browseUrl(PSTR("/temp/printdate.php"), "?", website, my_result_cb); // Query Google
    }
    }

    Result from the Arduino

    hanrun3

    Where to now

    Remember that this code running on a small circuit board that runs < 20Mhz 8bit processor that can be powered by AA batteries.

    You can point to your own scripts and save/read database values or trigger other Arduinos or external processes.

    The next step is to have this device read from any external sensors or control the physical world around us with expansion cards.

PiFace, Python and controlling basic circuits

Setting up the PiFace

Source Setup Script: http://pi.cs.man.ac.uk/download/install.txt

    sudo apt-get install -y python-dev python-gtk2-dev git
    pushd ~/
    git clone https://github.com/thomasmacpherson/piface.git
    pushd piface/python
    sudo python setup.py install
    popd
    sudo piface/scripts/spidev-setup
    popd

Quick Circuit Setup
piface01

piface02

Sample Python code to power my 5x 5v lights and 1 speaker.

    #!/usr/bin/python
    from time import sleep
    import piface.pfio as p
    p.init()
    # while True:

    # Front LED On
    p.digital_write(0,1)

    # Speaker Test
    p.digital_write(4,1)
    sleep(0.1)
    p.digital_write(4,0)

    for intloop in range(3):

    # Red Led Test
    p.digital_write(1,1)
    sleep(0.2)
    p.digital_write(1,0)

    # Yellow Led Test
    p.digital_write(2,1)
    sleep(0.2)
    p.digital_write(2,0)

    # Green Led Test
    p.digital_write(3,1)
    sleep(0.2)
    p.digital_write(3,0)
    sleep(0.1)

    #2 light Test

    p.digital_write(1,1)
    p.digital_write(3,1)
    sleep(1)
    p.digital_write(1,0)
    p.digital_write(3,0)
    sleep(0.1)

    #1 Ligth test

    p.digital_write(2,1)
    sleep(1)
    p.digital_write(2,0)
    sleep(0.1)

    # Speaker Test
    p.digital_write(4,1)
    sleep(0.1)
    p.digital_write(4,0)
    sleep(0.1)
    p.digital_write(4,1)
    sleep(0.1)
    p.digital_write(4,0)
    sleep(0.1)

    #Turn All On

    p.digital_write(1,1)
    p.digital_write(2,1)
    p.digital_write(3,1)
    sleep(2)
    p.digital_write(1,0)
    p.digital_write(2,0)
    p.digital_write(3,0)

    #Turn Front Led Off
    p.digital_write(0,0)

Custom Pi Case and Basic Circuits

Custom 5 1/4 Floppy Pi Housing (w/basawood floor).
Post02a

Custom 5 1/4 Floppy Pi Housing (Front).
Post02b

Basic LED circuit for my 3yo.
Post02c

3 LED circuit for my 3yo.
Post02d

Breadboard mounted in my Custom 5 1/4 Floppy Pi Housing.
Post02e

Breadboard mounted in my Custom 5 1/4 Floppy Pi Housing (Top).
Post02f

Raspberry Pi Setup

What is the Raspberry Pi?

The Raspberry Pi is a cheap computer designed by the Raspberry Pi Foundation (UK registered charity) to help kids build knowledge and experience in the computer Science, engineering and programming fields. Read more here: http://www.raspberrypi.org/about and here http://en.wikipedia.org/wiki/Raspberry_pi )>.

Post01b

My Raspberry Pi Setup

The Raspberry Pi is a very forgiving device to get started on, first you plug in your power (mine was a USB cable), SD card. keyboard, mouse, monitor (HDMI) and turn it on. My SD card was empty and nothing booted so i..

  • Downloaded NOOBS (Off-line Installer:) http://www.raspberrypi.org/downloads
  • Installed SD Card Formatting Tool: https://www.sdcard.org/downloads/formatter_4/eula_mac/
  • Performed an overwrite Format on my SD card.
  • Copied the contents of noobs13.zip to the Pi.
  • Booted the pi (with hdmi, kbrd and mouse plugged in).

Basic Commands

How to safely shutdown the OS.

    sudo halt

How to update all os packages

    sudo rpi-update (Sorry I had “dpi-update” before)
    sudo apt-get update && sudo apt-get upgrade

Setting up a FTP server (so you can upload files to the Pi from another PC).

    sudo apt-get install proftpd
    Restart the FTP Service:
    sudo service proftpd restart

Networking Setup

I had issues with a raspberry Pi that was already on my network (a Pi driven 24/7 webcam that was built by the awesome Brisbane Storm Chasers, my camera uploads images to the http://webcams.bsch.au.com/index.htm weather cam network for my http://www.twitter.co/2340weather twitter feed.

How to change the Pi’s name:

    sudo hotname SiPi01

Change the Pi’s name permanently:

    sudo nano /etc/hostname
    sudo nano hosts

    tip: change 127.0.0.1 to SiPi01

Check network Interfaces:

    cat /etc/network/interfaces

How to check the network connection:

    ifconfig

Reboot:

    sudo reboot

I also wanted my ADSL router to give the SiPo01 the same IP every time. so I followed this guide to set a Static IP.

    This ended up being my config.
    ip: 192.168.1.100
    bcast: 192.168.1.255
    mask
    255.255.255.0
    gateway: 192.168.1.1
    destination: 192.168.1.0

Keyboard Setup

I noticed my keyboard setup was set to UK and # symbols were not working. This allowed me to reset the keyboard to whatever region I wanted.

sudo dpkg-reconfigure keyboard-configuration
sudo reboot
sudo raspi-config

Sound Stuff

Enabling audio on the 3.5mm audio jack (not HTML sound).

I followed this guide: http://www.raspberrypi-spy.co.uk/2013/06/raspberry-pi-command-line-audio/

    How to install an easy mp3 player called mpg321: http://www.include.gr/debian/mpg321/

      Quick Summary:
      sudo apt-get install mpg321

    How to Play a MP3 file.

      sudo mpg321 -g 50 RogerWaters-FletcherMemorialHome.mp3

    How to turn the volume up:

      alias volu='sudo amixer set PCM -- $[$[amixer get PCM|grep -o [0-9]*$|sed 's/%//')+10]%'

    How to set command line aliases to type the stuff above for your when you type “volup.”

      sudo nano ~/.bash_aliases

      Add the following lines:

      # increase volume by 5%
      alias volup='sudo amixer set PCM -- $[$(amixer get PCM|grep -o [0-9]*%|sed 's/%//')+5]%'

      # decrease volume by 5%
      alias voldown='sudo amixer set PCM -- $[$(amixer get PCM|grep -o [0-9]*%|sed 's/%//')-5]%'

      Now you can type “volup” and “voldown” to change the volume.

First BASH Script

Make a folder for scripts to live in.

    mkdir /usr/bin/simon

Change to the new scripts folder.

    cd /usr/bin/simon

Make a script file.

    sudo nano testScript001

Make the script file executable.

    bash -x testScript001
    First Script Contents

      I wont bore you with details line by line but the script outputs a few system variables, tests the internet connection, downloads a file the exits.


      #!/bin/bash

      printf "Hello, $USER\n"

      OS_TYPE=$(uname -o)
      printf "OS Type: $OS_TYPE\n"

      OS_VER=$(uname -r)
      printf "OS Version: $OS_VER\n"

      CPU_TYPE=$(uname -m)
      printf "CPU TYPE: $CPU_TYPE\n"

      _IP=$(hostname -I) || true
      if [ "$_IP" ]; then
      printf "IP: $_IP\n"
      fi

      printf "BASH Version: $BASH_VERSION\n"

      DATE=$(date)
      printf "Today's date: $DATE\n"

      echo "Pi Updtime:"
      uptime
      printf "\n"

      printf "Testing Internet Connection (https://www.websitenameremoved.com):\n\n"
      # ping -q -t 10 -w1 -c1 https://www.websitenameremoved.com
      wget -q --tries=2 --timeout=20https://www.websitenameremoved.com/
      if [[ $? -eq 0 ]]; then
      printf "Internet appears online.\n\n"

      TMP_FILE="./simple_text_file.txt"
      if [ -f $TMP_FILE ]
      then
      echo "Deleting old temp files.."
      sudo rm ./simple_text_file.txt
      fi
      printf "Downloading file from the internet.\n"
      sudo wget https://www.websitenameremoved.com/test/simple_text_file.txt
      if [ -f $TMP_FILE ]
      then
      printf "File downloaded ok.\n"
      fi

      else
      printf "Internet appears offline, unable to download files."
      fi

      printf "Goodbye\n\n"

    All you do to run the script is type the following.

    • sudo ./testScript001

Setting the script to run every 15 minutes

    sudo nano /etc/crontab

    Add the following line at the end of crontab to run the script every 15 minutes:

      # */15 * * * * root /usr/bin/simon/testScript001

Misc Commands

Viewing the startup script (that executes after each user logs in)

    sudo apt-get install mpg321

Installing a Webcam Driver

    sudo apt-get install fswebcam

      Capturing a Webcam Image:
      /usr/bin/fswebcam -r 960x720 -d /dev/video0 /home/pi/webcam.jpg

Quest to learn to build and program electronics

I have decided to create another blog category on my personal blog to throw information and progress while expanding one of my earliest childhood interests “electronics”. Like many other kids I looked at electronic XMAS toys and wondered how they really worked inside. This resulted in me grabbing the nearest screwdriver (pointy knife) and opening the toy with much vigour and excitement. Often I would break something and I would forgot what order to reassemble it in and the toys would never be the same again (remote control semitrailer and electronic battle ship game comes to mind, sorry mum). But one the toys was opened my mind went nuts, I could see batteries, motors, lights, fans, wires and funny coloured bits (resistors and capacitors) power thingies etc.

When I was a child I remember my grandads sheds (he had a few as he moved house every 6 years or so), sometimes my granddad was in his shed fixing something (mower blades or tools). He always had neatly arranged tools and boxes of stuff and jars with nuts and bolts. I had a great time playing in his sheds and searching for things to do and play with. I want to pass on my fascination of electronics and programming to my kids in a similar environment to my grandads shed and also automate my home and make some cool gadgets along the way.

Part of my quest to learn electronics (for real) was triggered by my desire to fill my 3yo son’s (and soon to be 2nd child) minds with knowledge, wonder and a more than basic knowledge in STEM (Science, Technology, Engineering and Maths), electronics can help teach a fair bit of this as well and hands on experience. Also learning electronics is a kind of stress reducer, work/home demands are always changing but electrical knowledge all but stays constant (apart from miniaturization of components).

I find it quicker to do date calculations in code in excel so I am sure I will be able to program the electronics with ease but I have no doubt it will be an uphill battle teaching this old dog all the ins and outs of electronics (the right way). I will be hitting google a fair bit when it comes to searching for information and schematics and I would lie to share that with kids and older tinkerers.

Post01a

With a second child on the way I need a non-time consuming hobby to use to distract my 3yo when bubby 2 and mummy need a rest and to read up on in the small hours when I am putting baby to sleep.

Learning Goals:

  • Learn basic Electronics (components and theory).
  • Learn to program a Raspberry Pi
  • Create and control basic electronic circuits, read sensors, move mechanical objects and talk to the internet.
  • Learn to scale down code and hardware to the Arduino‎ platform.
  • Fix household items.

Physical Goals:

  • Create a battery powered Arduino circuit to install in the greenhouse to auto mist in hot weather from tank water). Report on temperature, and humidity.
  • Create a 100% automatic weather station that uploads details about temperature, humidity, barometric pressure, wind speed, smoke detectors, wind gusts, dew point, solar exposure, cloud cover, rainfall, soil moisture etc (how: many cheap sensors and custom circuits).
  • Create a battery powered automatically arming home security system with cameras, sensors (pressure, line of sight intrusion detection, magnetic car detection in the driveway, sonic, movement, infrared etc), sms and email alerts with offsite image backup.
  • Home automation (air conditioner on/off, watering system, wild bird seed deployment, rain cover, water tank level reporting, smoke detector (inside and out) remote bushfire protection (recycling roof sprays) etc) (how: many cheap sensors and custom circuits).
  • Remote control grey-water diverted from the shower (how: waterproof remote and 80mm solenoid to divert flow).
  • Auto detect and count bird species at the bird feeder (how: webcam and image processing).

  • Automatic home brew temp system for my dad.
  • Weather cam for my mum.
  • Fun kids projects, remote control robots.

Costs:

Setting up for a Raspberry Pi and or Arduino is about $100 each, much less than gold clubs.
Raspberry Pi Board.

Post01b

Choices of Arduino boards and bits.

Post01c

Sensors are dirt cheap on ebay (about $3 each) and are often compatible with the Raspberry Pi and Arduino boards.

Post01d

I already have a Raspberry pi and Arduino and have started my quest, watch this space.