Pages

Sunday, March 2, 2014

Bicycle Trainer - Take 2

Back in June of 2010 I posted of my work done during winter 2009/2010 to create an interactive bicycle trainer.  Four years later here is an update of where I have gotten.  The work below was done during the winter 2012/2013 and winter 2013/2014.

After two winters of occasional work I now have a truly interactive experience for riding when it gets dark early to make riding during the week dangerous.  The setup measures the speed of the rear wheel and the direction the front wheel is pointing in to display a virtual rider on the screen in front of the bike.

StartScreen

The rig for the bicycle consists of an old mountain bike mounted in a rear wheel trainer.  The front wheel is lifted off the ground using a 2 x 4 “saw horse” which supports the frame just behind the handle bars.  This allows the front wheel to be able to be turned from side to side.

DSCF5929DSCF5931

 

 

 

 

 


The electronics consists of the following:

  1. Right and left buttons for controlling the program.
  2. A Triple Axis Magnetometer to determine the direction the front wheel is pointing in.
  3. Sparkfun Bluetooth Mate Silver to transmit data from the sensors to the computer that drives the display.
  4. Sparkfun Nordic USB ANT Stick for heart rate monitor.
  5. ATmega328p

Layout

The virtual bike rider is positioned on a road.  As the pedals are turned the road moves backwards like a conveyor belt to make it appear that the rider is moving forward.  The speed is determined by how fast the pedals are turned.  If the handle bars are turned to the right the rider drifts to the right side of the road.  When they are turned to the left the rider drifts left.

The rider gains points for the more distance travelled.  The score along with the speed, miles, heart rate and time are displayed on the screen.  (I wasn’t dead when the screen shot was taken I was just riding with out the heart rate monitor.)

To make the game interesting pot holes show up on the road surface.  If the rider doesn’t steer the bike around them then they crash and lose points. 

PreCrashScreen

CrashScreen

There is an interval timer that ends the ride and displays the riders miles, time and score. The number of pot holes is configurable as is the interval timer.

EndScreen

The code for the ATmega was written using the Arduino IDE and the interactive display is driven using openFrameworks.

Below is a short clip of a two minute ride. It isn't too interesting but it does show the display in action.

Saturday, February 22, 2014

openFrameworks / sunxi MFB Update 3 (was pcDuino MFB)

These instructions are for installing the latest copy of openFrameworks for sunxi using the mali framebuffer and rather than X-windows. I used to call this pcDuino MFB but it was suggested to me that as it should run on any of the Allwinner SoCs that I change it to sunxi.

The instructions assume you are running Ubuntu and are in an ssh session and not on the console.

Make sure to read the post about changing debug levels for the mali and ump drivers or you will not get very good performance.

Install git

sudo apt-get install git

Setup your sunxi SoC system to use the Mali Framebuffer

git clone https://github.com/digitalhack/sunxi-mali.git
cd sunxi-mali
git submodule init
git submodule update
make config VERSION=r3p0 ABI=armhf EGL_TYPE=framebuffer
make
sudo make install
make test
sudo stop lightdm
sudo ./test/test


At this point you should see something that looks like this:

clip_image002

Setup openFrameworks

git clone https://github.com/digitalhack/openFrameworks.git
cd openFrameworks


Install Dependencies

sudo apt-get install libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libasound2-dev libxmu-dev libxxf86vm-dev g++ libraw1394-dev libudev-dev gstreamer0.10-ffmpeg libopenal-dev libsndfile-dev libfreeimage-dev libcairo2-dev libgtk2.0-dev python-lxml python-argparse libfreetype6-dev portaudio19-dev libssl-dev libpulse-dev

Install Codecs

sudo apt-get install libmpg123-dev gstreamer0.10-plugins-ugly

Compile and run the pcDuino Hello World Program

cd ./apps/devApps/pcDuino_hello_world_gles2/
make PLATFORM_VARIANT=sunximfb
sudo ./bin/pcDuino_hello_world_gles2

At this point you should see a spinning pcDuino board on a yellow background.

clip_image004
If you have any questions or something doesn't work please leave a comment.

Sunday, December 22, 2013

It Worked For Me - RFduino

This past fall well after its KickStarter campaign had successfully completed I stumbled across the RFduino.  At the time I was looking for a Bluetooth Low Energy solution to pair with my new Nexus 7 tablet.  I very much liked what I saw.  As I had missed the opportunity to support the KickStarter campaign and had several other projects in the works I figured I would wait to hear what people had to say once it started shipping.

I kept an eye on www.rfduino.com checking on how things were going.  As the fall progressed things appeared to be moving along.  In December orders were complete to all the KickStarter backers and they were moving forward on the Pre-order shipments.  I decided that once the backlog cleared I would place my order.

Imagine my surprise when last week while searching the hobby electronics section of the MIcroCenter website I found that MicoCenter was stocking the RFduino and my local store had several in stock.  They had both the RF Digital RF Duino Teaser Kit which comes with a RFduino and an RF Digital USB Shield Accessory Board and single RFduino units.  While the RFduino Teaser Kit was priced below what buying the two modules separately would cost I determined that it looked like the RFduino could be programmed with an Sparkfun FTDI 3.3V board that I already had.

I placed a web order and picked up the unit at the store.

RFduino

Getting an initial application up and running was extremely easy. I followed the instructions in the RFduino Quick Start Guide and using the schematic of the RFduino USB Shield I was able to download a program from the Arduino IDE running on my Windows 7 computer.  I started with a simple application that just printed “Hello World” to the serial port.  When I ran the serial monitor in the IDE I got back “Hello World” from the RFduino.

The pinout between the RFduino and the FTDI board looks like this.  A .01UF capacitor is needed between DTR on the FTDI board and Reset on the RFDuino.

image

Next using the AdvertisementContinous example I setup the RFduino to let the world know it existed.  I was able to see the RFduino using the BLE Explorer Scan application available from Google Play on my Nexus 7 tablet.

I was also able to use an IOGEAR GBU521 Bluetooth 4.0 USB Micro Adapter to see the RFduino under linux using the hcitool lescan and on Windows 7 using the IOGEAR drivers and not the Windows drivers that automatically get loaded when you just plug in the adapter.  Make sure to install the drivers from IOGEAR before plugging in the adapter or you will get a set of Windows drivers that don’t work.

Over the next couple of weeks I hope to develop an application or two that makes use of the RFduino.

It Worked for Me - Nexus 7 2013

Back in July my Acer Iconia Tab A100 died.  I was rather disappointed as I had only bought it a little over a year ago.  However, it gave me an opportunity to see what had developed over the last year in the tablet space and buying something new.

After thinking about it for a while I decided that I would go with same form factor and therefore started looking at 7 inch tables.  Shortly after starting my search I started hearing that Google was going to be releasing a new version of the Nexus 7.  After looking at what else was out there I decided that the new Google Nexus 7 look like the way to go.

I decided to hold off buying one right away and then held off even longer after hearing that there were problems with the GPS.  By September it looked like the GPS bugs had been resolved and I purchased one.

Nexus-7-2013

Fast forward four months…

I have been very pleased with my purchase.  I have mostly used it for portable web browsing and email.  I have found the batter life much better than the Acer and the high-def screen is very nice.  I have fewer problems with the touch screen but I am not sure if that is that I am more accustom to using it or if it works better.

I look forward to using it in some projects.

Saturday, December 14, 2013

Quick Note - pcDuino - Changing Debug Levels (Revised)

I had recently run into an issue where the rsyslogd process was chewing up about 75% of the CPU when I was using the mali driver for GLES2 support. I found out that the mali_debug_level and the ump_debug_level were set to 10. As a result there was a significant amount of messages being generated by these drivers. I changed the mali_debug_level to 2 and ump_debug_level to 2 and the high utilization and the messages went away.

Create a conf file for mali in /etc/modprobe.d with one line in it.
cat > /etc/modprobe.d/mali.conf
options mali mali_debug_level=2
^D

Create a conf file for ump in /etc/modprobe.d with one line in it.
cat > /etc/modprobe.d/ump.conf
options ump ump_debug_level=2
^D

I believe this will still get you critical and error messages.
Related commands:
  • To list settable options for a module use: modinfo <module>
  • If module isn’t loaded you can do modprobe <module> [<parameter>=<value>]
  • To determine active value look in /sys/module/<module>/parameters

openFrameworks / pcDuino MFB Update 2

These instructions are for installing the latest copy of openFrameworks for pcDuino using the mali framebuffer and not X-windows. The instructions assume you are running in an ssh session and not on the console.

Make sure to read the post about changing debug levels for the mali and ump drivers or you will not get very good performance.

Install git

sudo apt-get install git

Setup the pcDuino to use Mali Framebuffer

git clone https://github.com/digitalhack/sunxi-mali.git
cd sunxi-mali
git submodule init
git submodule update
make config VERSION=r3p0 ABI=armhf EGL_TYPE=framebuffer
make
sudo make install
make test
sudo stop lightdm
sudo ./test/test


At this point you should see something that looks like this:

clip_image002

Setup openFrameworks

git clone https://github.com/digitalhack/pcDuino-openFrameworks.git
cd pcDuino-openFrameworks
git checkout -b pcDuino-dev origin/pcDuino-dev


Install Dependencies

sudo apt-get install libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libasound2-dev libxmu-dev libxxf86vm-dev g++ libraw1394-dev libudev-dev gstreamer0.10-ffmpeg libopenal-dev libsndfile-dev libfreeimage-dev libcairo2-dev libgtk2.0-dev python-lxml python-argparse libfreetype6-dev portaudio19-dev libssl-dev libpulse-dev

Install Codecs

sudo apt-get install libmpg123-dev gstreamer0.10-plugins-ugly

Compile and run the pcDuino Hello World Program

cd ../../../apps/devApps/pcDuino_hello_world_gles2/
make PLATFORM_VARIANT=pcduinomfb
sudo ./bin/pcDuino_hello_world_gles2

At this point you should see a spinning pcDuino board on a yellow background.

clip_image004
If you have any questions or something doesn't work please leave a comment.

Wednesday, October 30, 2013

openFrameworks / pcDuino MFB Update 1

I am in the process of updating openFrameworks for pcDuino MFB which provides support for openFrameworks on the pcDuino using the Mali frame buffer.  I have setup a new repository based on the latest openFrameworks release and have applied the pcDuino Mali frame buffer changes that I developed last spring.  The latest openFramework release has incorporated the Raspberry Pi changes which the pcDuino changes are patterned after.

The new repository and the appropriate branch can be found at: https://github.com/digitalhack/pcDuino-openFrameworks/tree/pcDuino-dev

The repository has the changes in it and I have successfully compiled several of the examples and several of my own test programs.  What I haven’t tested is the install process.  I hope to get to that over the next week or so.

If you give it a try I would be interested in hearing from you (leave a comment) and if you find something that doesn’t work please put an issue in for the repository.