Tag Archives: Raspberry Pi 2

Heads up!

The Raspberry Pi has now been fitted to the Bioloid using some spare brackets and sponge padding.

A GUI for the Pi’s screen has also been made using Python, Tkinter and the rospy library. This is actually my first Python program from scratch, so it’s far from perfect but it’s simple and does the job for now!

The program visualises the sensor data from the force sensors and IMU, which the Arduino is publishing on ROS topics. The slider values are unfiltered data, the same which is used by another ROS node to fuse the IMU data and provide a good estimate of the torso’s 3D orientation. The roll/pitch/yaw widgets are used to visualise a simple transformation of the accelerometer/magnetometer data, as was performed previously here. The force sensing resistor (FSR) widget is not active, as the resistors have not been wired in yet, but eventually each FSR’s value will be visualised with a coloured square box ranging from yellow (un-pressed) to red (fully pressed).

Custom Conky on the Raspberry Pi 2

I thought I’d share my Conky configuration currently running on my Pi for anyone interested, as it’s a great tool for displaying useful system information on the desktop. It’s designed for a 480×320 resolution screen, as it is running on this touchscreen, and it takes up all the available space on the Raspbian desktop, minus the menu bar (26 pixels high).

One problem that took me quite a while to solve was how to actually get Conky to launch at startup, as none of the usual methods seemed to work. In the end I found two ways of calling a startup script. First, create a simple Bash script, like this:

#!/bin/bash
sleep 10 && conky -c ~/Scripts/.conkyrc_raspberry-pi-2 -d

Save it e.g. as ~/Scripts/startConky.sh. Then, make the script execute at startup in one of the following two ways:

  1. Open the file /etc/xdg/lxsession/LXDE-pi/autostart as sudo, and add the following line to the end (solution found here):
    @~/Scripts/startConky.sh
    
  2. Alternatively, create a file ~/.config/autostart/startConky.desktop, which contains the following lines (as explained here):
    [Desktop Entry]
    Name=conky
    Type=application
    Exec=/home/pi/Scripts/startConky.sh
    

Here are some screenshots of Conky in action. Feel free to use my config however you want!


My Conky config:


# Conky config file

# Avoid flicker
double_buffer yes

# Window
# Own window to run simultaneous 2 or more conkys
own_window yes
own_window_type normal
own_window_hints undecorated, below, sticky, skip_taskbar, skip_pager
#own_window_transparent yes

# Borders
draw_borders no

# Shades
draw_shades yes

# Position
gap_x 0
gap_y 34
alignment top_middle

# Behaviour
update_interval 2

# Font
#font arial
use_xft yes
#xftfont arial:size=8
xftfont Bitstream Vera Sans Mono:size=8
#xftfont Terminus:size=8
xftalpha 1 # Text alpha when using Xft

# Colours
#default_color d1d3c9
#default_shade_color 000000
own_window_colour 2B2B2B

# Prevent window from moving
use_spacer none

# Minimum size of window
minimum_size 464 280

# Maximum width of window
maximum_width 464


TEXT
${font Arial:size=12}${color #ddaa00}${time %I:%M %p}${font}            $alignc${color #9fb6cd}UpTime: ${color }$uptime $alignr${color #9fb6cd}Temp.: ${color ff0000}${execi 2 vcgencmd measure_temp | sed 's/[^0-9.]*//g'} °C
${color }${hr}
${color #9fb6cd}CPUs${color }
${color #9fb6cd}1: ${color }${cpugauge cpu1 30, 60}  ${cpugraph cpu1, 30, 125 ffff00 ff0000 -t} $alignr${color #9fb6cd}2: ${color }${cpugauge cpu2 30, 60}  ${cpugraph cpu2, 30, 125 ffff00 ff0000 -t}
${color #9fb6cd}3: ${color }${cpugauge cpu3 30, 60}  ${cpugraph cpu3, 30, 125 ffff00 ff0000 -t} $alignr${color #9fb6cd}4: ${color }${cpugauge cpu4 30, 60}  ${cpugraph cpu4, 30, 125 ffff00 ff0000 -t}
${color }${hr}
${color #9fb6cd}MEM
${color }${memgauge 30, 60}  $alignr${memgraph 30, 380 0000ff ffff00 -t}
${color }${hr}
${color #9fb6cd}UP $alignc${color #9fb6cd}IP: ${color }${addr wlan0} $alignr${color #9fb6cd}DOWN
${color }${upspeedgraph wlan0 30, 220 0000ff ff0000 -t} $alignr${downspeedgraph wlan0 30, 220 0000ff 00ff00 -t}

Pi power!

Battery

Most of the parts for the Bioloid’s power supply have now arrived. Here are some pictures of the Pi 2 being powered by the 11.1 V, 5500 mAh battery. The battery also powers the SMPS2Dynamixel adaptor for the Dynamixel servos. The step-down to 5 V for the Raspberry Pi is performed by a 3A UBEC (Universal Battery Elimination Circuit), which has a handy MicroUSB output. This seems to be the ideal way of powering the Pi, rather than e.g. via the powered hub or GPIO pins, which bypass the voltage protection, especially when considering that the Pi has to power the peripherals. The USB2AX for the servo control is powered via the Raspberry’s USB port, as will the A-Star MCU.


Raspberry Pi 2

The Pi is currently running Raspbian and now also has this great 480×320 touchscreen from Adafruit! I installed ROS Indigo from source using this guide. I have also added Conky on the desktop, a lightweight and fully customisable system monitor, as a way of directly visualising the Pi’s current status. The touchscreen feature of the screen will be of use in the future, if some simple GUI is made for the robot.


Hardware layout

The next picture shows the current hardware layout of the whole robot. As there is a lot to power, I went for the beefy 5500 mAh battery, but as it weighs 417 grams, I might have to eventually get something lighter for the robot to be able to carry, at the expense of a shorter run time.

Hardware diagram

Hardware diagram