Make a LED blink using the Chip computer.
The Chip is a low-cost computing platform similar to the Raspbery Pi (Check in the Comments section for a discussion about the similarities and differences between the two). The Chip has built in wifi and runs linux. Since the Chip runs linux (and since there are good libraries), we can write all of our code in Python.
Next Thing Co. (NTC), the makers of the chip have created a great documentation page, that they will be adding to as the Chip and its software and libraries evolve. Check it out here. We also have a couple of NTC's Pocket Chips, which are a cool add on for the chip that gives you a portable, battery powered linux box with a built in screen. If you want to play around with one, talk to us.
Since the chip runs linux, we will be interacting with its command line quite a bit. If you have never used a command line (or terminal in Mac), check out this series of games that teaches you important command line skills: http://overthewire.org/wargames/.
ip addr show wlan0
. The ip address will be on the "inet"
line. Next, on a computer connected to the same network as the chip you can ssh using the program of your choice. For PC,
check out Putty. For Mac, the ssh command is the easiest. Just open a terminal and type
ssh user_name@ip_address
(ex: ssh chip@192.168.1.12
). No matter how you ssh in,
you will need to use the username "chip" and the password "chip". If you plan to leave the chip connected to the internet
for extended periods of time, make sure to change this default password, or you may get hacked.
sudo apt-get update
sudo apt-get install python-smbus
git clone https://github.com/xtacocorex/Adafruit_Python_GPIO.git
cd Adafruit_Python_GPIO
sudo python3 setup.py install
nano your_file.py
in a terminal and it will open your_file.py (or make it if it doesn't exist).
Nano is a basic command line editor that acts a lot like a regular text editor. To save your file, type control-o
and thne hit enter to confirm the file name. Other commands are listed on the bottom of the screen (hit control and then
the letter listed to execute the command).scp source_file destination_folder
. It will copy the
source_file to destination_folder. For easy reference, here are the two
commands you will most likely be using (for reference, path is just the "address" of something in your file system. For
example, if you want a file called my_file.py in chip's home directory, the path would be ~/my_file.py):
scp {path_to_file_on computer} chip@{your_chips_ip}:{path_to_folder_on_chip}
scp my_file.py chip@192.168.1.8:~/
moves my_file.py from current directory on your computer
to the chip's home directory.
scp chip@{your_chips_ip}:{path_to_file_on_chip} {path_to_folder_on_computer}
scp chip@192.168.1.8:~/my_file.py .
moves my_file.py in chip's home directory
to the current directory on your computer.
sudo python3 chip-blink.py
to make the led blink.The Chip and Raspberry Pi are both small computers that run Linux on an ARM processor. However, they both have advantages and disadvantages that you should take into account when deciding on which to use in your project. First up, cost: the Raspberry Pi is $30-$35 while the chip is only $9. You can borrow both for free from either IDeATe or the class supplies, but the cheaper price means that frying a board on accident has less of a consequence. Next, the camera: the Raspberry Pi has a great camera module that your can also borrow from IDeATe that makes computer vision fast and relatively painless. The chip does not have this. Finally, advantages for phys comp projects: The Chip is smaller than the Raspberry Pi. This, allong with the Chip's symetric headers make it nicer for embedding into a phys comp project than a Raspberry Pi. Additionally, the Chip has a plug for a LiPo battery, and it handles all of the charging for you, making adding a battery to your project fairly easy.