Tag Archives: linux

Raspberry Pi with stroke and Gesture Recognition

If you are using a touchscreen with your Raspberry Pi, then this guide is for you.

Xstroke (Gesture recognition) is the perfect tool to help you get more out of your touhscreen. I am using a PiScreen

Gesture recognition allows you to draw "strokes" on your touchscreen, which get interpreted as commands or text. Xstroke allows these to be entered anywhere on the screen. In some cases, Xstroke can be used instead of a keyboard.


Continue reading Raspberry Pi with stroke and Gesture Recognition

How to Control the GPIO on a Raspberry Pi with an IR Remote

In this post I demonstrate how to use an infrared remote to control the GPIO on a Raspberry Pi.

Normally a remote would be used to control a TV card or XMBC, however they also provide a good interface to control the GPIO on a Raspberry Pi.
Adafruit has a Mini Remote and IR sensor which are perfect for this.

IR ReceiverMini Remote

In this example we will use the remote to control a number of LEDs connected to some GPIOs on a Raspberry Pi.

Connect the IR Sensor to the Raspberry Pi

Connecting the IR sensor to a Raspberry Pi is very easy as there are only 3 pins on the sensor, GND, 3v and Output. We will connect the output to GPIO 18. You can choose another pin, just take note of it as you will need to specify this pin when installing LIRC.
We will also connected up three LEDs to GPIOs 23, 24 & 25, and a 270Ω on the GND sound of each LED.

IRwiring2

Here is my setup;

OLED.front823back_LRG

Continue reading How to Control the GPIO on a Raspberry Pi with an IR Remote

Software PWM on a Raspberry Pi

If you want to control the brightness of a LED, the speed of a DC motor or the direction of a servo, you will need PWM.

The video shows PWM being used to control the brightness of some LEDs.

Pulse-width modulation (PWM) is used to control the amount of power supplied to electrical devices, especially to DC motors, servos and LEDs.

PWM is able to achieve this by quickly turning off and on the power to the device. The measurement for this is duty cycle.

Duty cycles describes the proportion of 'on'; a low duty cycle corresponds to low power, because the power is off for most of the time.  A high duty cycle corresponds to high power, because the power is on most of the time.

Duty cycle is expressed in percent, 50% is when the power is on half the time and 100% being fully on.

pwm

Continue reading Software PWM on a Raspberry Pi

Pan and Tilt control for the Raspberry Pi Camera

I was fortunate enough to get access to a prototype of Pi-Pan from www.mindsensors.com during their kickstarter.
The kickstarter has finished and they reached their goal.   However they will be selling Pi-Pan from www.mindsensors.com at a future date.


Pi-Pan provides Pan and tilt movements for your Raspberry Pi Camera.
Pi-Pan can pan 180 degrees (from left to right) and tilt 110 degrees (top to bottom).

Pi-Pan comes with two servos, a controller board, screws, a mount and instructions.  It also comes with some python code that shows how the device can be operated.

(The controller board in the image below is a prototype and the production board will be a lot smaller.)

pipan-opt pipan2-opt pipanparts-opt

 

Controlling the GPIO on a Raspberry Pi with a Touchscreen

In this post I show how to control the GPIO on a Raspberry Pi using a touchscreen.
This is a follow up on my previous post Programming for a Touchscreen on the Raspberry Pi

The TFT doesn’t come up too well in the above video. The picture below gives a better idea of how it looks. Click to enlarge

Touch Screen button example

Link to the code;
https://github.com/mwilliams03/Pi-Touchscreen-basic.git

In the above code touchbuttons.c creates three buttons on the TFT which will be used to turn on/off three LEDs.

This can easily be changed to add more buttons.
touchbuttons.c also requires WiringPI and needs to be compiled with gcc -g -o buttonExample buttonExample.c -l wiringPi
Continue reading Controlling the GPIO on a Raspberry Pi with a Touchscreen

Programming for a Touchscreen on the Raspberry Pi

To accept input from a touchscreen we have to use the event interface of the Linux input system. We use the ioctl capabilities of the event interface, in addition to the normal read and write calls to get information from the touchscreen. This blog post explains how to use the touchscreen within your own programs using C as well as writing directly to the framebuffer.

Images of my TFT from a previous post;

TFTTFTTFT

Continue reading Programming for a Touchscreen on the Raspberry Pi

Success with a Balancing Robot using a Raspberry Pi

I have had success with getting PiBBOT to balance.

 

 

 

When I saw my first two wheel balancing robot I was very fascinated.  And after receiving my Raspberry Pi, I decided to build one myself.
PiBBOT (Pi Balancing roBOT) is my first successful balancing robot. And it has room for improvement and extra functionality.

When building PiBBOT, I had a few roadblocks I needed to overcome;

  1. I originally had the Anker as the power source for both Pi and the motors, however the amperage was too low.
  2. Original H-Bridge not powerful enough for my motors
  3. Gyro calculation off by 15 degrees


The TFT displays the angles from the accelerometer, gyro, complementary filter and power to the motors.
The buttons are to turn the motors on and off and to reset the gyro.

BerryIMU Raspberry Pi Gyroscope Accelerometer

What next?

  • Incorporate the wheel encoders for better balance
  • Build a sturdier frame
  • Implement direction control
  • The able to self right itself after falling over
  • Room mapping
  • Retrieve a can of beer from the fridge
PiBBOTPiBBOT TFTMotor Controller
PiBBOT TFTPiBBOTPiBBOT TFT


PiBBOT consists of these components;
Adafruit:
TFT; 2.2" 18-bit color TFT LCD display
RF Receiver :RF M4 Receiver - 315MHz

Pololu;
Motors;  9.7:1 Metal Gearmotor 25Dx48L mm with 48 CPR Encoder
Wheels; Pololu Wheel 90x10mm
IMU; MinIMU-9 v2 Gyro, Accelerometer, and Compass (L3GD20 and LSM303DLHC).

Anker;
Battery; Anker® Astro3 10000mAh  5V / 9V / 12V 2A Dual USB Output External Battery

Tenergy;
Battery; 7.2V Tenergy 3800mAh Flat NiMH High Power
[wp_ad_camp_3]
Continue reading Success with a Balancing Robot using a Raspberry Pi