Posts Tagged ‘Arduino’
RoboBrrd’s Interactive Games Interfacing
One of the things that has been bugging me about RoboBrrd the past two days is wondering how it will interact with the software games. When planning this, I was thinking of making the games in Processing (Java). However, Java is getting old, and with new technologies on the rise, like websockets, I wanted to research this more.
You may be wondering, why are the interactive games so important for RoboBrrd anyway? If you are just trying to create an educational robot, who needs the games and software? We want to create a blended reality between the real RoboBrrd and the virtual RoboBrrd for the student, so that it is always accessible and available to the student to learn, hence the prior nickname ‘Learning Pet’. RoboBrrd is more than a robot, it’s a way to actively interact with virtual based learning applications.
One of the cool ideas that is arising in the hardware-software interface realm is driverless and middlewareless communication. The HIDUINO is a really cool implementation of this. Check out the website and the video for more information. http://dimitridiakopoulos.com/hiduino
Here are some ideas of ways of communicating that I was exploring:
- Socket.io on remote server
Benefits:
Sleek, new way of interfacing
Active community
Games are in the browser
Real time
Problems:
Hosting for node.js with socket.io…
Would have to run some sort of middleware to communicate between the socket and the Arduino.
- RoboBrrd as a keyboard HID
Benefits:
Easy way to interact with a game on a server
No middleware needed
Problems:
Only one way communication
- RoboBrrd as an audio or video HID
When researching this I found some ways of communicating to a usb webcam, but it is only for video streams mainly.
- RESTful API with AJAX auto-reload
Benefits:
Auto refresh
Openable API
Problems:
Still need a fancy server to enable long running ajax processes
- Processing game, RESTful API
Benefits:
It would work.
Problems:
It’s ancient.
Here are interesting links that were explored while researching:
physical-js JavaScript-based physical computing
Circuits@Home lots of USB Host & HID information here
Garmin communicator did some interesting this with communication
Mozilla Audio Data API
jasmid MIDI synthesis
WebRTC
getUserMedia
Device element discussion
Implementing device
WebRTC Group
LUFA
Node.js and Socket.io
Ajax periodic refresh
RESTful API with PHP and Apify
Node.js and WebSockets Demo
Nodejitsu
NodeSocket
Cure
Cloudnode
Webbynode
Nodester
Joyent
Heroku
nowjs
As you can see, the implementation that would most likely work would be the Processing game with a RESTful API back to the server for storing data. So yes, I did pretty much just go around in a complete circle, but I think that learning about more ways to communicate between software and hardware is really interesting.
So, happy holidays everyone- and there will be a week 2 progress update post later this evening!
Android ADK Background Service
I was playing around with the ADK and wondering how it would be possible to make the connection work while the app was in the background. The first way I tried was to not close the connection in onPause(). This worked, since the file input and output streams were able to continue … until they were garbage collected. When other Android apps run in the background, they use a Service. I tried this out with the ADK, and it works! Check out the video demonstration below.
Watch video on YouTube
The initialization and opening of the ADK is still done in the main activity. We use the Application class as a friendly singleton to transfer the streams, file descriptor, and usb accessory over to the Service.
-
private void enableControls(boolean b) {
-
((ServiceADKApplication) getApplication()).setInputStream(mInputStream);
-
((ServiceADKApplication) getApplication()).setOutputStream(mOutputStream);
-
((ServiceADKApplication) getApplication()).setFileDescriptor(mFileDescriptor);
-
((ServiceADKApplication) getApplication()).setUsbAccessory(mAccessory);
-
// … snip …
-
}
Creating the Service is rather straight forward. In ServiceADKActivity:
onCreate()
-
startService(new Intent(this, ADKService.class));
onPause()
-
try {
-
ADKService.self.startUpdater();
-
Log.d(TAG, "Starting the updater failed");
-
}
onResume()
-
try {
-
ADKService.self.stopUpdater();
-
Log.d(TAG, "Stopping the updater failed");
-
}
When the Service is started, it creates an Updater thread, which runs every second.
-
if (!updater.isRunning()) {
-
Log.d(TAG, "updater not running");
-
updater = new Updater();
-
updater.start();
-
} else {
-
Log.d(TAG, "updater running");
-
}
In background, this can run for a very long time. I let it be for 12 hours before I stopped it.
However… there is a very bizarre bug. Sometimes when the app returns to foreground, it can’t reconnect to the ADK. The main problem is with the USB Manager trying to open the accessory for some reason. The app has permissions to the accessory, and it prints out the connected accessory correctly. Here is my trace of the bug:
-
@Override
-
public void onResume() {
-
-
Log.v(TAG, "onResume");
-
-
// —- onResume is called —-
-
-
super.onResume();
-
-
try {
-
ADKService.self.stopUpdater();
-
Log.d(TAG, "Stopping the updater failed");
-
}
-
-
// —- updater is indeed stopped —-
-
-
Intent intent = getIntent();
-
-
if (mInputStream != null && mOutputStream != null) {
-
Log.v(TAG, "input and output stream weren’t null!");
-
enableControls(true);
-
return;
-
}
-
-
// —- the file i&o streams are null —-
-
-
UsbAccessory[] accessories = mUsbManager.getAccessoryList();
-
-
Log.v(TAG, "all the accessories: " + accessories);
-
-
// —- shows the connected accessory —-
-
-
UsbAccessory accessory = (accessories == null ? null : accessories[0]);
-
if (accessory != null) {
-
if (mUsbManager.hasPermission(accessory)) {
-
-
// —- there is permission, going to open the accessory —-
-
-
Log.v(TAG, "mUsbManager does have permission");
-
openAccessory(accessory);
-
} else {
-
Log.v(TAG, "mUsbManager did not have permission");
-
synchronized (mUsbReceiver) {
-
if (!mPermissionRequestPending) {
-
mUsbManager.requestPermission(accessory,
-
mPermissionIntent);
-
mPermissionRequestPending = true;
-
}
-
}
-
}
-
} else {
-
Log.d(TAG, "mAccessory is null");
-
}
-
-
-
}
-
-
-
private void openAccessory(UsbAccessory accessory) {
-
-
Log.e(TAG, "openAccessory: " + accessory);
-
-
Log.d(TAG, "this is mUsbManager: " + mUsbManager);
-
-
// —- prints out the address of usb manager fine —-
-
-
mFileDescriptor = mUsbManager.openAccessory(accessory);
-
-
// —- Error in log from UsbService: E/UsbService( 110): could not open /dev/usb_accessory
-
-
Log.d(TAG, "Tried to open");
-
-
if (mFileDescriptor != null) {
-
mAccessory = accessory;
-
mThread.start(); // meep
-
Log.d(TAG, "accessory opened");
-
enableControls(true);
-
} else {
-
Log.d(TAG, "accessory open fail");
-
enableControls(false);
-
}
-
}
Does anyone know why this may be? I have tried to work around it numerous times but to no luck yet.
You can grab the code off of my GitHub to play around and test it.
It would be great if we could fix this bug!
apps4arduino – Meters for Arduino on iOS, Introducing Wijourno!

Meters for Arduino is now available for iOS! You can get it on the App Store here:
http://itunes.com/apps/metersforarduino
It communicates with Meters for Arduino on Mac, which just had a 1.1 update. You can get it on the Mac App Store here:
http://itunes.com/mac/metersforarduino
Meters for Arduino on iOS works with the magic of Wijourno. Wijourno lets you communicate with your iOS devices and your Mac.
It’s a lot of fun, since you can send messages to specific devices, or broadcast a message to all devices. I’m imagining things where (for robots) you could have the iPad displaying lots of diagnostics and such, the iPhone would be the controller, and the Mac would be the data logger and connection to the internet!
Check out the apps4arduino site for more information, including some details on how you can use Wijourno in your own Apps.
Can’t wait to see what people are going to make with this!
World’s Maker Faire NYC 2011!
Maker Faire NYC was great! We showed off four of my robots, Learning Pet, DOGCOW, RoboBrrd, and MANOI!

We were located at the Robot Square which turned out to be a really great location!

By far the most popular was RoboBrrd Food! It was so crazy. The kids kept feeding the RoboBrrd constantly, they wouldn’t stop!
And if they had to stop, sometimes they would start to cry or whine to their parents. It was great! It was funny to see how the younger kids understood what to do right away, when the older ones didn’t really know. As for the adults, you had to tell them to try feeding the RoboBrrd, they never did it automatically haha! Here is a video of RoboBrrd food in action, thanks to VayaConQueso!
You can learn more about RoboBrrd Food by reading the blog post, watching the video and looking at the source code!
Learning Pet was a close second to the most favourite robot. It was great to see everyone interacting with it. Some of the kids played right through from level 1 to 5, so they could see the super duper Learning Pet victory dance celebration!


Here’s a video explaining Learning Pet thanks to the NY Hall of Science:
You can learn more about Learning Pet in my Open Hardware Summit blog post, through this video, and on its website!
As for MANOI the hockey playing humanoid robot, most of the time its battery was running out! So lame! MANOI was always pretty much sitting down, like in this photo:

However, MANOI did appear at the 0:21 mark in the Engadget show. It was pretty crazy when they were filming, they were super professional, and no one knew they were from Engadget!

You can watch the Engadget show here!
To learn more about hockey MANOI, you can explore the MANOI tag and watch this video!
One of the favourite things was explaining everything to all the people. It’s fun to see their reactions and what they think of the projects. Plus, since there are so many people, what you say each time becomes more fine tuned!

Meeting people at the Maker Faire is great! Here is me with lots of Propeller boards with Jessica from the Parallax videos!

Check out all of the stuff that I brought home! I’m super excited to use all of this!

Some notables include:
- Tons of XBees YAY
- seeedstudio ADK kit WOOT
- Parallax!!!!!
- netduino, pulse sensor, white lol shield, shapelock, tshirt (bought these
)
- Maker Passport (a repurposed Hackerspace passport) with lots of cool signatures in it! AWESOME!
I also managed to see Arc Attack for the first time in person ever! It is super cool, definitely recommend it! The sound seems so much clearer than anything else. The blue shining in from the glass was really amazing too, and all of the waves in the wall. I waited in line with a friend from university, Matt Krass, and his friends so it was pretty awesome. (I then forgot to say bye as I left, DOH! Was in a rush to get back to my robots!)

At the end of the Maker Faire, there were these blue ribbons being given out, and everyone I asked had no idea what they were. I asked the guy giving them out, and he said that they are *only* for awesome projects. To be honest, I got a little upset at this (my projects aren’t awesome?! whaaat?!), but he was kind enough to visit my table and hear me explain all my projects!
Here’s a video of me explaining ALL of the robots thanks to Chris Connors:
And then after that, he awarded me his very last Maker Faire Editors Choice award! Wow!
Yay! Thanks again, Chris!
The trek back home was interesting! My parents drove down to bring me back. The fog in the Adirondacks at night is intense! We slept in a Walmart parking lot too
I was super tired the whole time, falling asleep a lot.

Afterwards, my robots were featured on MAKE! What a super honour! Gareth is a pretty cool person, next Maker Faire we are definitely going to make some BEAM robots!

There were some people that I didn’t get a chance to meet, hopefully next time there will be that chance! Special thanks to Jonah and Katherine for letting me sleep on their (very nice) couch for OHS and Maker Faire! Thanks to everyone who made the Maker Faire NYC 2011 so much fun! It was a pleasure meeting everyone who came by the table, and hope to see you all next year!
Sale Extended! Buttons for Arduino & Meters for Arduino
The sale for Buttons for Arduino and Meters for Arduino has been extended (it was actually extended starting on Monday but I only posted it now xD) until the end of Sunday in celebration of a fantastic Open Hardware Summit and World’s Maker Faire NYC!
Meters for Arduino

Buttons for Arduino

ENJOY!
Learning Pet at the Open Hardware Summit
Learning Pet had a fantastic time at the Open Hardware Summit!
Before the summit started, we were sitting at the sculpture robo-busking for votes! At that point, Ian came over and wanted to do an interview! It was an excellent interview, and he uploaded it really quickly at the summit so we could get more votes for the scholarship! Thanks Ian!
I actually did go to some of the talks! Specifically, the ones in the morning before the break. The Arduino Team’s keynote was really really great!
After that, I sort of hung around the cafeteria area showing off Learning Pet! A lot of people said they would vote, which was really great! After the crowd died down, I went into the cafeteria area to watch the stream and maybe work on some ADK stuff.

That was when the creator of ThingSpeak himself caught me and said Hello! ThingSpeak is a really cool Internet of Things website. It’s relatively small and new, which is why I like it compared to the others.
He told me about the location data parameter in the API. I never knew this existed! Then I was wondering how to get the location from Mac OS, if there was actually a framework for that. It turned out that there was! Wow! And it was since 10.6 too! I never knew this! Making it work was really great, it was only checking to see if it worked was what we really got caught on (because the XML file goes from oldest to newest).

It was then when I saw David Cuartielles from the Arduino team when I waved, who joined the table. We were talking about Learning Pet, and it turned out that he was the one who created the Processing ADK Tool! Wow! What a cooincidence!
I told him about all of the bugs, and asked how I can fix them. He showed me the code for the ADK tool, and walked me through how to build it in Eclipse! Building a tool for Processing is a little different because you have to tell ant that there are some things that are already pre-compiled, so it doesn’t have to check them.
I played around with the code for a while and sort of got used to the way things work. There are some places where it will be tricky to be able to do what I want to specifically do.
We also tried to figure out why there are four parameters on the Arduino side, and only three on the Android App side. It turns out that the Arduino is the one telling the Android what App it needs, rather than the other way around. This means that of course the Arduino side needs the description and website parameters. Which I guess makes more sense in retrospect

I’ll definitely be helping out more with this Processing ADK Tool stuff. The thing that motivates me the most is that when I first got the ADK and Android, I figured that this should be about 10x easier and 50x quicker than making an iOS App. It wasn’t, and many other people feel the same way, but now it is my goal to make it so.
We did listen to some of the talks while we were down hacking and learning on some code. They were really good! I didn’t manage to get to the breakout session, but they were all sort of scattered and I wasn’t listening to the directions anyway… playing with the code was more fun.

Oh yeah! And I also bought a hackerspace passport from Mitch Altman! It is so cool to see them in real life, they look like a real passport!
The Demo session was fun, lots of people loved Learning Pet and also said that they voted for it! However, when they announced the winners, Learning Pet didn’t place in the top three. I really appreciate everyone voting, though. To be honest and somewhat egotistical, I think Learning Pet’s documentation was the best and most complete. No one even came close!
Here is a video by johngineer about Learning Pet! Thanks johngineer!
Watch video on Vimeo
The one thing that I would improve though, is to make the organizers a little more friendly towards everyone, and not just caring primarily about the sponsors. Yes, it is important to make the sponsors feel good since without them then there wouldn’t be this event, but it is also important to make the people at the summit itself feel good also. For example, at the demo session one of the organizers was talking with all of these sponsors in front of my demo area and goofing around and taking photos, but never bothered to say hello or ask about my project. It was sort of uncool and unmakerly (if that’s a word). The way I think of it is… you might as well be friendly to everyone, because we are all in this together!
All in all, the Open Hardware Summit was great for connecting with some of the people I have met online! It also turned out to be a great learning experience for building tools for Processing, and seeing how the Processing ADK tool actually compiles with API v10 rather than v7 (it is literally just setting the number different hahahaha)!

Also, Learning Pet appeared in the Adafruit blog randomly! It was awesome!
Apps4Arduino – SALE and INTRODUCING Buttons for Arduino!
=== SALE and INTRODUCTION! ===
Introducing Buttons for Arduino!
Interact with your Arduino in a quick, native and intuitive way using Buttons for Arduino!
=== Features ===
✔ Turn on and off your Arduino outputs with ease using the circle buttons
✔ Finely adjust the PWM outputs using the rotary sliders
✔ Customize button colours
✔ Full-screen mode (supported on 10.7+)
✔ No coding necessary
✔ API available
=== Works great for ===
:: Mood lighting – Have some LEDs connected to your Arduino for backlighting your computer desk, or similar? Easily control which LEDs are on and off to create a mixture of colours to suit your mood
:: Quick testing – Experiment with different outputs and combinations for your project, without touching a single line of code
:: Teaching students – Focus on the outputs and circuits without distractions. Demonstrate what happens when an output is on/off, and when the PWM changes from low to high
:: Live demos – Effectively communicate your project’s output ideas and concepts with others
:: And more! – Arduino projects are only limited by your imagination! Create the next best project, and use Buttons for Arduino to control it
To use Buttons for Arduino with your Arduino, install the ButtonsApp library from Buttons For Arduino’s support website and upload the included example sketch to your Arduino.
That’s it! Sit back, relax, and press some buttons!
Meters for Arduino and Buttons for Arduino are on SALE for $0.99 for a limited time! Celebrating the Open Hardware Summit and Maker Faire NY!
Get them on the Mac App Store here:
http://itunes.com/mac/buttonsforarduino
http://itunes.com/mac/metersforarduino
Also available as a tweetware option:
http://robotgrrl.com/apps4arduino/meters.php
http://robotgrrl.com/apps4arduino/buttons.php
Buttons for Arduino and Meters for Arduino are open source under the BSD 3-Clause License! Fork their repositories here:
https://github.com/RobotGrrl/Buttons-For-Arduino
https://github.com/RobotGrrl/Meters-For-Arduino
ENJOY!
