Tag Archives: linux

Raspberry Pi with a 1.8" TFT shield

I'm using a shield from Texy to attach my TFT to my Pi.

TFT ShieldTFT shield

This is soooo much easier then connecting up the cables individually, which requires me to always refer to the wiring diagram... and it always takes me two or three goes to get it right.

This just requires a quick snap onto the top of the GPIO pins. It also includes wiring to use 3 buttons on the GPIO pins not being used by the TFT.

Look here to find out where you can get one;
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=59&t=40674







Continue reading Raspberry Pi with a 1.8" TFT shield

Automatic login between two Raspberry Pi hosts

If you have multiple Raspberry's or even multiple Unix hosts , you will start to get frustrated at constantly having to enter a password every time you copy files between them or access these devices from another Unix host.


There is an easy way to disable this with RSA key pairs.

  1. On each host, enter ssh-keygen
  2. Hit enter to keep the default directory.
  3. Passphrase.  Leave blank and hit enter
  4. Your keys are created under .ssh/

Now you need to copy over your key to all the other hosts with;
ssh-copy-id -i .ssh/id_rsa.pub username@serverip



Once this is done, you should now be able to copy files or access each device without having to use passwords.

You still need to enter a password when trying to connect from a host that hasn't got a key.


Continue reading Automatic login between two Raspberry Pi hosts

Raspberry Pi with a 2.2" TFT

 

Notro has done some great work with developing drivers for different models of TFT displays for the Pi.
He successfully created one for the Adafruit 2.2" TFT . This is a great little display and is very clear.

Notro's Wiki with instructions can be found here.

As with the 1.8" TFT from Adafruit, this device can be used to display video, images and your own data with easily using pygame.

A couple of images from my Pi running the 2.2 TFT;

photo2.2TFT

PiTFT22-1

 

 
Continue reading Raspberry Pi with a 2.2" TFT

PiBBot - Robotic Project - Phase 1 - Testing Components

This is the first phase on my Balancing Robot project.
Which I think I will call PiBBot. (Pi balancing Bot)

I want to test all the components first before I put them in their final position on the frame for my balancing robot.

Components2
Components1

Hardware list;

  • Raspberry Pi rev 2
  • Two breadboards
  • 1.8" TFT, connected via SPI
  • Three 8x8 led matrix's connected via I2C
  • One MinIMU  (Accelerometer, Gyro & Compass) all connected via I2C
  • H-Bridge to control the motors
  • Temperature sensor connected via I2C
  • 315Mhz RF Receiver
  • One LED

Click the image below to see the components named on the breadboard;
Breadboard with Labels

Continue reading PiBBot - Robotic Project - Phase 1 - Testing Components

Raspberry Pi, 1.8" TFT, RF Receiver and Temperature Sensor

Below is some detail regarding the latest project I have been working on. Which is near completion.
I plan to wire it up permanently, place within a case and wall mount it.

 

 

Some of the images don't come up too great in the video, I have included the actual images used here;

Temp12 hour GraphGraph
TextText

I created a simple one line bash script that polls for the temperature every 5 mins.

The main python program uses pygame to write to the TFT via a framebuffer and Matplotlib is used to create the Graphs.
The display can be changed by either the button on the breadboard or via the remote FOB.

Continue reading Raspberry Pi, 1.8" TFT, RF Receiver and Temperature Sensor

How to Test the SD Card Speed on Your Raspberry Pi

Some of us will have multiple SD cards lying around. And sometimes it isn't obvious which one is the best to use.

Here is how you can check the speed of your SD cards which may help you with choosing the fastest one.

hdparm is a good tool to view disks reads, from the disk and from the buffer. We will use two options for hdparm;

  1. The speed of reading directly from the Linux buffer cache without disk access. (-t option)
  2. The speed of reading through the buffer cache to the disk without any prior caching of data. (-T option)

The first shows us an indication of the throughput of the processor, cache, and memory of the system under test. The second measures how fast the drive can sustain sequential data reads, without any filesystem overhead. It is also best to run this command multiple times to see the affect of the caching.

 

Need to install hdparm, and then run it at least twice.
From my output below, you can see that the response for the cached reads increased the second time I ran hdparm.

pi@raspberrypi ~ $ sudo apt-get install hdparm
pi@raspberrypi ~ $
pi@raspberrypi ~ $ sudo hdparm -tT /dev/mmcblk0  /dev/mmcblk0:
Timing cached reads: 104 MB in 2.01 seconds = 51.67 MB/sec
Timing buffered disk reads: 58 MB in 3.03 seconds = 19.12 MB/sec
pi@raspberrypi ~ $ sudo hdparm -tT /dev/mmcblk0  /dev/mmcblk0:
Timing cached reads: 188 MB in 2.03 seconds = 92.76 MB/sec
Timing buffered disk reads: 60 MB in 3.03 seconds = 19.83 MB/sec
pi@raspberrypi ~ $

 

 

DD can also be used to test SD card speeds.
WARNING: you must be careful using DD as incorrect options can erase your SD card.

This command will write a 200MB file called test to the SD Card;
dd if=/dev/zero of=test bs=1048576 count=200

This command will read the 200MB file created in the first command;
dd if=test of=/dev/null bs=1048576

 

pi@raspberrypi ~ $ dd if=/dev/zero of=test bs=1048576 count=200
200+0 records in
200+0 records out
209715200 bytes (210 MB) copied, 9.6409 s, 21.8 MB/s
pi@raspberrypi ~ $
pi@raspberrypi ~ $ dd if=test of=/dev/null bs=1048576
200+0 records in
200+0 records out
209715200 bytes (210 MB) copied, 10.2369 s, 20.5 MB/s
pi@raspberrypi ~ $

 


Continue reading How to Test the SD Card Speed on Your Raspberry Pi

View images as ASCII in the terminal on a Raspberry Pi

I run my Raspberry Pi headless and I don't like to access X windows.
Sometimes I need to look at an image, mostly PNG. I use my Pi to produce graphs and I want to see if the change took.

cacaview allows me to view the images as ASCII in the terminal. Which allows me to have a quick look at the image, and it also looks kinda cool and retro.


Cacaview Raspberry Pi



Install and using cacaview


Installing cacaview:

pi@raspberrypi ~ $sudo apt-get install caca-utils


To view an image:

pi@raspberrypi ~ $cacaview gp.png


+ Zoom in
- Zoom out
d Change differ
hjkl Move



Continue reading View images as ASCII in the terminal on a Raspberry Pi

Send emails with attachements from the Linux command line.

If you are like me and you are running your Raspberry Pi headless, and don't want to start up X windows to send a simple email. You are in luck, as this can easily be done from the command line. And it is very easy to setup.

Note; This is only to send email, and not receive.


- Install SSMTP

pi@raspberrypi ~ $sudo apt-get update
pi@raspberrypi ~ $sudo apt-get install ssmtp


-Configure SMTP

pi@raspberrypi ~ $ sudo nano /etc/ssmtp/ssmtp.conf

Add add these lines;

root=username@gmail.com
mailhub=smtp.gmail.com:465
rewriteDomain=gmail.com
AuthUser=username
AuthPass=password
FromLineOverride=YES
UseTLS=YES


Use your email address for root, and your gmail username and password for AuthUser and AuthPass.



To send an email
To send an email, run SSMTP with the recipients name.
SSMTP will then wait for you to type your email. It has to be formatted as shown below. And once done, press Ctrl-D to send.

pi@raspberrypi ~ $ ssmtp mail.address@example.com
subject: this is a test
hello world!
pi@raspberrypi ~ $


Continue reading Send emails with attachements from the Linux command line.

How to Cross Compile the Kernel for the Raspberry PI

August 2015 ## This guide has been updated to the latest version of Raspbian ##

Compiling the kernel on the Raspberry Pi can take some time, Im not sure how long it takes as I have never waited long enough, I gave up after 4 hours.
Below is a guide on how to compile the kernel on a faster PC and then transfer the new kernel and modules over to the Raspberry Pi.

Cross compiling is when you compile on a different platform then what the kernel will be used for. This is mostly done when the host receiving the kernel is on a slow or legacy device.

 

Continue reading How to Cross Compile the Kernel for the Raspberry PI