Other Stuff

MySQL for the Pi is very easy, one command:

sudo apt-get install mysql-server

granting access to remote clients:

mysql> CREATE USER 'MY_USERNAME'@'localhost' IDENTIFIED BY 'MY_PASSWORD'
mysql> GRANT ALL PRIVILEGES ON 'MY_DATABASE'.* TO 'MY_USERNAME'@'12.34.56.78' IDENTIFIED BY 'MY_PASSWORD';

I hate the fact that I have to tie up one of my monitors and both of the Rpi’s USB ports for a keyboard and mouse, so I wanted to remote shell into it. While it’s not enabled out of the box, it turns out it’s quite easy to do.

First you have to edit the ethernet interfaces config file. The Pi only has one ethernet port so it’s very simple.

root@raspberrypi:~# sudo vi /etc/network/interfaces

And it should look like this, more or less:

auto lo

iface lo inet loopback
iface eth0 inet dhcp

Comment out the dhcp line and add a new one according to what your network numbers are. I’m at 192.168.xxx.xxx with about five devices getting IPs from my DSL modem. (If you don’t know what I mean here, you probably shouldn’t be doing this)

#iface eth0 inet dhcp
iface eth0 inet static
  address 192.168.1.200
  netmask 255.255.255.0
  network 192.168.1.0
  broadcast 192.168.1.255
  gateway 192.168.1.1

Now edit the name servers, add the google ones, I don’t really know if you need these on a local net but it works for me and they are probably very fast so what the hell, right? Keep your original address, it should be your gateway.

root@raspberrypi:~# sudo vi /etc/resolv.conf

It should look like this before you edit it, or mine did, I’m on a small 192 home network with my dsl modem doing all the dhcp

nameserver 192.168.2.1

Add these two lines to the one already there:

nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 192.168.2.1

Now start and stop the network:

root@raspberrypi:~# sudo service networking stop
root@raspberrypi:~# sudo service networking start

Enable SSH on startup so you can log into the Pi with Putty. First you will need to generate the certificate, I just hit enter for all the choices since I’m not really all that concerned with security.

ssh-keygen

Now start up the ssh service and set it so it always starts at boot up.

sudo service ssh start
sudo update-rc.d ssh defaults

Now shutdown everything, cycle power and reboot.

root@raspberrypi:~# sudo shutdown -h now

On your PC, if you don’t already have it, install putty, then run it.
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

Put in the static address of the Pi, in this case it’s 192.168.2.200 and connect. Enter the normal user and password and you are in. You can also now use this with xlaunch to get to the Rpi’s xwindow interface. Although I don’t think I’ll have much use for that personally, it is kinda neat so I’ll post another tutorial for that soon.

I now have my Raspberry Pi coming up to the windowed desktop- I do think I’ll change that to just boot to the shell. I’m planning on doing some experimentation with a couple of things- a motor controller, a servo controller, position sensors, an rfid reader and a video camera.

Since the Pi runs Linux, it is not precise enough to actually bit bang things out, but since I’m interfacing smart peripherials, that shouldn’t be a problem. The RFID chip has a serial output for the id so I should be ok on that one. The other modules have USB serial interfaces so they should be fine.

So WHY do I want to do all this? Because I’m insane, probably! But aside from that I have several goals for these modules, one is an automated coal conveyor and flood loader for my (planned) large scale model railroad, and on the other end a control situation for a working power plant to burn the coal and power a steam engine. (TVR1A) The steam engine will then (help) charge my bank of deep cycle marine batteries (also fed by solar panels) which I will use to power the entire railroad (and towns along the way).

Later, I want to do a modern sort of paper plant (Georgia Pacific) and do a working gantry crane to load an intermodal transport unit train. At the other end I’ll have a trucking company that unloads the shipping containers. Not quite as cool as a working coal mine and power plant but some automation to play with.

The last industry will be a brewery (of course!). Not much in terms of automation but I can collect neat refrigerator cars eh? haha.

The final thing will be to install a RFID and radio control system, with a reader in the locomotive (plus a camera and sensors for speed and amperage used) and RFID readers in the switching yards and such to id the cars. I’d like to set the whole thing up so I can select a ‘scenario’ from my tablet, and have the computer route the locomotives, build the trains, load the cars and deliver the goods. Geekorama!

Oh yeah, at some point I want a live steam locomotive, I’ll use that as a ‘heritage’ unit to haul ‘tourists’ on old ‘restored’ period passenger cars. Like this one: http://accucraft.com/modelc/G721-01-C.htm

Sounds like about 10 years worth of work, just in time for retirement, assuming I live that long 😉

Raspberry Pi

This is a pretty cool little Single Board Computer I’ve been pondering on. I don’t have one yet but at $35 its pretty cheap and best of all, it runs Linux! Has python installed too, can’t beat that! I was thinking of interfacing it into an RFI reader to do model train computer control…

 
Here it is with a paper clip for a size comparison-
 

 
Here is a link that shows all the components
Raspberry Pi Components