Project Hype: RPi Terminal

Over the past week or so, I’ve been ordering and collecting parts for two projects I’ve been itching to build since I went to my local barcamp. And now that I’ve learned to solder, I can dive in head first.

The first project I’m going to complete is a Raspberry Pi powered Linux laptop. This is a tiny, nintendo DS sized laptop that mainly runs terminal commands and code, but you can run video and audio on it and it’ll work just as well!

Here are the supplies, and the supply list: 

All of these came out to approximately ~$140, which my grandma generously helped me pay for. We bought from ebay, Amazon, Sparkfun, and Arrow. I had little to no knowledge about many of the things used in this project, so I’ll go over each item before writing out my to-do list.

The Raspberry Pi and I have had plenty of previous experience with each other, it’s the little computer powering the whole thing.
The Adafruit PiTFT is a little touchscreen perfect for the size of computer I’m building.
The Lithium Ion Polymer battery was a confusing buy, since I’d never heard of the term mAh before. mAh stands for milliamp hours, which measures the amount of coloumbs (electrical charge) stored inside of it. (if you do the math like I had to, it helps make sense.)
The wireless keyboard I got off of Amazon for about $10, it has bluetooth capability, but says it only works with certain operating systems. We’ll see about that.
The 5.5V to 3.3V step down converter was probably the hardest thing I had to find, but I got a good deal on eBay for one thanks to my friend Gector.
The Adafruit Powerboost 1000c is I think what helps recharge the battery that powers the RPi and the keyboard.It’s super tiny, and actually really cute.

I got most of the other stuff off of Sparkfun, two little 3-pin switches, the female USB connectors, the audio/video jack, and the wifi dongle.

As for the case, in the tutorial this guy uses cheap HDD cases. I could not find any that fit to my liking, they were all either the wrong size or shape, or they came from China and I was too impatient to purchase one from there. That’s when I was struck by a brilliant idea. Why not 3D print the case? (I know, great idea.)

I attempted to teach myself Sketchup, but quickly realized that I was too inexperienced to try and model something myself. Gector offered to help, and he made an awesome case for me that I’m getting 3D printed by one of my other friends.

Here’s a preview of the case before I print it!rpilaptopcaseOnce I get it all 3D printed I’ll post more pictures with the dimensions.

According to the tutorial, my next steps are to desolder all the components off of the RPi, Adafruit PiTFT, and wire everything up to the keyboard and battery. I gotta solder new wires onto the USB, Audio/Video, and HDMI ports, and get the MicroSD of the RPi set up.

I definitely have my work cut out for me, but once this project is physically done, I want to write an OS (operating system) for the Raspberry Pi specifically to accompany this project.

I’ll update soon as I start working on this!

 

Advertisements

not “soldiering”, saw-der-ing

Today was exciting. At my mentor fouric’s college, they held intro and intermediate workshops on many different subjects for their students, including EagleCAD, KiCAD, Raspberry Pi, Arduino, and soldering!

I just got a soldering iron for myself and for an upcoming project I’m working on, but I’ve had no previous experience in the skill. So, lo and behold, I took the intro to soldering and the intermediate soldering workshop!

Here are my results:

image5.jpeg

This is an audio amplifier, where they taught us through-hole soldering.

image4.jpeg

When I finished, I tested it out and it worked perfectly!

In the afternoon, we made a tone thingy, which controlled the treble and bass.

image1.jpeg

This taught us about surface mount soldering. Surface-mount is a pain in the butt, but it was a good workshop to go through for the experience!

Now I understand more of the whole process, and I can buy some accessories for my soldering iron at home.

I was really hesitant to solder at first since I have asthma, but the fumes didn’t bother me like I thought they would. Having a fan or ventilator at your station is a good idea though, so you’re not inhaling the smoke.

Next time, I’ll preview the new project I’m going to work on and all the parts!

Until then…

iPod Touch 3rd Generation Jailbreak

I was originally going to trade in my old iPod 3G, but none of the places I wanted to take it would give me good money for it (which is entirely understandable, it’s a ridiculously old model and hardly works anymore). I was going to take it apart to see the guts and glory, until my friend suggested that I load Linux onto it!

Now, finding a resource to do so is really hard, and I haven’t found one that works so far. But I have successfully jailbroken the iPod, which is super cool in and of itself.

Before this, I’d never heard of jailbreaking. It’s a way of removing software restrictions that Apple places on the device, so you can do things you wouldn’t usually be able to do on an un-jailbroken device. It gives you root access to the OS files and you can download things that you couldn’t normally get on the App Store.

I followed this tutorial, but thought I’d go through it here as documentation as well.

First, you plug the iPod into your computer. If you have data on it that you want to save, make sure to back it up. I did this all on OSX (reasons below).

Here are all the disclaimers and warnings from that tutorial:

  • This guide is meant for iPod touch users. iPad users can check out this guide.
  • Redsn0w 0.9.12b2 supports untethered jailbreak.
  • Redsn0w 0.9.12b2 supports iPod touch 4G, iPod touch 3G running on iOS 5.1.1.
  • Please ensure your iPod touch is on iOS 5.1.1 (Settings –> General –> About –> Version should be 5.1.1) before proceeding.
  • Please note that jailbreaking your iPod touch may void your warranty and hence proceed with caution and at your own risk.
  • Please do not forget to backup your iPod touch before you proceed.
  • Please ensure you are running latest version of iTunes.

You can download the zip file from http://www.iphonehacks.com/download-redsn0w.

I thought it was a super sketch website at first and was skeptical of whether or not to download it, but I decided otherwise. After unzipping it, double click on the application. It looks something like this:

img_4887.jpg

If the iPod is connected, you should see that redsnow recognizes it at the bottom. Click on “jailbreak and install cydia”, and the process should complete in little time!

Make sure to wait for the iPod to reboot before unplugging it. Then search for Cydia to appear in the apps (you can use search to find it), then wait a little longer for a second reboot before unplugging and using. You should be all set!

Later! o7

Dakboard, Physics, and Music

As September is coming to a close and pumpkin spice everything is settling into the Northwest, I’ve been reorganizing my projects, working a new job, doing schoolwork, and starting the long road of applying to college.

Since I saw you last, I started and finished a job renting out instruments to kids and their parents for the school year. I now have a plethora of basic knowledge about all the band and orchestra instruments.

Physics has started, and it’s a blast. We’ve honed in on some of the projects we’ll be making this year in class, I’ll be sure to write posts about them if I remember to take pictures. We’ll be making a Reuben’s tube, a 2D Reuben’s tube, a sand pendulum, and we’re going to forge a sword! Very exciting and science-y things.

In mid-September, I was hired to build a Dakboard, a digital wall hanging that acts as a calendar, picture display, clock, reminder board, and weather station all at once. I’ve gotten all the tech ready to go, we’re just waiting on the monitor to finish the job. Here’s a picture of what my display looked like:

That’s my old TV that I use for Raspberry Pi, with an altered display (since the monitor will be hung vertically). I’ve changed some of the boot code to start up automatically at the Dakboard screen, rather than having to set it up every single time.

I received my new Nucleo-F042K632 in the mail, since my other one turned out to be a lemon. The linux partition on my laptop is being finnicky and won’t boot up at the moment, so I can’t play with my nucleo yet, sadly. I’ve got my friend galois, who’s at Stanford, helping me figure out why it isn’t working the way it should. Debugging…yay!

In addition to all this, I’m filling out college applications and brainstorming essays, teaching myself the mandolin (this song), and working hard on mastering Ludovico Einaudi’s Oltremare on the piano. Yikes! It’s turning out to be a busy year already, but I’ve got plans, and I can’t wait to share them with you when I start putting them to action.

Until then!

Laminar Pi + Airplay

Now that I got the Raspberry Pi 3, I could rework the tech and figure out the Airplay feature to get this fountain working!

Here are the steps I used to set up my Raspi (SD card),  install Lightshow Pi, and shairport-sync (airplay feature) on top of it:

I’d never reformatted an SD card before, so this was quite the experience.

The first step was to find a guide, and this website was very helpful.

I slipped the microSD card into my microSD card reader and plugged it into my computer, which recognized the device. (yay!)

I had to find what my computer named the usb microSD though, so in root permissions, I ran fdisk -l, which gave me this: fdisk.png

I knew my microSD was 16GB, so the second to last option, /dev/sdb, was the right one.
Next I needed to actually access it, so I did that with fdisk /dev/sdb. That command has to be run with root permission, or sudo.

You need to delete any existing partitions on the device if there were any before doing anything else. You can do that using d, which will automatically delete the default partition.

To list all the partitions you have, you can use p, which is useful to check what you’ve deleted.

After deleting the partitions, n will create the new partition we need! You can give it a number (1-4) based on your preference (if you have a favorite number or something).

newp

Using p after creating the partition shows me the new partition at the very bottom. But uh oh, I need a FAT32 type, instead of a Linux type of partition.

To change that, you use the t command. If you request so, you can list all the different types of partitions there are to choose.

fat32

The tutorial I used recommended W95 FAT32 (all on its own, no LBA), so I executed b, which reformatted it. Yay!

At the end of all that, you use w to write all the progress and finish the dealio.
The first time I did all that, I got an error in the terminal, but after some fiddling with the commands it gave me the right thing.

Next, I needed to install Raspbian, the Raspberry Pi OS. I downloaded the full version of Raspbian Jessie Desktop from the Raspberry Pi website and unzipped it.

Next thing I did was run df -h, which helped me see the device name of my SD card (it was still /dev/sdb).

Then I unmounted the SD card (so files can’t be read or written in the process of downloading an image) with umount /dev/sdb. If you still have multiple partitions, you should unmount all of them.

Next, use the terminal to copy the image to the SD card!

dd bs=1M if=/home/thallia/Desktop/2017-05-17-raspbian-jessie.img of=/dev/sdb

This command must be prefixed by sudo if you are not logged in as root. dd starts the copying, bs=1M tells the copyer what rate the memory should be transferred at.

The if= statement is where you put the path for where the image can be found. For me, it was on my desktop. The of= statement is the path of your SD card. It takes a few minutes for the process to complete, so getting up and stretching for a few minutes is a good thing to do while you wait for it to finish.

After that, your SD card should be ready to plug into your Raspberry Pi to boot!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Installing LightshowPi

Because I covered most of this in another post, I’ll keep it short so we can get to shairport-sync.

Boot into your Raspberry Pi, open a terminal, and run sudo apt-get update and sudo apt-get upgrade. These shouldn’t take too long.

After that, if you don’t have git, install it with sudo apt-get install git-core.

Next, clone the LightshowPi repository to your home directory.
git clone https://togiles@bitbucket.org/togiles/lightshowpi.git

If you have a Raspberry Pi 3 (like me) or a Pi Zero, there’s a different repository you have to clone because of some kernel issues. Here’s the instruction:
git clone https://broken2048@bitbucket.org/broken2048/lightshowpi-fork1.git

If you don’t have a Pi 3 or Zero, then don’t worry about that.

You’ll want to make sure that you have the right branch, otherwise the program won’t work as well. You can do that with cd lightshowpi, then git fetch && git checkout stable.

You should get a confirming message that you’ve been moved to the “stable” branch.

Finally, you can install the software! sudo ./install.sh will set you up with the goods. This process may take anywhere from 10 minutes to 3hrs, so be patient. After that, reboot your Pi with sudo reboot.

On the LightshowPi website, you can find links for how to set up and test your hardware, or you can check out my first setup here: LightShow Pi ~ Early Tech Behind the Laminar Fountain.
If you have any questions about my setup or how I got the music to work, feel free to contact me.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Alrighty, now to the exciting stuff! I discovered shairport-sync through the LightshowPi Google+ Community, which is a very helpful place if you run into trouble setting up any of this stuff.

Here you can find the GitHub repository for shairport-sync and follow the instructions to set it up. I’ll walk you through what I did to set mine up.

First, you have to make sure you install all of the files and packages needed for it to work. This includes (for my setup):

sudo apt-get install build-essential git xmltoman
sudo apt-get install autoconf automake libtool libdaemon-dev libpopt-dev libconfig-dev
sudo apt-get install libasound2-dev
sudo apt-get install avahi-daemon libavahi-client-dev
sudo apt-get install libssl-dev

Next, you need to clone the repository to your Pi, using:
git clone https://github.com/mikebrady/shairport-sync.git

Now, cd into shairport-sync and run autoconf -i -f. This step may take a little time.

This next part was a little tricky for me to understand what was going on. We’re writing the configuration file with the stuff we want so shairport will work the right way. Because I’m only using shairport-sync for a simple technology, I didn’t have to use many configurations.

./configure --sysconfdir=/etc --with-alsa --with-avahi --with-ssl=openssl --with-systemd --with-stdout

./configure is the filename, I believe, while --sysconfdir=/etc is where the file will be within the shairport directory.
--with-alsa [includes the ALSA backend module to audio to be output through the Advanced Linux Sound Architecture (ALSA) system directly. This is recommended for highest quality.] (taken from the github description)
--with-avahi [Avahi is a widely-used system-wide zero-configuration networking (zeroconf) service — it may already be in your system.]
--with-ssl=openssl [for encryption and related utilities using either OpenSSL, mbed TLS or PolarSSL.]
--with-systemd this command has to do with the particular system you have. You can use man init to find out whether you need to use systemd or systemv.
--with-stdout [include an optional backend module to enable raw audio to be output through standard output (stdout).]

After executing that command, you can run make. When make is finished, install shairport-sync with sudo make install. This can take a little time as well, so get up and stretch!

Now comes some more fun. We’re going to edit some more configuration files, first from the shairport-sync repository. Make sure you cd into shairport-sync so you can access them.

First, we’re going to run sudo nano /etc/shairport-sync.conf. There will be a lot of text. Do not freak out like I did and immediately close the document.

As long as you can find the general function at the top and the alsa function in the middle of the file, you should be fine. In the general function, you’ll see a list of commented out functions. You can give your Airplay feature a password if you don’t want anyone out of the blue using it, but I didn’t set that up.

At the top of the file, there’s a line that looks like: # name "%H"
You’ll want to erase the hash, and fill in the quotation marks what name you want to appear on the Airplay menu. I named mine “Laminar Pi”, for the fountain purposes.

Now go down to the alsa function, and find the line in the file that reads # output device: "hw:"

In this line, you can choose whether you want the output sound to be HDMI, or headphones. I made mine headphones, because I have a 3.5mm jack connected from the Pi to a portable bluetooth speaker. It makes for easy sound testing. Remember to delete the hash so it’s used in the setup.
That’s all I modified in the shairport-sync config file, but if you find yourself in a more complicated situation, the github instructions have plenty of information and examples for you to figure it out.

To save the config file, Ctrl-x will do the job, y to agree to save the file, and enter to seal the deal.

Working with the pi, there’s a special thing you can add to the Raspberry Pi boot file to make the sound clearer. To get to that, enter sudo nano /boot/config.txt.

At the very bottom of that file, add the line: audio_pwn_mode=2

Ctrl-x will save and get you outta there, and that section of shairport-sync is finished! Only a few more steps left to go.

Now, cd into your lightshowpi directory, then into the config directory. The path looks like this: cd lightshowpi/config
Next, run sudo nano defaults.cfg

This is the configuration file for LightshowPi, where we can alter how things will outpstrut and work together.
If you scroll down past the information about the GPIO pins, shortly after you’ll come to a section about playlist modes. You can skip a little farther down to the stream-in section.

There’s a line that looks like this: # mode = stream-in
You’ll want to uncomment that (delete the hash). Go down a few lines to:
stream_command_string = sudo mpg123 --stdout http://193.34.51.115:80 And put a hash in front of it to comment it out. Then go down a few more lines to:
# stream_command_string = shairport-sync -v -o stdout
And uncomment (delete the hash) to activate shairport-sync.

Use Ctrl-x to save the file and exit nano, and you should be ready to start up the hardware!
Assuming you’ve set up and tested your hardware, cd .. out of the config directory, but stay in the LightshowPi directory.

To start the software and give off the Airplay signal, run:
sudo python py/synchronized_lights.py

Hook your phone up to the Pi Airplay signal, and your lights should start up to whatever sound you play through your phone!
Please contact me if you have any questions.

Cheers!

{thallia}