Subscribe to Blog via Email
I make some odd New Year’s Resolutions and mine for 2017 was to add some smart home solutions to our home that made sense. I’ve seen what can happen if you don’t plan these types of projects out well, (looking at you, Mark Rittman!) and the insanity that ensues!
The following smart home goals were made:
The following technology would be used to accomplish the goals:
The Echo Dot is the newest member of the Alexa family. They are small, powerful and don’t require a full-sized echo to function. I chose three due to the size of our house- two for the main floor and one for upstairs.
I chose the first four products due to reviews and ease of use. Items 2-3 all are Alexa compatible and can communicate with the Echo Dot easily. All of the smart home products can be controlled with either the Alexa voice app or mobile apps that can be downloaded on your phone. As the Echo Dot has a smaller footprint, it’s easier to mount on the wall or side of a cabinet, giving back valuable counter space.
For my lighting solution, I stuck with Phillips Hue, which only drawback is that it requires a bridge to work. I was easily able to connect the Phillips bridge to then control all the lights, which then was easy to add to the Alexa “Smart Home Devices” app on my phone. Each of the lights can be grouped as necessary, (let’s say the family room light has three bulbs, so I group them and name the group “Family Room”.) which make configuration and turning on/off easier. A bridge is required in close proximity to each location, so I could access the bulbs. One bridge was connected to the kitchen Echo Dot to control main floor lights and then one upstairs to control the upstairs lights.
The library has a single lamp that made more sense, (and less expensive) to connect via a TP-link smart plug.
The second smart plug was added upstairs to the towel warmer that I got Tim and me for Xmas. Often, we’d get into the shower and forget to turn it on, but now we can just say, “Alexa, turn on towel warmer”, then that goes a long way! It uses the same outlet as my hair straightener, so the idea that if I leave home after forgetting to unplug it, I can just shut it off in an app in my phone is pretty cool. TP-Link Smart plugs are a great way to smart home anything in your house, which comes to our tea kettle….
Yes, we do love our electric tea kettle and it works really well on it’s own, but what if we could just tell it to turn on from the other room? The steps to do this are simple-
If you don’t believe me, here’s proof, (watch and weep, Mark… :))
Now a number of you might be saying, “Why didn’t you choose a Nest thermostat?” Its true that Nest has the market cornered pretty impressively, but the price point is relatively high and the product isn’t that revolutionary. I did some research and actually found that the Ecobee Lite 3 received some great reviews and the price was significantly lower.
Music is a given and built in with the Echo Dot. If you have a Spotify account, then you can get your music directly from the Dot and all you need for some quality sound is to add a speaker, bluetooth or audio jack connected. You do have to have a premium Spotify account and I think the only thing Spotify is missing an easy way from the Alexa app to upgrade your account when you link it, (hint, hint!) but there’s also a lot of other streaming options if you don’t want to use Spotify.
Now for my fun project- the TV. We love our Roku and I’ve decided this is where I get to play with my Raspberry Pi and get it going with Alexa. There’s already the project and the code, so I just need to duplicate and enhance with the pieces that I’m interested in. I’ll be saving this for another day, as my day job is demanding I work and we won’t even talk about how many after hours tasks I have for RMOUG Training Days with the conference coming up this next month!
So stay tuned and I’ll let you know how I’m doing keeping my resolutions. Let me know if you’ve done any cool smart home projects on your side of the fence!
With me traveling to Redwood City next week to visit HQ and then Oracle Open World the week after, I’m busy during many of my off hours preparing a new Raspberry Pi STEAM setup for a maker’s faire the beginning of October.
I’d heard that many were having challenges with installing different HATs on their new RPI 3, especially older ones like the Pibrella.
This is still one of my favorite accessories for my RPI due to the button, speaker and three LEDs, but also since I can hot swap jump wires without risk of shorting out the unit like when you’re using the direct GPIO on the RPI.
I have a great new setup for travel for my Raspberry Pi that has the newest 7in touchscreen and protective case, which opens on the back. Could I install my Pibrella with the constricted opening and the GPIO wires still powering the enhanced touchscreen card?
The Pibrella requires 26 of the pins to function and installation asks you to place the unit to the 1st pin. It has a mini USB connector for power, but can run off of the GPIO. The challenge is that the new 7inch touchscreen ALSO is powered by the RPI GPIO, connecting to pin 2, (5V) and 6, (Ground.)
When a competing configuration is found for GPIO, its important to inspect the GPIO map and see what is available:
Now using the above map, you’ll notice that pins 1, 2 and 3 are all power. The Pibrella ONLY needs one 5V power source, which means that installing it from the first pin may be best practice, but it’s not required. OK, so that means we can still use Pin 2 for the touchscreen. Now, if we move down the Pibrella one, that leaves 6 rows of pins free at the other end. The 6 pin, which is the second necessary pin for the touch screen to ground it, can be shifted to the 39 pin, which is another ground pin!
I then moved the GPIO pins for the touchscreen and installed the Pibrella to the RPI 3. It was a tight fit, but it did install:
The next thing was to test it all. Each of the GPIO connected match to the GPIO attached. These will have to all be tested to see if there are any mismatches between the board and the RPI. The Pibrella library that is installed is just functions that have been written to tell what pins correspond to what commands.
So I run a small test script:
import pibrella import time pibrella.light.red.on() time.sleep(2) pibrella.alarm.on() pibrella.light.red.off()
This script is to turn on the red light for 2 seconds, ring an alarm and then shut off the red light.
What happened? The amber light lit on and then off. No alarm- yep, may have my monitor working and power to the pibrella, but as suspected, the GPIO orientation is off for each of the LEDs, alarm and I expect, the GPIO connections on the board.
Now I could give up my pibrella….or the touchscreen, but what if I’m just plain stubborn and want both?
So the files I need to work with are in the distribution packages for Pibrella. I had to go to /usr/local/lib/python2.7
Now you may be wondering why this was in the Python 2.7 instead of the 3.4 distribution… RPI 3 still has the 2.7 python set as default. If you don’t change this, then this is where you go. I prefer RPI 3 and write my code per Python 3 standards, but I’m not surprised the Pibrella library installed here.
Inside this directory, under the dist-packages is the Pibrella directory and it’s just a matter of .py, (python) files. There is one called pins.py that I had to update to reflect the changes I made to my match my installation. Now, we can fun the red light script and it actually lights up the correct LED.
It appears the alarm and button are set up in a different set of code, so now I need to just locate the other python scripts for the alarm and such and get that corrected.
That doesn’t mean I can’t get motors and other devices working from the new setup….
The following issues in this post are common challenges experienced by Raspberry Pi, (RPI) owners and I’m consistently frustrated with the ridiculous answers out on the internet for them! No fear, trusty Raspains! I’m here to offer you the correct and [pretty easy] answers that will actually fix the problems and won’t lead you to searching for hours on the internet.
We techies know that no matter what, going back to the configuration at the OS, (operating system) level is just the best way to fix problems. Raspberry Pi issues are no different, so read on…
If you haven’t figured out by now, your RPI, although globally distributed, was built in the UK, which means that the keyboard is set to “gb” for Great Britain. With that comes the pound sign when the shift is depressed and you then press the number 3, among other key reassignments. Yes, there is a configuration option in the user interface and yes, it will fail to correct the issue, even after you’ve rebooted.
There is a simple configuration file update, so let’s just fix this the proper way. Using Vi, Vim, Nano or another command line editor, edit the following file, (I’m a DBA, so Vi is my trusty editor choice):
sudo vi /etc/default/keyboard
# KEYBOARD CONFIGURATION FILE # Consult the keyboard(5) manual page. XKBMODEL="pc105" XKBLAYOUT="gb" XKBVARIANT="" XKBOPTIONS="" BACKSPACE="guess"
Update the XKBLAYOUT to “us” from “gb”, (or to the keyboard layout language you need it set to.)
Save the changes and cycle the RPI. There, all fixed.
The 7 and 10 inch touchscreen displays allow the user to have a more portable RPI, (non-dependent upon an HDMI monitor or TV) or mouse. I also prefer it, as the low-powered option allows me the opportunity to power my RPI, monitor, et. all on an 20800MAH mobile charger battery, walking away from a standard power source completely.
The challenge is that when you position the RPI into the case that makes this all so easy to work with, the display is upside down. No, there’s nothing wrong with your screen or your installation, the problem is the configuration for the RPI. This can be easily fixed, again, with a simple update to a configuration file and power cycle of the RPI.
This time, edit the following:
sudo vi /boot/config.txt
add the following line to the bottom of the file:
The file should now look something similar to this:
# Enable audio (loads snd_bcm2835) dtparam=audio=on # Correct display orientation lcd_rotate=2
Save the changes and cycle the RPI. Again, all fixed…. 🙂
If you have challenges with this, check out my blog post that goes into causes and fixes here.
Hopefully people won’t be looking all over the internet for these fixes and just find this post instead…. As I think of other fixes, I’ll continue to update this blog post, so check back!
So there are some cool features that are built into the GPIOZero library/module. One of the challenges I think many of us that have a lot of projects that we want to work on, is that we end up having to translate it to the version of RPI that we just happen to be working on or have available. This can be frustrating when the code is available without us having to rewrite it all in the libraries available for the hardware we just happen to plug-in.
So GPIO the old way with photocells is a bit involved:
GPIO.setmode(GPIO.BCM) def RCtime (RCpin): reading = 0 GPIO.setup(RCpin, GPIO.OUT) GPIO.output(RCpin, GPIO.LOW) time.sleep(0.1) GPIO.setup(RCpin, GPIO.IN) while (GPIO.input(RCpin) == GPIO.LOW): reading += 1 return reading while True: print RCtime(18) # Read RC timing using pin #18 <and on and on..and we haven't even got to the buzzer, etc....>
If we use the GPIOZero library, it’s much simpler due to a module written for physical computing with photocells:
from gpiozero import LightSensor, Buzzer from time import sleep ldr = LightSensor(18) buzzer = Buzzer(4) while True: sleep(0.1) if ldr.value < 0.5: buzzer.on() sleep(30) else: buzzer.off()
LightSensor was what I wanted and it was already available in the GPIOZero library.
Needless to say, this happened to me as I was working on a new project. I was at the Starbucks and pulled out my Raspberry Pi, B+ Release 2, that has the touchscreen built in, plugged it in and went to town. With this configuration, I only require one plug, (the monitor works off a battery) and it’s very portable when I’m out and about.
So what did I do when I saw the module to call was GPIOZero and I was on the Raspberry Pi 2? I installed the GPIOZero library, of course!
sudo apt-get install python3-gpiozero
I keep the images updated with the latest, so it was a no-brainer to add this to it.
If you don’t have what you want for the model you are working on, why not just try to install what you need?
Easy-peasy, forty pin GPIO library done. So there, Raspberry Pi Versions!
This morning, after someone added SQL Developer to a Raspberry Pi 3, Jeff Smith pinged me and the question was posed, as it often is, can you run Oracle database server on a Raspberry Pi, (RPI)?
The answer is no, you can’t, as there are no binaries for the ARM processor platform that you can compile, so its nothing to do with power, (although it is low powered for a very good reason…) but really due to the processor type. Hopefully that’ll stop those of you building out massive RPI clusters in hopes of creating their own home servers with these inexpensive computers.
With this said, you can run a database, so to show how easy this is, I’ll show you how to install and work with an installation of SQLite on a Raspberry Pi Zero, the version that’s less than 1/2 the size of a credit card.
Other people have a beer and take the evening off. Me? I have a beer and start installing stuff on single board computers… 🙂
Installation is easy. Ensure you have the latest update, so if you haven’t run your update in awhile, run that first from the command line. Remember you must have root or sudo privileges to perform these tasks:
$sudo apt-get update
Once complete and you know you’re up to date, then simply get and install SQLite:
$sudo apt-get install sqlite3
Let’s create a database:
This creates the database using the mydb.db file as the logical container for it.
Note: If you need help at any time, you can type in .help or .show from the sqlite prompt and it will display information similar to man pages in linux. It’s very helpful and user friendly.
If you’re out there comparing features, about to complain about all the ways that SQLite is NOT Oracle, well, you can stop right here. On the support page for SQLite is the quote:
Small. Fast. Reliable. Choose Any Three.
SQLite isn’t trying to be Oracle, but if you need a database and you’d like to put one on a RPI, this is the one to use that is small, fast and reliable.
Of course there are some syntax differences and SQLite has most standard SQL syntax at it’s disposal. Remembering to type BEGIN for the implicit transactions and to COMMIT after each is commonly the biggest challenge. This includes for data dictionary objects, (aka ddl).
As this isn’t a full RDBMS client/server database, there aren’t any roles or privileges that reside outside of the OS level privileges to the database file. This database works very well in the support of RPI projects and this is the goal of what I’m hoping to demonstrate here.
So let’s start by just creating a table and adding a few rows.
begin; create table tbl1(col1_id text, date_c1 date, time_c1 time, range_1 numeric); commit;
Now you can insert rows into your new table:
begin: insert into tbl1 values('user1', date('now'), time('now'), 12); insert into tbl1 values('user2', date('now'), time('now'), 7); insert into tbl1 values('user3', date('now'), time('now'), 20); commit;
You can then select from your new table and the row(s) will be returned, separated by the pipe symbol:
select * from tbl1 where col1_id='user2'; user2|2016-03-22|00:12:237
So there you have it. Database software installed- check. Database created- check. Object created and rows added- check. Table queried- check. All done in less than five minutes.
If you’d like to learn more, you can check out SQLite’s home page.
Although the Raspberry Pi 3 is now available, many people are still interested in it’s cheaper, smaller version, the Raspberry Pi Zero. This version isn’t just smaller, it also requires a Wi-Fi dongle for internet access, (one of the new, great features on the 3 Model!) and one of my main reasons for not recommending it to newbies to the Raspberry Pi, (RPI) world, is that it doesn’t come with the GPIO pins pre-soldered.
GPIO, which stands for General Purpose Input and Output is an excellent feature on this single board computer, allowing an RPI to connect easily with sensors, motors and other external components. The original RPI came with a 26 pin GPIO setup, but since the Module B, it’s been a standard 40 pin GPIO that offers a myriad of project and hardware possibilities.
Now those that are seasoned RPI geeks will simply say to wrap wires around the appropriate GPIO connector or with jumper wires, just stick the connector through the hole-
Those that introduce RPI to those new to single board computers know that the quickest way to suffer a short out to one is by performing breadboard and other experiments that utilize the GPIO and we see the wrapping of wires and leaving more chance for wires for power, grounding and control to touch a penchant for human error. These errors leave us asking students to be prepared with a backup image of the software on hand to address the most common victim of a shorted out unit.
Now I could go into the dangers of GPIO, ampage current with a recommendation that all newbies start with an Ardruino or discuss the importance of transistors, but eliminating some of the risk by having the GPIO pin connectors makes sense.
Ardruinos are better at GPIO ampage handling, but they shouldn’t be confused with a single board computer and are limited in their application. The RPI and Arduino are both capable of sinking 50 ma through their GPIO pins, the difference being where you to acually sink 50ma, the RPI may very well be damaged, but the arduino will survive and doesn’t have an Operating System and software that may be seriously impacted.
Due to this, for those that may be intermediates, I recommend if you’re going to get the Raspberry Pi Zero, consider soldering the GPIO pins for it. It’s not difficult and there are a lot of videos that can teach you how to solder effectively.
A 60 watt 110V soldering gun with a couple of different soldering tips is all you need to do the work with just about any RPI project. Purchase the right kind of solder for the project you’re taking on. Note I have a picture of the solder I’m using below. Pins can be purchased from Radio Shack, MicroCenter and other “geek stores” or you can steal them from kits that can be purchased online, like this cobbler kit. The pins can be “broken” into the correct count to fit in the holes to be soldered and you’ll be soldering from the back side of the unit.
If the unit is in a case, please remove the case and ensure you remove any cables, micro SDCards, etc. that could get in the way or be in danger of harm by the soldering gun before you begin.
Set up your work area and I keep a piece of thick cardboard around to clean off any remnants of solder from my solder gun to keep it clean as I work. Add the correct number of pins and if you don’t have a single set of 40 pin addition you can add, work with one line at a time.
Once the first line of pins are added, turn the unit over and brace it so that the pins are straight. You don’t want them “leaning”, otherwise the pins could be soldered crooked and you could have challenges attaching units like a PiHat or other components that have configured GPIO attachments. I used the corner of my keyboard, as it was the right height and balanced it out nicely while I did the work. Make sure to use the right solder,- you can see what I used in the picture below:
Solder across the first line, taking care not to touch the actual Pi Zero with the soldering iron and once done with the first line, add the second line and solder it into place in the same way as you did the first:
Once finished, let it cool and check the connections. Are the pins tight and are they straight. If there is some angle to the pins, you can use the soldering iron to *carefully* loosen the solder and straighten them out some, but it’s better to be cautious and check it as you go to begin with.
Once it’s cooled and you’re satisfied with the pin placement, plug back in the Micro SDCard and if you had a case, put the RPI zero back into it. That’s all there is to it! You’re ready to create all kinds of fun projects with your RPI Zero and not worry so much about those pesky GPIO wires being exposed! Oh, yeah, still make a backup of your image using Win32 Image Writer….PLEASE!! 🙂
I’d had some difficulty with WiFi consistently staying connected on each of my Raspberry Pi units. I’d had a little time to look into it, but no research had offered an answer and the only fixes I’d come up with was a shell script I wrote to force a restart of the NIC, which helped some, but no improvement when I added an antenna, (I considered all the wires, sensors, etc. might be interfering with the signal.)
Finally this weekend, started to dig around and noted that although in the user interface, it showed both connections to my home WiFi and my Smartphone as enabled, the /etc/wpa-supplicant/wpa_supplicant.conf showed the following for each entry:
I couldn’t find any support documentation that backed up the theory that there was a mismatch in what the GUI stated vs. the configuration file that is the backbone of the settings, but with all the other data involved, it made sense that this should be set to either:
So, I took a deep breath and updated one WiFi connection entry in the file with “disabled=0”, saved and rebooted.
Sure enough, my connection to my home WiFi stayed connected and consistent to the internet. No more disconnects and no more challenges with connectivity.
Another change I made afterwards, which is backed up with support from multiple resources is editing the /etc/network/interfaces configuration file. Scan the file and look for an entry that says:
If you don’t see this entry, add a line to the top of the file, (you should see at least one other line starting with “auto” so add a line under that one if there is), save and reboot. This will update your RPI to start the WiFi NIC automatically, which will then in turn, connect to your WiFi network.
I’ve made this change to four of my five RPI, (the PiZero Jessie load doesn’t experience this issue and was what triggered that it was a software issue with Wheezy and not a hardware problem….)
This Saturday I’ll be part of a nationwide event being put on by the Raspberry Pi Organization and Barnes and Noble book stores. Makers Faire’s have been gaining international attention as the place to see really cool tech and inventions “in the wild” by everyday people making a difference.
I’ll be presenting at my local Westminster, CO store and am really looking forward to the event. I was approached by Matt Richardson from the Raspberry Pi organization to participate and I was really honored to be picked to be part of this. The event was even advertised in the NY Times, so pretty cool stuff!
I’ll be talking about why we’ve chosen Raspberry Pi’s to introduce technical education to kids and adults for RMOUG’s Raspberry Pi and STEAM special interest group, the coaching volunteer work I’ve been lucky to be part of with Oracle Education Foundation and my recent partnerships with Devoxx4Kids, which is just a great organization over all for introducing kids to technology.
Now lets get into the Raspberry Pi projects I’ll be demonstrating at the event. Physical computing is very interactive, which means that its not just about the code, but really helps kids understand how much you can control with code. The interaction keeps them engaged and with a few projects, they really start to embrace it.
I have two Raspberry Pi’s that I’ll be demoing- one has three projects connected via GPIO, (General Purpose Input/Output) with jumper wires. Two of the projects demonstrate how easy it is to purchase inexpensive models from a toy store and to hack them so that they can be controlled through code. The third project is just a motor, set up inside some Legos with a magnet and a plastic alien that can be positioned and spin in a dancing motion.
The take away from this project is to understand that the same code and a motor can do three very different things-
Here’s the actual code:
import pibrella from subprocess import Popen import time proc = Popen(['mplayer', '-slave', '-playlist', 'http://ramfm.org/ram.pls']) #stream music as subprocess def dance_e(): pibrella.output.e.on() time.sleep(10) #run for 10 secs to match music pibrella.output.e.off() def plane_h(): pibrella.output.h.on() time.sleep(5) #plane runs best at 5 seconds pibrella.output.h.off() def robot_f(): pibrella.output.f.on() time.sleep(3) #robot walking for 3 seconds is good pibrella.output.f.off() plane_h() robot_f() dance_e() #run motor alien last, give music time to buffer time.sleep(10) proc.terminate() #kill subprocess and exit
The code is simple and clean, doing what needs to be performed:
Start some music and while that is buffering and running in the background, launch the airplane, run the robot and then make the alien dance, which will start just after the music starts, too.
This is a project that I built out of an existing project I found online and then did some enhancements for Oracle Open World. I found myself at the conference without a co-presenter who had to go in for emergency surgery, so I wanted to do something with a Raspberry Pi and unfortunately, was out of time and our first idea was hardware challenged due to time constraints. I bought the bear in the conference retail center and began to work on him, introducing a Raspberry Pi to his innards and a camera in place of one of his eyes.
I set up app authorization to tweet via app.twitter.com and then built out the code from there with the additions I wanted for hashtags. I’ve now updated the tweets and hashtags to reflect the upcoming Maker Faire event, but here is the way the code works.
You click the button in his paw, the camera takes a picture, the code pulls from an array of tweets and hashtags, then it pushes it all and posts to Twitter-
The script calls an authorization file that grants it privileges to tweet as the RPI Oracle Bear user on Twitter. I installed the Twython module to use the code already built into the Raspberry Pi and configured my phone’s hotspot to ensure wifi access. I prefer my phone as it shows when the RPI is connected, verifying that I have wifi access, as there isn’t a monitor to display this information when the bear is active, (same with mouse, keyboard, etc. The code is running in the rc.local in the OS background, so no execution is necessary. It’s always on.)
from twython import Twython from picamera import PiCamera from time import sleep from datetime import datetime import RPi.GPIO as GPIO import random from auth import ( #authorization info for Twitter consumer_key, consumer_secret, access_token, access_token_secret ) GPIO.setmode(GPIO.BCM) GPIO.setup(14, GPIO.IN, GPIO.PUD_UP) twitter = Twython( #push auth codes to Twython consumer_key, consumer_secret, access_token, access_token_secret ) messages = [ #Tweets "Did you know over 7 million Rasperry Pi's have sold since 2012? ", "Nice to see you here! ", "You should follow @RpiOraclebear! ", "Do You Raspberry Pi? ", "Are you powered by a Raspberry Pi, too? ", "The Maker Faire at @BNBuzz ROCKS! ", "You can learn more about RPI at https://www.raspberrypi.org/magpi/! ", "A Raspberry Pi is only $35, you should get one! :) ", ] handles = [ #This is where you add hashtags to use "#RaspberryPi", "#BNMakerFaire", ] def main(): message = random.choice(messages) handle = random.choice(handles) with PiCamera() as camera: while True: GPIO.wait_for_edge(14, GPIO.FALLING) timestamp = datetime.now().isoformat() photo_path = '/home/pi/tweeting-rpibear/photos/%s.jpg' % timestamp sleep(3) camera.capture(photo_path) with open(photo_path, 'rb') as photo: twitter.update_status_with_media(status=[message handle], media=photo) #tweet will be a combo of one tweet and hashtag from list if __name__ == '__main__': main() camera.close()
This code is again very simple and clean. It’s not about making anything too complicated, just do the job that you want done. I’m considering moving the hashtags and tweet messages out to a separate files so if someone wanted to share the bear, (send it to conferences, people have asked…) that they could be given simple instructions to update the files and not the code, which would lessen mistakes.
I’ve added some velcro, secured the camera better into the eye socket with needle and thread, put all the batting in plastic bags to keep it out of the electronics and added a better button that “clicks” to know when the trigger has been engaged for the code.
Noel Portugal had a battery that worked really well with the RPI, so I’m going to hunt that down today, as I prefer the bear to be cordless, even for power. It just makes him all the more cooler to know he has a computer in him and like Pinocchio, no strings attached… 🙂
So I need to finish up my slides for this event, but I wanted to get the code out there and let folks know just what this event and the projects were all about. Don’t miss out, as I said, this is a nationwide event for Barnes and Noble, so look up your local store and be part of it!
So in honor of coaching a Python introduction class with Devoxx4Kids this weekend, I thought I would update my pass the pigs game and add in the scoring and just rewrite it a little.
If you aren’t familiar with this fun little game, here’s the gist- It consists of two pigs that you roll like dice. Depending on how the pigs land, you get a particular score-
I’ve simplified my original script even a bit more and added a function to set up the roll. I’ve added the scoring in, along with information on if you roll doubles and the game will break out of the roll if a Pigout or Oinker, (referred to as a “Makin Bacon” and a “Sider” in the top image) is “rolled”.
#!/usr/bin/python3 #Pass the Pigs Game import random
def setup_roll(): print(' ') print('Your Roll is:')
def pig_pass(): for x in range(1, 3): #two dice rolls dice_roll = random.randint(1, 6) if dice_roll == 1: print('Razorback, 5 pts! If you get doubles, 20 pts!') elif dice_roll == 2: print('Trotter, 5 pts! If you get doubles, 20 pts!') elif dice_roll == 3: print('Snouter, 10 pts! If you get doubles, 40 pts!') elif dice_roll == 4: print('Leaning Jowl, 15 pts! If you get doubles, 60 pts!') elif dice_roll == 5: print('Pig Out, Back to ZERO pts and Next Players turn unless you get doubles, then you get 1 pt!') break elif dice_roll == 6: print('Oinker, Back to Zero and Next Players turn!') break setup_roll() pig_pass()
Once we’re done coding this, you can save by hitting the <Esc> key, then “:wq” to tell the vi editor to “write” and “quit”, (for those of you that are “vi newbies”.
Let’s change the permissions on our file so it’s easy to execute without power privs:
chmod 775 pig_gm.py
To execute the game, just run the following from the directory you saved the program in:
The output from the game looks like the following:
Your Roll is:
Leaning Jowl, 15 pts! If you get doubles, 60 pts!
Trotter, 5 pts! If you get doubles, 20 pts!
Your Roll is:
Trotter, 5 pts! If you get doubles, 20 pts!
Oinker, Back to Zero and Next Players turn!
Your Roll is:
Trotter, 5 pts! If you get doubles, 20 pts!
Pig Out, Back to ZERO pts and Next Players turn unless you get doubles, then you get 1 pt!
You get to add up your points unless you get an Oinker or a Pigout, (unless it’s doubles Pigout) and you can play the game just like you had the lovely plastic pigs!
See everyone at Oracle Open World soon and enjoy!
I’ve been a bit busy traveling and speaking, but I wanted to discuss the great events I’ve been lucky enough to be part of the last couple weeks.
I spoke at the INOUG back on September 17th. The user group in Indiana is incredibly welcoming and I had a great time with the wonderful attendees for my three back-to-back sessions. We discussed AWR Warehouse, ASH and AWR Mining and a new session on Optimization for EM12c and the Hybrid Cloud.
September 21st-23rd was my first visit to the great city of Raleigh, NC and ECO! I’ve always wanted to visit the location and had a great time not just because I got to hang out with friends like Jeff Smith, Ric Van Dyke, Kent Graziano, Scott Spendolini and Tim St. Hilaire, but I also received an incredibly warm welcome from the ECO attendees! Linda Hoover and her team put on a great conference and the interaction from those in the sessions were phenomenal, both during and afterwards.
I had a great joint keynote with Jeff Smith on “Empowering Your Technical Career with Social Media”. It was incredibly well received and even though the room felt like it was -50F, everyone stayed for the entire keynote. Some of the best feedback was when a woman who was working in the hotel serving food came up afterwards to tell me how much she enjoyed it and asked me some questions about what I did for a living and how to get into the tech industry.
An attendee also came up to me in the restaurant to let me know she’d only stayed for two keynotes her entire career and that ours was one of them! These kind words from these two women and the other attendees who approached us meant a lot to Jeff and I. We really appreciate the support! I also have to thank Monty Latiolais and Ray Smith for letting Jeff and I rework their social media profiles and personal branding. It was great to see it all come together. For those that attended my technical session which was a deep dive in AWR and ASH, thank you for offering me a standing room only in the largest room they had at the conference and for all the interaction.
I raced home at midnight on the 23rd to ensure I was available to do the keynote on the 24th for the IOUG Master class at….OK, let’s just say it, I’m a Denverite, it will always be Mile-High Stadium. 🙂
The event included a good amount of RMOUG folks, along with some new folks and I got to speak with Graham Thornton from EMC, too! It was a great day to be at the stadium and a great time was had by all as I spoke on Oracle Hybrid Cloud.
Everyone knows I’ve been all about educating with small computers like the Raspberry Pi. Thanks to Jake Kuramoto, I was offered the opportunity to come be part of the coaching team with the Oracle Education Foundation, specializing in teaching Raspberry Pi with Python. I helped to build some of the content and it was an awesome experience to work with the high school kids.
I only got to spend a week out of the two week project, because if I didn’t get home at least one week in October, Tim was going to come and get me! It was a dream come true for me and I look forward to volunteering with the Oracle Education Foundation in the future.
On Thursday, Jake and his team, including the impressive Mark Vilrokx, came in to demonstrate a great nerf gun powered by an Adruino micro-computer and a sensor connected to the internet. It used voice activated commands to shoot nerf ammo, even to know how many nerf bullets to shoot.
I’ll return home next week and enjoy some time with my family, my home and my dog before returning for Oracle Open World and Oak Table World for the end of October, so until then, check out the Arduino controlled nerf gun Twitter account, IOT Nerf and a shot of the great class I worked with for the week!
So as I prepare for next week, coaching with some other great folks with the Oracle Education Foundation using the Raspberry Pi, I wanted to add some fun music into my code to work with our motor mascot project. To do so, you need a few things:
If you haven’t done so recently, run an update on your Rpi:
sudo apt-get update
Now that you know your Rpi is up to date, let’s get the MPlayer software:
sudo apt-get install mplayer mplayer-gui alsa-base alsa-utils pulseaudio mpg123
If you have your Rpi hooked into a small monitor, like I do, then don’t be surprised if the mplayer application fails due to the display constraints. The rest of the code and librariesiare what we’re really interested in, so not a big deal.
Once it’s finished, reboot your Rpi:
Once it’s up, lets do a bit of code. There are a number of online FM URL’s that can be used with the mplayer, so it’s really a lot of fun. You must have WiFi access configured on your Rpi for this to run:
os.system(“mplayer -playlist http://tunein.com/radio/1FM—Absolute-Top-40-s48967/”)
Save the file as play_music.py
To run this, simply type in:
sudo python3 play_music.py
I’ve updated my script to do a few things, including blinking lights and spinning motors, but the video gives you at least a taste of the motor and the music!
Have a great Firday, folks!
So one of the things I like to do is test out a lot of my python gaming code, (as far as for the coding and syntax) on my Oracle Virtualbox image of my Raspberry Pi. Another great thing about building games on the Raspberry Pi, is a built in module called Pygame. Well, that doesn’t exist on the Raspberry Pi image and it really limits what we can do when it comes to the VNC build we play on the Oracle Virtualbox, (that’s a mouthful… :))
The first step is to first get out to all the libraries, as the ports the image is a bit locked down. At the top, click on Devices, Network, Network Settings. Add a check mark for “Cable Connected” and then click on the “Port Forwarding” settings. Update the settings to reflect what I have for the open ports, (remember, this is Oracle Virtualbox… :))
Once you’ve updated the Host and Guest Port, click OK.
As I want to stay with Python 3 as much as possible, we’re going to install it with our Vbox image with the Python 3 build. Let’s start by installing:
sudo apt-get install mercurial
Choose “Y” for both questions and proceed with the installation. There are a lot of files here, (over 500) so it will take just a few minutes to install everything. Now, we need to run the clone step:
sudo hg clone https://bitbucket.org/pygame/pygame
Once this complete, which is just a matter of seconds, again, choosing “Y” for the questions, we need to build the dependencies after we download those:
sudo apt-get build-dep pygame sudo apt-get install python3-dev sudo apt-get install python3-numpy cd pygame sudo python3 config.py
You shouldn’t run into any failures at this step, as I didn’t with my own image. If you do, you can go back to the first step and instead run:
sudo apt-get update
If all is successful at this point, then it’s time to build and install:
sudo python3 setup.py build sudo python3 setup.py install
Now we need the Alsa Sound Library that isn’t in this image. These are called by the Pygame module and come by default on Raspberry Pi, but yep, not here! You can check first to verify that they aren’t there, (if you’re curious…):
apt-cache policy alsa-base libasound2 alsa-tools
Now run the install with the following command:
sudo apt-get install alsa-utils sudo apt-get install alsamixer
You’ll now see the ALSA sounds libraries if you run the check command again.
Now you’re ready to code Pygame games on your Virtualbox image of the Raspberry Pi! 🙂
Back on August 7th, the RMOUG’s Quarterly Education Workshop, I walked everyone through using a Pibrella board to create an art or flyer project that was powered with a python script and a motor.
Today, we’re going to take that same code and reuse it with a simple robotics kit to control power and rotation speeds/time to the Insectoid. This kit, puchased from the Go! store in Flat Irons Crossing mall, was $16 and can be built in less than an hour, even for a small child. If you’re interested, you can also purchase the kit online at Amazon, but it was cheaper for me in the store to get him than online…
It requires only a small screw driver and is powered by a AAA 1.5 volt battery. With the power required to the motor, I recommend leaving the battery wired in and the device off, (Raspberry Pi will be glad to supplement the power and you’ll know if you’ve overwhelmed your power requirements to a secondary project just by the sudden cycle of the OS, so keep this in mind….)
After following the instructions and assembling the gears, the body and legs to complete the robotic insectoid, test it out with the battery and power switch. Once he tests successfully, then comes the fun part of wiring him to the Pibrella board to control him from our Raspberry Pi.
Using red and black female/male breadboard jumper wires like the ones below-
Create a long black and long red “extension” to connect the insectoid to the Pibrella board. Now, undo the cap that is connecting the battery and motor wires to the top of the Insectoid. If the battery is wired into the motor wire in a way that makes the motor wire inseparable from it, re-wrap the battery wire to the motor wire at the base, leaving just the motor battery straight. Take the motor battery, matching black to black and red to red, inserting the motor wire into the female jumper wire “extension” and ensure it’s tight. You shouldn’t need any electrical tape to secure it and it should look like the following picture when you’re finished.
You can re-secure the connections under the cap after you’ve added the connection to the female jumper, (as seen for the red, (negative) connector.
Once this is done, it’s time to “recycle” our python script. Log into the Raspberry Pi and open up a Terminal window. Review your Python script from the earlier project OR just create a new python script, (.py) in your favorite text editor and type in the following-
import pibrella import time
while true: if pibrella.button.read(): pibrella.output.e.on() time.sleep(10) pibrella.output.e.off() cleanup()
The Python code does the following:
You execute the script as we do any of our python scripts, using Python 3-
>sudo python3 <name of script>.py
A video of the run with the robotics project can be seen on YouTube.
The next step is to enhance our script and have our robot do more than just walk forward and/or stop at a certain time. We’ll want to build out a robot to have a Raspberry Pi control board ON BOARD and control his movements to turn, go in reverse and so forth.
Until next time-
So I don’t doubt that many parents are bleeding out money for kid’s school fees, supplies, clothing and other demands this time of year. How many of you are in their local Target, Walmart or other store and after filling the cart with the necessary, the kids eye up the toy aisle and start to ask for something?
Even teens are not immune and may be asking for games. If you could turn around and say to them, “If you want the game, then why don’t you build it instead of buying it?”
Now as many of you have figured out, I’m starting to build an arsenal of Raspberry Pi content to teach in classes and meetups. The following is to simulate the game “Pass the Pigs”. If you’ve ever played this popular game that uses plastic pigs in the place of dice, it required my brain to rethink how I was coding my dice games to how I would code a game that used the fall placement of a plastic pig. This demonstrated one of the greatest things about Python- I still was using the same module, but I just used it in a different way to code my new game!
So let’s say we want to code a simple roll of dice game.
#Dice Roll import random #Insert space between import and code... for x in range(1, 2): dice_1 = random.randint(1, 6) dice_2 = random.randint(1, 6) print(dice_1 + ' + ' + dice_2)
The above code will do the following:
Now to change the code and create the Pass the Pigs game, we get to use the RANDOM module again, but the code changes as we are going to use a function to tell Random what “word options” will be used instead of random numbers to return. It will then use two pigs and then will output the roll, (which is a function).
#Pass the Pigs import random pig_fall = ['Razorback', 'Trotter', 'Snouter', 'Leaning Jowl', 'Pig Out', 'Oinker'] def pick_pigs(): Pig1 = random.randint(0, len(pig_fall) -1) Pig2 = random.randint(0, len(pig_fall) -1) return pig_fall[Pig1] + ' + ' + pig_fall[Pig2] print (pick_pigs())
This code is different from the first one, even though it really ends up doing the same thing. Notice that there are six options, just like there are six sides to a die. This is really very similar to the dice game, we’ve just used different code that works more efficiently with our requirements. By execution the code, we can then play the game!
>sudo python3 <script_name>.py
Leaning Jowl + Pig Out Trotter + Pig Out Leaning Jowl + Razorback
We can use the game instructions, (can be found online) to then add up our scores for our three players-
So there you have it and next time your kids ask you for toys and games, consider getting them a Raspberry Pi instead and make it pay forward, creating projects and games with it instead!
Until next time…
There’s an old joke about the evolution of a programmer. It starts with the programmer in their infancy and typing:
Print “Hello World” and so the output returns:
The programmer continues to evolve. His coding knowledge increases and his code in the end of his evolution becomes a script of 5000 to 10,000 lines. What does the output return? You guessed it:
I often joked that I’d make a terrible developer. I over think everything, but the truth is, I may have just evolved too much and need to devolve to improve. There used to be a sign up on my door of my office years ago, put there by an Operations Manager that read-
Go away before I write an efficient script to replace you.
It wasn’t far off from the truth. My shell scripts made the world go round, but they also were built with a certain mindset design. There was almost always a wrapper shell script that called subsequent scripts to perform different tasks and arguments to do what was expected. This was the design and mindset of shell scripting I’d been taught by a great scripting teacher.
Now that I’ve been working in Python for the last four months, I’ve had to admit to myself that my mindset has to change. I need to move to the Pythonic way of thinking. What is Pythonic thinking? It is the particular style that has emerged over time trhough experience using the language by those that know it best. This challenge is also quite normal for anyone coming to Python. Doesn’t matter if the programmer is skilled at Java, C++ or Ruby Rails, they all go through it. Python is very efficient, but below, you’ll find a perfect example of how one can really work hard instead of smart, i.e. the Pythonic way.
For my latest project, after noting the lights and built in sounds for the Pibrella board add-on for the Raspberry Pi, I decided I wanted to create a gaming script that when combined with kids imagination, could be used in a variety of ways. The game, “Red Light, Green Light” was the source of the inspiration.
The requirements were as follows:
Now I created the initial script to test the process without issue. I used the Pibrella and time modules-
import pibrella import time #start game with success and green light. During green, (25 seconds) people will move as fast as want. pibrella.buzzer.success() time.sleep(3) pibrella.buzzer.off() pibrella.light.green.on() time.sleep(25) pibrella.light.green.off() pNow lets go in slow motion. Signal the yellow alarm and then light for 15 seconds of slow motion movement. pibrella.buzzer.buzz( frequency ) pibrella.buzzer.note( 1 ) #this is the frequency for the Note A time.sleep(2) pibrella.buzzer.off() pibrella.light.yellow.on() time.sleep(15) pibrella.light.yellow.off() #Now for a stop movement or red light in the game. pibrella.light.red.pulse(2,4,2,1) #we’ll make the light pulse instead of just light up pibrella.buzzer.fail() time.sleep(2) pibrella.buzzer.off() pibrella.light.red.off()
Now this seems pretty straight forward, but now I wanted to add in the logic to have random runs on times and variations of colored light sequence. I started by duplicating the script and adding in different rotations and time. I planned on six different scripts with different amount of time included in it and rotations…about 150 lines of code when I finished.
Why? Because this is how I would have built in the logic to Shell scripts. I would have had a wrapper script that would call the other scripts to run different rotations to keep the players on their toes.
What’s the problem with this logic? It’s not the Pythonic way of doing things- secondary scripts called from a main script and adds to complexity that doesn’t belong in the code. It’s also the wrong way to teach python coding and would have added confusion to the class.
So how should these requirements be coded?
The latest Python script looks very different from the first and it includes everything in one script, using three modules. I’ve added the Random module, which allows me to build out a random number generator that acts like a throw of a dice. Depending on the results, a different light and duration occurs. I chose six variations, three green, two yellow and one red. With the red, (throw on a six) there is a break to leave the execution of the script, but the code is built to run for 30 times as is.
import random import pibrella import time for x in range(1, 31): #run for 30 iterations dice_1 = random.randint(1, 6) #options, just like a die. if dice_1 == 1: pibrella.buzzer.success() time.sleep(3) pibrella.buzzer.off() pibrella.light.green.on() time.sleep(25) #green for 25 seconds pibrella.light.green.off() if dice_1 == 2: pibrella.buzzer.success() time.sleep(3) pibrella.buzzer.off() pibrella.light.green.on() time.sleep(15) #green for 15 seconds pibrella.light.green.off() if dice_1 == 3: pibrella.buzzer.success() time.sleep(3) pibrella.buzzer.off() pibrella.light.green.on() time.sleep(10) #green for 10 seconds pibrella.light.green.off() if dice_1 == 4: pibrella.buzzer.note( 1 ) #solid note for tone time.sleep(2) pibrella.buzzer.off() pibrella.light.yellow.on() time.sleep(25) #yellow for 25 seconds pibrella.light.yellow.off() if dice_1 == 5: pibrella.buzzer.note( 1 ) #solid note for tone time.sleep(2) pibrella.buzzer.off() pibrella.light.yellow.on() time.sleep(15) #yellow for 15 seconds pibrella.light.yellow.off() if dice_1 == 6: pibrella.light.red.pulse(2,4,2,1) #red, you’re done! pibrella.buzzer.fail() time.sleep(2) pibrella.buzzer.off() pibrella.light.red.off() break #escape out of the loop
This code now randomly runs different variations of green and yellow with their notifying buzzer, up to 30 times or until it results in a “6”, which then will alarm, pulse the red light and exit out of the script. No other scripts or logic is required because I coded it with the Pythonic way of thinking.
To execute the code, looks like this:
sudo python <script_name>.py
So what does this code look like when I remove the extended times in the lights so the random generations goes at an accelerated rate of change between each?
Just like this video…
Now I want you to imagine playing the game of Musical Chairs to this. Green means go fast for the time elapsed, (10, 15, 20 or 25 seconds…) Yellow requests all the players must go in slow motion, (which is also amusing for the spectators… :)) and then the red light, (and alarm) signifies everyone tries to immediately find a seat before there isn’t one left!
In a larger room, you could use it to play “Red Light, Green Light”. You could still expect the players to go in slow motion during the yellow iterations and just as in the standard game, anyone still moving when the alarm and red light go off, must return to the starting line.
The completion of the project, after working with the kids to create the code, test and verify, is then to ask them to use their imagination on how they would use the code or enhance it to play other games. The random libraries could easily be used for dice games, displaying the role and even incorporate more than one die for the game.
Until next time…
So I’m working on a lot of posts for Enterprise Manager, but I can’t post them just yet, so here’s some more Raspberry Pi love to keep you busy until then… 🙂
Many times I just want to write and test some code, but I want to do it while I’m taking a break from my day to day work- waiting for a download, in a meeting, a script is running in another window, etc., so it’s convenient to have a Virtualbox image to run Python scripts with all the libraries and modules installed. I can’t simulate my Pibrella card or other add-ons, but I can install the libraries and verify that all my code tests out syntax wise before I run it on the actual Raspi.
Now the “noobs” install of Raspian, (Debian) won’t work for a direct Vbox image. It’s made for ARM processors and Virtualbox is expecting an OS to support an X86 processor. This just means we need to be more selective in the OS version that we use, so we’re going to use Ubuntu or other supported platforms for our image, then add the Raspian on top of it. You could use an emulator like Qemu, that emulates the hardware, too, but I just want a simple Vbox image and be done with it.
If you just want to use an Ubuntu image, already built, you can locate that here and that’s what we’ll do for this example- use the pre-built image and then add what we need to it!
The OVA fill need to be extracted from the bit torrent file using 7Zip or another file management program after it’s been downloaded.
Once this is done, open up Oracle Virtualbox and choose to “import appliance” option with the file, keeping all the defaults.
The Username/Password is rpi/password and once you login, open a folder and right click, choose “Open in Terminal”. You can then change the directory from the default to debian-
cd debian ./launchDebian
Expect some odd errors to come up- this is normal for this image and can be disregarded.
Once the errors complete and the prompt stops at the “Same machine: preferring raw encoding” statement, then go back to your folder and right click again, opening a second terminal.
Type in the following:
Username/password is root/password and you’ll find that you are now working from the Raspberry Pi command line, just as if you were on the machine!
Installing the Pibrella Libraries are pretty easy. Just do the installations and you are set. Start with running the update:
sudo apt-get update
Then run the upgrade:
sudo apt-get upgrade
Now, let’s install the Pibrella modules:
sudo apt-get install python-pip sudo pip install pibrella
Once completed, now I have all the pibrella module installed and can run code. We can run a quick test, too.
import pibrella pibrella.buzzer.fail() pibrella.light.pulse(0.2) from sys import exit exit()
Save the file and then execute it:
sudo python -i pibrella_test.py
No, the lights and buzzer, or button commands won’t work on the simulator, but I can test my code to verify that syntax is correct and get it ready before moving it over to the actual Raspberry Pi!
As most folks know, I’m a Python addict, so I also want to update to Python 3 on this image.
sudo apt-get install python3
Now I have everything I need to simulate my Raspberry Pi to run scripts from my PC!
Have a great day and Pi on!
I’ve had a lot of people email and message me asking me what I’m doing with the Raspberry Pi and I wanted to share before the actual RMOUG Quarterly Education Workshop, (QEW) this Friday at Elitches.
So a little history- When I was a kid, I was a real handful. My mother used to come into my room and I’d have created “webs” out of yarn strung from every piece of furniture and twisted into patterns. I used to take apart radios and use the parts to create new toys, figuring out how the electronics worked. Dolls suddenly became cyborgs and we wont’ talk about what I used to do to poor, defenseless stuffed animals. My destruction and “recycling” used to exhaust her to no end, but what I used to create new toys out of, rarely occurs in today’s world and when the Raspberry Pi was introduced to the stage, I was immediately smitten…:)
As many know, I’m also a grand supporter of STEAM, (Science, Technology, Engineering, Art and Math) as part of the success in filling the 1.4 million open positions that we are posed to have available in technology by 2020. That number is only going to grow and I don’t see our public education system building out core knowledge to embrace technology in a way that kids will have been introduced to logical thinking and coding to entice them to careers in technical fields. Public educations just doesn’t have the resources or the vision to do this and I feel its up to us who are here, in the technical arena now.
With that said, it took some convincing to get the QEW to include a family coding event. We were already late getting the new board in place, so we’ve been scrambling ever since! Devoxx4Kids will be onsite and they’ll be doing a session on how to build Minecraft modules. I’ll be teaching the Raspberry Pi session with attendees. The project will have all areas of STEAM covered, which is quite a challenge to do in one project with kids!
The attendees will bring their Raspberry Pi setups with their parents [hopefully] in tow, and I’ll be providing small motors, pre-soldered with connectors to attach to a pibrella board that was part of the “shopping list” from the website. The Pibrella board is a small add-on board to the Raspberry Pi that makes it easy enhance projects and it’s one of my favorite additions to my setup. With the motor, and a small lego base, the kids will then use ART supplies to build a small project, it can be an animal, a flower, a design from stickers, even a spinner or other flyer. The art project can be ENGINEERED any way they want, to either spin, dance or fly off the motor.
Along with art supplies, I’ll have LED lights and small watch batteries that can be used to power the lights and add to their projects. I also have magnets to use to “attach” flyers to bases to launch which all bring in some components of SCIENCE into the project.
Once they finish their creation, we’ll attach it to a motor and start up our Raspberry Pi’s. Each attendee will open up a text editor and CODE some simple timing and spinning rotations, adding different enhancements to the code, depending on what they want their project to do, (I have three coded examples that they can edit with different times, start with the execution or use the button on the pibrella to commence, etc.)
They’ll then EXECUTE their code and see if the initial TIMES COMPUTED work with their project or if they need to adjust the MATH to make the project work.
Once they are satisfied with the project they built, we’ll discuss how they might imagine to enhance their project. Would they add lights? Would they add music? Might they change the physical design or code? I want them to use their imagination and their logical thinking skills to see how cool technology can be.
My youngest son, Josh, seen above, has been helping me with this project, using his master soldering skills to assist me attaching the jumper wires to the motors, helping me test out different art projects and flyers to ensure that the code works like expected and that my new [non-brand name] Lego case secures my different card installations correctly.
Thanks for listening to me rant so I can take a break from everything and hopefully, we’ll have a RAGING turn out for the family coding event, people will stick around and listen to me also ramble on about Enterprise Manager Hybrid Cloning to the Cloud and then have a great Hands on Lab using a AWR Warehouse I created for this event!
See you Friday!
I recently upgraded from the first edition Raspberry Pi to the new and improved Raspberry Pi 2 in a bundle Cana kit. The Raspberry Pi 2 has a 900MHZ quad-core Arm Cortex A7, (ARMv7 processor instruction set) with 1Gb of memory, GPU is a 250MHZ Broadcom VideoCore IV, 1080p 30 h.264/MPEG-4 AVC high profile decoder and encoder on the graphics and includes four USB ports, a micro SD, HDMI, micro USB power supply and a 15-pin MIPI camera interface. I like that the kid included a number of accessories, including an 8GB Micro USB card, the USB Wifi, 3.5 mm jack hookups for audio, LED jumper wires in numerous colors, GPIO ribbon cable, casing, heat sink and other necessities.
Now I purchased a few other items to make me a bit more portable without having to haul around huge peripherals.
I also bought the onboard PiTFT 2.8” Touchscreen. This is pretty cool, easy to install once you download the drivers and add a small script to execute and switch from your main monitor to the touchscreen, but some drawbacks that caused me to purchase an additional accessory, too:
Due to these two issues, I would have skipped this on my purchase list if I were to make the decision again.
With that, I ended up busing me a screen that was functional, but still small enough to take with me- the 7in High Resolution Monitor with HDMI hookup. Now this may seem difficult to believe, but it’s quite functional and works great with the PI. Plug the HDMI cable in and you’re ready to go. The power from the HDMI cable also has enough power to help power the onboard 2.8 touch screen, which is an added benefit, even as I work on some functionality I hope for the touch screen in the future.
If you aren’t aware, there are some great projects that allow you to turn your Raspberry Pi into a GoPro like camera. I invested in the adafruit camera board. This manufacturer also created the 2.8 touch screen and they do make some great quality products. The drivers are simple to download from the a browser on the Pi and installation and configuration are simple for anyone to do. The only challenge for me was the “clip” that holds the camera ribbon cable down, as with even simple pressure, it ended up breaking on me and I’ll be ordering a new camera 16 pin mount since I screwed this one up, so if you delve into this one, take care. It’s not like I’m the hulk or anything and I still ended up breaking it with very little pressure… L I do love adafruit though, their stuff is first rate and lots of cool items to add onto your Raspberry Pi to make it awesome!
After all of this, you’re looking for some interesting Raspberry Pi projects, in hopes of using it for family coding classes, etc. look no further, as there are a ton of resources online-
You’ll notice each of these links tried to “one-up” each other on how many projects they could offer, but this is a good starting point for anyone hoping for a good starting point after they set up their Raspberry Pi or want to offer a family coding day with the Raspberry Pi as a center point of the class. I’ll keep working with mine and I’m sure I’ll have more items to add to this list, (a battery pack is going to be my first addition to this list, I’m sure… :)) but until then, Pi-On! 😀