My pi-Racey project has been keeping me busy the last week. It has progressed significantly in this time, as described below.
This project used the popular Raspberry Pi Java library Pi4J to provide an interface to the Pi’s GPIO pins. It also used web sockets to communicate between the Pi and a remote in the form of a website.
As mentioned in my last post, web sockets could potentially be problematic due to there being no guarantee of reliable WiFi in an area where the car should be useable.
This led me to research other possibilities of wirelessly controlling the car.
Infrared: Commonly used in television remotes and other devices but requires device and sender to be in each other’s line of sight.
Original Remote Control: The original remote control of the car could be modified so it’s signals are picked up and handled by the Raspberry Pi instead of the original receiver. However, this could be difficult and require a detailed electronics knowledge.
Bluetooth: Arguably, the most sensible option available. Bluetooth’s max range is around 100m and is present in many devices, such as mobile phones, that could allow easy connectivity to provide control to the vehicle. It was for this reason I decided that Bluetooth would be used to control pi-Racey.
Through the use of a Bluetooth USB adapter, the Pi is able to use the Bluetooth wireless exchanging standard.
Following the Kaazing project, I searched for a Bluetooth library that could be used with Java and Pi4J. This led to BlueCove, an open source JSR-82 implementation of Bluetooth written in Java.
The library provides a bridge between the application layer of the Java VM and the Bluetooth stack/controller and can be used to pair devices, as well as send messages between each device.
However it was clear from the beginning that the library, despite providing a potential solution, was complex and would make a relatively simple task (i.e. pair a device) a lot of spaghetti code that is difficult to understand for anyone unfamiliar with the library.
For this reason, I considered other options.
Through some further research, I discovered the CWiid project, a collection of Linux tools written in C for interfacing to the Nintendo Wiimote on Linux platforms.
The Wiimote is a wireless peripheral for the Nintendo Wii games console that uses Bluetooth to allow the device to be used as the console’s remote. It has a number of buttons and a directional pad that could be utilised to control the car.
The main advantage of using a Wiimote is the CWiid library makes the connection between the Wiimote and any Bluetooth adapter used with the Pi and can easily interface with the buttons on the remote.
To continue the project, I decided to scrap the use of Java and Pi4J and move to Python as the
python-dpi.gpio libraries allow easy programming with both the Pi’s GPIO and an external Bluetooth Wiimote.
To start testing on the Pi, the system will require multiple libraries and drivers. These can be easily installed through the following commands:
$ sudo apt-get update
$ sudo apt-get upgrade
Update packages and packages list
$ sudo apt-get install --no-install-recommends bluetooth
Install bluetooth drivers to allow communication to bluetooth devices, such as the Wiimote
The parameter ensures only the bare essentials of the bluetooth driver is installed
$ sudo apt-get install python-cwiid
Install the CWiid Python library
$ sudo apt-get install python-rpi.gpio
Install the Python Raspberry Pi GPIO library
Once a compatible Bluetooth adapter has been plugged into the Pi, the status of the Bluetooth service can be tested through the use of
sudo service bluetooth status - This should return a message of
[ ok ] bluetooth is running. which indicates Bluetooth is running correctly. Should any other message appear, the Pi should be restarted.
Once Bluetooth is running correctly on the device, the Wiimote can be visible to the Pi. This is easily completed using
Whilst pressing the 1 and 2 buttons simultaneously on a WiiMote, run
hcitool scan on the command line to view all visible bluetooth devices. A device found that uses the name of “Nintendo RVL-CNT-01” indicates a Wiimote is visible.
Finally, a test script can be used to test out the Wiimote and the GPIO’s working in harmony.
Using this Python script (wii_connect.py), I was able to create a simple test along with a simple bicolour LED circuit. Pressing the A button creates a red light and pressing the B trigger shows a green light.
The video below shows this test in action
I shall detail the next few stages soon. There is still plenty of coding to complete and many electrical component to add.
Working at Boppl has, over the last 10 months, led to some exciting opportunities for me but the latest in-office challenge has brought the best of the techy/geeky sides out in all of us.
The challenge, presented to us by our CEO, was as follows:
With a budget of £200, create the best remote control car you can subject to the following rules:
- No pre-built Cars - Cars must be in the form of kits
- Images of the cars being built must be submitted to show you were the sole creator of your vehicle
- All cars must cost less than £200 (Half of which will be subbed) and all parts must be sourced from the UK
- All cars must be electric. Petrol cars or other engines are not allowed.
- You have 3 months (roughly) to complete your car
- (More rules can be added at any time)
The competition will compose of a series of tests that will put the cars up against each other and test numerous factors of the cars design. These tests are TBC, as are any prizes.
Many of the team went for the approach of purchasing professional looking kit RC cars such as Dark Impact to enter the competition. Clearly these cars can be upgraded through the purchase of components to replace their counterparts found in the kit. This allows cars to have faster motors, bigger wheels or even larger batteries. However, this approach did not suit me. I wanted to do something different and enter the challenge in my own unique way. Pi-Racey was my idea.
Having recently purchased a Raspberry Pi and tinkered with electronics using the Pi’s GPIO, I wondered how I could compete by using a Raspberry Pi to control an electric remote controlled car.
Through some initial research I came across a sample project from Kaazing that used web sockets to control a remote controlled car via a RaspPi and a website. I decided that I would use this project as a guide and ask if I could compete using this method.
The main issue with this approach would be the almost certain breaking of Rule 1, as the car would likely require to be pre-built to house the Pi and the components correctly. I requested that my car should be exempt from this rule and permission was granted on the grounds that idea was a novel solution.
This mini-blog will document my progress over the next few months in the completion of my car, that I have named pi-Racey.
The Kaazing project, as a guide, should help provide the basics of how to build the car through multiple additional components. But I imediately noted some unique constraints that will mean pi-Racey will require the Kaazing project to be modified. Such constraints include:
I am hoping that in the upcoming months, these issues are addressed and I am looking forward to seeing how these affect the project.
The goals of the project are simple:
The competition has only just begun. I shall attempt to post regular updates on how the project is going.
It is no secret, to those that know me, that I have an unhealthy obsession. An obsession that has consumed much of my free time since the late 90’s and that will no doubt to continue well into my adulthood. The obsession I refer to is, of course, the crazy world of Pokémon. To some it is a childhood memory, but to millions it is as big now as it has ever been in its near 20 year existence. It has a well established online community that continues to grow year by year.
The latest Pokémon games (X & Y), the first non-spin off Pokémon games partially in 3D, have boosted the franchise to new levels. Increasing numbers are becoming interested in the more advanced concepts and mechanics within the games. These include the breeding mechanic, EV training and shiny hunting.
It is the breeding mechanic that interested me primarily and led to the concept of Breedr.
Breeding is a simple concept within the game:
Pokémon breeding is a method of obtaining a new Pokémon by producing and hatching an Egg. The new Pokémon will inherit certain traits from its parents and this can be controlled through the use of breeding items. Movesets, Abilities, Capture Ball and IVs can all be passed down.
However, the mathematics behind the scenes are slightly more advanced.
The Breedr project was born from my interest in these mathematics and Android development. Very few “Breeding” apps exist for the platform and the overall quality of existing apps is extremely poor. It became my goal to create an app that is both useful for “breeders” and visually appealing.
The app will provide key information to breeders to help them make more informed decisions about their breeding strategy based on their overall goals.
(I will discuss specific features in future, but for the time being I will be keeping these private.)
The app has been in development for a number of months on an extremely part time basis. Unfortunately, due to other commitments, the app has not progressed especially far in this time and this schedule will continue ‘ad interim’.
I can reveal that the app will support devices running Android 1.6+, meaning nearly 100% of Android devices currently in use around the world will be able to run the application. I wanted to make the app accessible globally and target both older players as well as younger players of the games.
Furthermore I can also reveal that I intend to release the application for FREE. The current plan is that app will also contain no advertising. I am a firm believer in free software and believe that an application such as Breedr, despite having a huge target audience, should allow users a great user experience and provide a great service without bombarding users with intrusive advertising.
My stance on this may one day change, but at this time of writing I believe that it is highly unlikely to be the case in the distant future. I may look into the in-app payment route for additional features, but one of my key goals is to keep the app accessible to all.
It should be noted that no iOS release is currently in the works. Depending on the success of Breedr, an iOS version may be created.
The project has just begun and with no release date or timeframe for the completion of the project, I may struggle to find enough time to dedicate to Breedr.
I would welcome and be so grateful for any help from Graphic Designers, Programmers, Web Developers etc. on this project as I believe the end product could be widely used and successful in the community.
Please do not hesitate to contact me at firstname.lastname@example.org if you wish to get involved.
More information will be released shortly.
After months of development I am proud to announce the launch of my debut application Boppl. The app allows users to order food and drink at selected venues using a mobile device.Ordering with Boppl allows you to spend more time with friends, rather than waiting for service or in a line. It also lets you order your next round of drinks, even on your way to the next bar.
Check it out.
This is a test post.