The Beta 01 ships with a Raspberry Pi configured to run serial-port-json-server for use with chilipeppr.com. Basically, this allows you to put the Beta 01 on your home network using an Ethernet cable, and then connect to it with Chilipeppr from any computer at home.
The Raspberry Pi boots from an SD card. Unfortunately it seems that the SD card can occasionally become corrupt, especially if the Raspberry Pi is switched off without doing a graceful shutdown. This has happened to me once so far.
The Raspberry Pi will request an IP address from your network. You will need to know this IP for use in Chilipeppr and also to connect to the Pi to do any other configuration or to shut it down gracefully.
You can scan for the IP using a network scanning app such as LanScan for the Mac. Chilipeppr also has a scanning feature under the Serial Port section, although it only scans for the default port number (8989), not the one Printrbot configured (8000).
I found it convenient to configure my router to always give the Pi the same IP address.
So, how do you shut down the Raspberry Pi with the least chance of causing problems with the SD card? Unless you configure an alternate way to do it, you need to:
ssh pi@10.0.123.30
(the default password is "raspberry")
sudo shutdown -h now
Here are the steps I used to get my Pi going again after the SD card got corrupted. You need a computer with an SD card reader for this to work:
touch /Volumes/boot/ssh
ssh pi@10.0.123.30
sudo raspi-config
curl -O
http://chilipeppr.com/downloads/v1.86/serial-port-json-server-1.86_linux_arm.tar.gzgunzip
serial-port-json-server-1.86_linux_arm.tar.gztar -xvf
serial-port-json-server-1.86_linux_arm.tarcd serial-port-json-server
./serial-port-json-server &
This works, but you would need to do step 4 and 6 every time you power on the Pi. To get it to start automatically, do the following:
Setting serial-port-json-server to start at power up
First, create a file at /etc/init.d/cnc by typing:
sudo pico /etc/init.d/cnc
which will bring up an editor. Copy and paste the following and save the file (Control-o, then Control-x):
#! /bin/sh
# /etc/init.d/cnc
### BEGIN INIT INFO
# Provides: cnc
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Simple script to start cnc server
# Description: A simple script to start the chilipeppr json server.
### END INIT INFO
# If you want a command to always run, put it here
# Carry out specific functions when asked to by the system
case "$1" in
start)
echo "Starting cnc"
# run application you want to start
/home/pi/serial-port-json-server_linux_arm/
serial-port-json-server -regex=ttyUSB* &
;;
stop)
echo "Stopping cnc"
# kill application you want to stop
killall serial-port-json-server
;;
*)
echo "Usage: /etc/init.d/cnc {start|stop}"
exit 1
;;
esac
exit 0
Now make the script executable:
sudo chmod +x /etc/init.d/cnc
And finally, to set it to run at startup, type:
sudo update-rc.d cnc defaults
You could reboot now to see if it works by typing:
sudo shutdown -r now
Or, you can run it directly from the command line with:
sudo /etc/init.d/cnc start
If for some reason in the future you don't want it to start at boot, you can remove it with:
sudo update-rc.d -f cnc remove