Showing posts with label Raspberry Pi. Show all posts
Showing posts with label Raspberry Pi. Show all posts

Saturday, February 8, 2014

[Product Review] Raspbery Pi Cookbook Video

This is a product review for the Raspbery Pi Cookbook Video.

As they say, "Seeing is Believing", there is something to be said about a seeing something being done rather than reading about it. Perfect companion for the cookbook, in my opinion.

I reviewed the cookbook when it was in early draft and liked it very much. At the time, I honestly thought that it would be great if I can just see demonstrate of some of the recipes. Apparently I am not alone. Personally I believe if you have some experience with Raspberry Pi you will still get value out of the video, but it is best to be used with the cookbook so one can read about the recipe and reinforce the idea with the video.

Just like the cookbook, the video works from simple to more complex recipes. Some recipes builds on top of each other, but not much.

Overall, I believe if you like the cookbook, you will enjoy the video.

[02/16/2014]

Here is a video for a mashup for "Recipe 04.09 Raspberry Pi Radio Transmitter". The idea is to tail /var/log/syslog, upon finding a suitable event, play the sound.


Here is the code:

#!/usr/env/bin python
#
# Eric Chou ericc@a10networks.com
# Fred Hsu fredlhsu@aristanetworks.com
# http://www.icrobotics.co.uk/wiki/index.php/Turning_the_Raspberry_Pi_Into_an_FM_Transmitter
#
# Feb. 16, 2014
#
# The purpose of the file is to tail the syslog, upon finding a suitable event
# the device will push out the directflow to the Arista switch and transmit
# a FM radio sound to indicate triggered event.
#

import subprocess, time, re
from jsonrpclib import Server

p = subprocess.Popen('tail -f /var/log/syslog', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

# Sets Arista API call parameters
username = "admin"
password = "admin"
switch = "172.22.28.156"
dip = "10.1.1.1"
outport = "Port-Channel 100"
urlString = "https://{}:{}@{}/command-api".format(username, password, switch)
switchReq = Server( urlString )

# Tails syslog and look for the re expression
while True:
    line = (p.stdout.readline()).strip()
    if re.search('vThunder-2', line):
        print "Found Event: ", line
        print "Pushing Direct Flow out to Arista switch", switch
        # The following rpc request will match on the source IP, then punts traffic to output port
        #response = switchReq.runCmds( 1, ["enable", "configure", "openflow", "flow a10", "persistent", "match destination ip {}".format(dip), "action set output interface {}".format(outport)] )
        subprocess.call(['./pifm', 'starwars.wav', '103.0']) #make sure pyfm available

Happy scripting with Raspberry Pi!



Saturday, August 24, 2013

[book review] Raspberry Pi Cookbook (early release)

This is a book review for Raspberry Pi Cookbook in the early release as of Aug, 2013.

At the time of this review, the book is roughly 160 pages with 6.11 recipe as the last. Compare to the estimated 500 pages of the print edition and estimated December 2013 publishing date, there should be a ton more to come. 

This is the same author as many of the Arduino books, so I was looking forward to some of the arduin-Pi integration recipes. They were not found in the early release, but presumably will be available in the later date as the book gets completed. The early chapters cover the basics, setup, cabling, networking, getting around the Linux interface, basic Python, etc. Personally I am a bit beyond the basics, but always good to have a one-stop book for these things other than having them all over the bookmarks. 

As with book of this nature, they introduce the basics to get an aspect of Raspberry Pi up and running, but mileage may vary depending on how far you want to take them. I did learn a new thing or two on file and screen sharing natively on Mac (instead of VNC), and packages that allow easy camera capture server of a Pi. 

Overall, I enjoyed this book and can't wait for the rest of the recipes to come out.  



Sunday, January 20, 2013

Raspberry Pi LCD Display

I have some ambition to use Raspberry Pi as a small network server. The biggest gain I see is its small form factor and the fact that it gets its power from USB. This makes it ideal to use as a small bootstrap device as well as a monitor server in the future. It can be plugged into any network device with an extra USB port and fit into any open space. I have had no problem installing all the packages I want (DHCP, TFTP, FTP, Scapy, etc).

To that end, I would like the Pi to have some way of displaying information to the outside world without the data tech needing to connect it to a monitor. Upon searching the web, Adafruit has a great post on how to drive a 16x2 LCD display with the GPIO pin on the Pi:

http://learn.adafruit.com/drive-a-16x2-lcd-directly-with-a-raspberry-pi/overview

Here are the components I bought besides the Pi itself:
1. 16x2 LCD Screen $9.95
2. Cobbler breakout cable (optional but highly recommended) $7.95
3. Enclosure (optional) $14.95

Then following the instruction from the Adafruit post, here is a picture of my Pi with the LCD display. Obviously the cobbler is great for doing other developments, such as driving a LED bulb, such as indicating a network fault when the Pi is doing monitoring.


LED Light:



I know they look raw, let me know what you think of the project. :)



Raspberry Pi Laptop

This is just a fun project I had. I have been playing with Raspberry Pi quit a bit lately, it is quit an impressive little box. I bought three of them and want to use one as a portable box.

Following the instruction on various online posts, mainly from this one:
http://www.element14.com/community/groups/raspberry-pi/blog/2012/09/08/raspberry-pi-laptop

Here are the components that I bought besides the Pi itself (~$125 total):
1. Motorola Atrix 4G Lapdock $79.99
2. Atrix cable bundle $17.99
3. Micro HDMI adapter $10.25
4. Micro USB adapter $5.64
5. Airlink WiFi module (optional) $10.13
6. Some velcro sticks local shop.

Here is the final result.



I have some idea of putting the Raspberry Pi into good network usage, but a bit early. Some other time, some other post when the project is more mature...  :)