Difference between revisions of "SimpleBot Initial Software Configuration"

From Open Hardware Miniconf
Jump to: navigation, search
(Draft SW page)
 
(Addendum: Creating your own SD image)
 
(30 intermediate revisions by 3 users not shown)
Line 1: Line 1:
The Simple Bot software is installed on the Raspberry Pi. If you are attending the workshop you will be provided with a pre-installed SD card to use. This page will help you with any additional configuration that is required and allow you to create your own SD image if you need to later.
+
The SimpleBot software is installed on the Raspberry Pi. If you are attending the workshop you will be provided with a pre-installed SD card to use. This page will help you with any additional configuration that is required and allow you to create your own SD image if you need to later.
  
= Changing the default configuration =
+
== Changing the default configuration ==
 +
 
 +
The SD card supplied in the kit has Raspbian pre-installed with a default configuration. Before booting your SimpleBot for the first time, you should customise the configuration by editing a configuration file on the card using your computer:
  
 
  1. Insert the Micro SD card into a laptop or workstation using the provided adaptor
 
  1. Insert the Micro SD card into a laptop or workstation using the provided adaptor
 
  2. When the image is mounted open the file `machine.local` in a text editor
 
  2. When the image is mounted open the file `machine.local` in a text editor
 
  3. Edit the file as explained by the comments in the file.
 
  3. Edit the file as explained by the comments in the file.
  4. Save the file and unmount the SD card and then remove it
+
  4. Save the file and unmount the SD card and then remove it.
  5. Insert the card into the Raspberry Pi and power up
+
  5. Insert the card into the Raspberry Pi and power up.
 +
 
 +
The Raspberry Pi will then:
 +
 
 +
1. Boot from the SD card.
 +
2. Read the contents of the `machine.local` file.
 +
3. Check for a variable that sets `wifichanged=1` (if the variable is not set, it will continue booting as normal)
 +
4. Apply the configuration settings it finds in `machine.local`.
 +
5. Rewrite `machine.local` to un-set the wifichanged flag.
 +
6. Reboot, which will proceed as normal with the updated settings.
 +
 
 +
This process allows you to modify the network settings of your SimpleBot at any time simply by repeating the process above, avoiding the need for a screen, serial console, or working network connection to change the configuration.
 +
 
 +
The SimpleBot has Avahi enabled, so you can then SSH to your SimpleBot from any machine that has mDNS/DNS-SD support such as GNU/Linux with Avahi installed or MacOS with Bonjour. For example, if you set the hostname to `jons-simplebot` you could then SSH to `jons-simplebot.local`.
 +
 
 +
By default the Miniconf image will use a hostname based on the unique serial number of the ARM CPU, to ensure that it comes up on the network with a unique hostname. Change the hostname to a static value that you know.
 +
 
 +
Login is the default Raspbian values: "pi" and "raspberry". Once logged in the first time you can change them to suit yourself.
 +
 
 +
 
 +
[[SimpleBot-Assembly|Back to SimpleBot Assembly Overview]]
  
By default the Miniconf image will use a hostname based on the unique serial number of the ARM CPU.
+
----
  
 +
==Addendum: Creating your own SD image ==
  
= Creating your own SD image =
+
'''This step is not necessary if you are using the SD card provided in the kit. These instructions are provided for reference only, to explain how the supplied SD card was created.'''
  
You can create a suitable development kit as follows:
+
If you want to set up your own Raspbian environment to suit the SimpleBot, you can recreate the steps used to make the provided SimpleBot image as follows:
  
  1. Install a Raspberry Pi Raspian Image on your SD by following [http://www.raspberrypi.org/documentation/installation/installing-images/README.md these] instructions.
+
  1. Install a Raspberry Pi Raspbian Image on your SD by following [http://www.raspberrypi.org/documentation/installation/installing-images/README.md these] instructions.
  2. Boot your raspberry Pi and login as user `pi` with password `raspberry`
+
  2. Boot your Raspberry Pi and login as user `pi` with password `raspberry`
 
  3. Make sure your keyboard is correctly configured and you have internet access
 
  3. Make sure your keyboard is correctly configured and you have internet access
 
  4. Run the following command
 
  4. Run the following command
    bash <(wget https://   #todo)
+
          script initialsetup -c "bash <(wget -O - https://tinyurl.com/RasPiIoT-1)"
 +
    This will create a log in the file initialsetup. At the end of the process the Pi will reboot
 +
5. Login again
 +
6. Run the following command
 +
          script packagesetup -c "bash <(wget -O - https://tinyurl.com/RasPiIoT-2)"
 +
    This will create a log in the file packagesetup. At the end of the process the Pi will reboot.
 +
    NB When asked you should 'N' to ROS install unless you know that you really need it.
 +
 
 +
There are more details at https://github.com/alecthegeek/CCHS_Raspian_for_IoT
 +
 
 +
'''Compiling the driver for the RT7601 WiFi chipset'''
 +
 
 +
The specific drivers you require will depend on the WiFi dongle that you use. The dongles provided in the kit use the RT7601 chipset, which is not supported by default under Raspbian. Follow these steps to compile the driver. These steps have already been done on the image provided in the kit.
 +
 
 +
### Prepare kernel source
 +
sudo su
 +
cd /usr/src
 +
git clone --depth 1 https://github.com/raspberrypi/linux.git #downloads about 132MB
 +
ln -s /usr/src/linux /lib/modules/`uname -r`/build
 +
cd /lib/modules/`uname -r`/build
 +
make mrproper
 +
gzip -dc /proc/config.gz > .config
 +
make modules_prepare
 +
wget https://github.com/raspberrypi/firmware/raw/master/extra/Module.symvers
 +
exit
 +
### Fetch driver source
 +
cd ~
 +
mkdir wireless-drivers
 +
cd wireless-drivers
 +
wget https://dl.dropboxusercontent.com/u/11876059/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913.tar.gz
 +
tar zxf DPO_MT7601U_LinuxSTA_3.0.0.4_20130913.tar.gz
 +
cd DPO_MT7601U_LinuxSTA_3.0.0.4_20130913
 +
### Make and install driver
 +
make
 +
sudo make install
 +
 
 +
To configure it as a wireless client, edit /etc/network/interfaces and add this to the end:
 +
 
 +
auto ra0
 +
allow-hotplug ra0
 +
iface ra0 inet dhcp
 +
wpa-ssid "YOUR SSID"
 +
wpa-psk "YOUR PASSWORD"
 +
 
 +
Finally, reboot and it'll come up with the wireless interface enabled:
 +
 
 +
sudo reboot
 +
 
 +
'''Duplicating an existing image on a Mac'''
 +
diskutil list # get list of disks and find number of specific disk
 +
diskutil unmountDisk /dev/disk2 # Substitute the number of your SD card here and below!
 +
time sudo dd bs=1m if=simplebotimage2.img of=/dev/disk2 && say done
 +
diskutil unmountDisk /dev/disk2
 +
diskutil eject /dev/disk2
 +
 
 +
= Next steps =
 +
 
 +
Once you're up and running you can try the [[SimpleBot NodeBots Examples]].
 +
 
 +
= Other Raspberry Pi networking resources =
 +
 
 +
http://elinux.org/RPi_USB_Wi-Fi_Adapters
 +
 
 +
http://www.maketecheasier.com/set-up-raspberry-pi-as-wireless-access-point/
 +
 
 +
http://va3paw.com/2014/03/16/hsmm-mesh-on-raspberry-pi/

Latest revision as of 10:24, 1 February 2015

The SimpleBot software is installed on the Raspberry Pi. If you are attending the workshop you will be provided with a pre-installed SD card to use. This page will help you with any additional configuration that is required and allow you to create your own SD image if you need to later.

Changing the default configuration

The SD card supplied in the kit has Raspbian pre-installed with a default configuration. Before booting your SimpleBot for the first time, you should customise the configuration by editing a configuration file on the card using your computer:

1. Insert the Micro SD card into a laptop or workstation using the provided adaptor
2. When the image is mounted open the file `machine.local` in a text editor
3. Edit the file as explained by the comments in the file.
4. Save the file and unmount the SD card and then remove it.
5. Insert the card into the Raspberry Pi and power up.

The Raspberry Pi will then:

1. Boot from the SD card.
2. Read the contents of the `machine.local` file.
3. Check for a variable that sets `wifichanged=1` (if the variable is not set, it will continue booting as normal)
4. Apply the configuration settings it finds in `machine.local`.
5. Rewrite `machine.local` to un-set the wifichanged flag.
6. Reboot, which will proceed as normal with the updated settings.

This process allows you to modify the network settings of your SimpleBot at any time simply by repeating the process above, avoiding the need for a screen, serial console, or working network connection to change the configuration.

The SimpleBot has Avahi enabled, so you can then SSH to your SimpleBot from any machine that has mDNS/DNS-SD support such as GNU/Linux with Avahi installed or MacOS with Bonjour. For example, if you set the hostname to `jons-simplebot` you could then SSH to `jons-simplebot.local`.

By default the Miniconf image will use a hostname based on the unique serial number of the ARM CPU, to ensure that it comes up on the network with a unique hostname. Change the hostname to a static value that you know.

Login is the default Raspbian values: "pi" and "raspberry". Once logged in the first time you can change them to suit yourself.


Back to SimpleBot Assembly Overview


Addendum: Creating your own SD image

This step is not necessary if you are using the SD card provided in the kit. These instructions are provided for reference only, to explain how the supplied SD card was created.

If you want to set up your own Raspbian environment to suit the SimpleBot, you can recreate the steps used to make the provided SimpleBot image as follows:

1. Install a Raspberry Pi Raspbian Image on your SD by following these instructions.
2. Boot your Raspberry Pi and login as user `pi` with password `raspberry`
3. Make sure your keyboard is correctly configured and you have internet access
4. Run the following command
         script initialsetup -c "bash <(wget -O - https://tinyurl.com/RasPiIoT-1)"
   This will create a log in the file initialsetup. At the end of the process the Pi will reboot
5. Login again
6. Run the following command
         script packagesetup -c "bash <(wget -O - https://tinyurl.com/RasPiIoT-2)"
   This will create a log in the file packagesetup. At the end of the process the Pi will reboot.
   NB When asked you should 'N' to ROS install unless you know that you really need it.

There are more details at https://github.com/alecthegeek/CCHS_Raspian_for_IoT

Compiling the driver for the RT7601 WiFi chipset

The specific drivers you require will depend on the WiFi dongle that you use. The dongles provided in the kit use the RT7601 chipset, which is not supported by default under Raspbian. Follow these steps to compile the driver. These steps have already been done on the image provided in the kit.

### Prepare kernel source
sudo su
cd /usr/src
git clone --depth 1 https://github.com/raspberrypi/linux.git #downloads about 132MB
ln -s /usr/src/linux /lib/modules/`uname -r`/build
cd /lib/modules/`uname -r`/build
make mrproper
gzip -dc /proc/config.gz > .config
make modules_prepare
wget https://github.com/raspberrypi/firmware/raw/master/extra/Module.symvers
exit
### Fetch driver source
cd ~
mkdir wireless-drivers
cd wireless-drivers
wget https://dl.dropboxusercontent.com/u/11876059/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913.tar.gz
tar zxf DPO_MT7601U_LinuxSTA_3.0.0.4_20130913.tar.gz
cd DPO_MT7601U_LinuxSTA_3.0.0.4_20130913
### Make and install driver
make
sudo make install

To configure it as a wireless client, edit /etc/network/interfaces and add this to the end:

auto ra0
allow-hotplug ra0
iface ra0 inet dhcp
wpa-ssid "YOUR SSID"
wpa-psk "YOUR PASSWORD"

Finally, reboot and it'll come up with the wireless interface enabled:

sudo reboot

Duplicating an existing image on a Mac

diskutil list # get list of disks and find number of specific disk
diskutil unmountDisk /dev/disk2 # Substitute the number of your SD card here and below!
time sudo dd bs=1m if=simplebotimage2.img of=/dev/disk2 && say done
diskutil unmountDisk /dev/disk2
diskutil eject /dev/disk2

Next steps

Once you're up and running you can try the SimpleBot NodeBots Examples.

Other Raspberry Pi networking resources

http://elinux.org/RPi_USB_Wi-Fi_Adapters

http://www.maketecheasier.com/set-up-raspberry-pi-as-wireless-access-point/

http://va3paw.com/2014/03/16/hsmm-mesh-on-raspberry-pi/