ArkenPi ~ the touchscreen (Adafruit PiTFT Plus 3.5”)

After hours of errors, outdated repos, and problem solving, I have finally gotten ArkenPi’s screen working!


Here’s how I did it:

First, install the most recent form of Raspbian. Turns out, the kernel is already updated to work with the Adafruit PiTFT 3.5″ PLUS, so you don’t have to download it from the outdated, unauthorized apt.adafruit.com repositories (thank goodness).

Boot into your Raspbian OS and make sure you’re connected to a network, either way of ethernet, wifi adapter, or wirelessly (if you have a Pi 3). Go ahead and change your root password with passwd, then get into the raspberry pi configuration station.

Enter raspi-config into your terminal, and here’s what we’re gonna do:
1) Expand the filesystem
2) Change the default Pi account password
3) Enable Boot to Desktop (already signed in)
4) Enable Wait for Network at Boot
5) If you so wish, change your timezone
6) Set your hostname (the name of your pi)
7) Enable SSH (very handy if you run into errors)

Then select finish, reboot, and you’ll be set to go!

Once your Pi has rebooted, login as root sudo -s, and head back to raspi-config.
Head to Update, and update all the raspberry pi config settings. After that you’re free to exit.

Next, in a terminal, run apt-get update && apt-get -y upgrade.
Then you’re going to download some code from github.

Use wget https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source -O /usr/bin/rpi-source to download it and put it somewhere.
We’re going to use chmod to make it executable like this:
chmod +x /usr/bin/rpi-source
then /usr/bin/rpi-source -q --tag-update.

After that, the guide I linked to in the previous post told me to wget some more driver code, but that code was outdated and removed from the repository. I didn’t really understand what the code was for, but I’m glad I looked.

The code was to initialize a GPIO pin as a power switch. That was a great idea and all, but I have another way of doing it hardware-wise which was much easier to figure out.

Next, we’re going to cd back to the Home directory and install the adafruit helper:
wget https://github.com/adafruit/Adafruit-PiTFT-Helper/raw/master/adafruit-pitft-helper
chmod +x ./adafruit-pitft-helper
and to run it, ./adafruit-pitft-helper -t 35r
Now, as shown above, the -t stands for type, and then you specify which PiTFT you have for your Raspberry Pi. Since mine was the 3.5″ Resistive touchscreen, 35r was my choice.

Finally, you can run shutdown -h now, set up the PiTFT on your RPi, and reboot to see it working!

Now, if you were like me, a few weird things happened when I started up. First, the Pi was still outputting the desktop onto my HDMI console, and only part of the boot process was actually showing up on the PiTFT.

In my config files, I made sure /etc/X11/xorg.conf.d/99-fbdev.conf had the line /dev/fb1 in it (wherever it was), because fb1 is the PiTFT output.

To fix this, I pressed Ctrl+Alt+*all the Fx keys*. Eventually one of the screens shifted to a login screen to my Pi, but logging in didn’t work. I would enter the right password, the screen would turn black with an underscore in the top left corner, then it would take me back to the login screen.

Turns out there’s a pesky little file you’ve got to delete:

sudo rm /home/pi/.XauthorityOnce I deleted that and rebooted, my PiTFT successfully displayed my desktop screen. Woohoo!!

Many times if I goofed and couldn’t access the desktop because I accidentally enabled boot-to-console, I would SSH into my raspberry pi. I must say I love SSH, I could do it all day. It’s such a cool thing to do. 😀

The only thing I’m struggling with now is actually getting the touchscreen calibrated the right way, which isn’t working.
I’m taking a break from the software side of this project to get oriented with how I’m going to put it all together in my 3D printed case, which is almost done. We’re getting to the exciting part of this now!

Advertisements

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!

 

LightShow Pi ~ Early Tech Behind the Laminar Fountain

Today was awesome. I made huge progress in the tech side of the laminar fountain project.

I found a software called LightShow Pi, which was originally created for Christmas light shows, but many people have used it for smaller projects of their own.

The first step after getting an LED to flash with the Pi was to install the software. First I had to update all the packages ‘n stuff on my system with sudo apt-get update and sudo apt-get upgrade. That took around thirty-minutes to fully install.

Next I cloned the LightShow Pi repository off of GitHub: cd ~
git clone https://togiles@bitbucket.org/togiles/lightshowpi.git

And change to the stable branch of code: cd lightshowpi
git fetch && git checkout stable

Once completed, you install the stuff! Just make sure you’re in the “lightshowpi” directory. Then you can run: sudo ./install.sh.

This part tripped me up, because it took over two hours. Everything installed fine until it started running the line Installing rpi-audio-levels.... My Pi got really hot and stuck, so I rebooted and tried to reinstall, but it kept getting stuck. img_4697

I left it for about 2hrs (with many checks in between) before seeing that it had finished. Then I rebooted as the instructions said.

After that, the next step would be to build the actual LED setup on my breadboard. Initially I tried following this link, but only for a generic idea of how to wire the breadboard. I didn’t have a breakout board, so I went back to basics and made a simple circuit like the one in my last post, but with eight LEDs instead of just one. Next I attached the pins of the Raspberry Pi (3.3V and Ground) to the breadboard:img_4706

Next step was to figure out what GPIO pins the Pi was using for the project, the google doc said GPIOs 0-7. I used this chart to locate them.

img_4708

img_4712

Lovely mess, ain’t it? The pins are attached to their respective LED, and each LED is also connected to ground.

Finally, I could plug it all in and test this thang! To test it and make sure you have all the right channels, you run sudo python py/hardware_controller.py --state=flash

Each LED blinked twice, and I knew I had the right setup.

To play music, there were a few more steps I had to take. First, to make sure I had audio output, I connected my audio jack to a portable speaker I had (that’s the blue thing). Next I had to actually find the music. Using a Lexar USB, I pulled some mp3 files from my music collection and put them on the USB, which I connected to the Pi. Then using the command sudo python py/synchronized_lights.py --file=/home/pi/Desktop/Music/singles/shelter.mp3

With --file=, you continue the command with the file path of where your music is located.

After all that work, I got this wonderful result. https://youtu.be/oHTUvcA52Bo

Next step, to try it with RGB LEDs. Until next time!