Tag Archives: Android

I happened to stumble on an advertisement for a cool looking device that would work with a phone via Bluetooth.  It was ideally something that would be used for things like movie times, bus waiting times, or something else small and URL based… kinda like a QR code without the annoying camera part.

So I got a pair of RFduinos to play with it.  Programming it is quite simple, you just need Arduino 1.5 or later (which you would need for programming a Yun, Due, and possibly a few other Arduinos) and the RFduino libraries (see this).  The library comes with an example program accessible under File-Examples-RFduinoBLE-AdvertisementContinuous.

The only somewhat difficult part is dealing with the URIBeacon, and Adafruit publishes a tool to help with that, and Google has a more detailed explanation.

The top is the RFduino, the bottom is the USB shield, which is the easiest way to load it.

The top is the RFduino, the bottom is the USB shield, which is the easiest way to load it.

Of course it does nothing unless you have a device setup to receive it.  In the Play Store, there is a Physical Web app that can be used to receive the messages (until these become part of Android… and hopefully iOS, too).

The app is fairly simple, but it works!

The app is fairly simple, but it works!

Where This Is Going

Rather than beacon a web URL, I imagine with the proper programming (on both the RFduino side and the Android app side), it could be used to pass a variety of messages.  In fact, since the app looks up the description information, that could probably be used for simple messages (e.g. “the plant needs water”).

This has some pretty cool IoT and alerting uses.  Stay tuned!

-73-


Category: Arduino

This is Part 2 of God-Only-Knows How Many.  Part 1 is here.

A little progress.  My weekend was busy with website design for another site I run, the CQWW contest (I spent only around 45 minutes, only 20 QSOs between interruptions of keeping an eye on my kids and some minor radio difficulties), yard work, and taking a cat to a emergency care center (she’ll be fine, but my finances will not be).

Arduino Code: Minor Fixable Frustrations

The Arduino code is in the repository.  I’m not going to copy it here, since it is still not working correctly.  Over the past week, I’ve tried three different libraries and I think I’ve settled on using adk.h from http://www.circuitsathome.com/ (you can get it from here).  What I DO have is an Arduino that once plugged into my Nexus 7, it will tell the Nexus to open the correct app.  That’s pretty darn cool.  What I do not have (yet) is the intelligence built into the program to initialize the USB and send data.  Possibly related to this, it seems like the Arduino only wants to send data when it has a serial connection open (from the Serial Monitor in the Arduino Dev Kit).  I have more work to do.

Android Code: Logging, Logging, and More Logging

I have been writing and rewriting the code trying to get something pop into aLogcat or on the app screen with little luck.  I have many lines with Log.d and Log.v to see what is going on.  The best I’ve had is a “Data recieved” message*.  I have more to do here.  And as I indicated above, I ONLY see that message if I open the Serial Monitor.

* = The misspelling was intentional.  I can’t seem to spell ‘receive’ correctly to save my life, and there is no spell check in Eclipse.

 

Stay tuned for next week’s episode.

-73-

 


Category: Arduino

This is Part 1 of God-Only-Knows How Many.

I finally got around to working on the easy button – I found a decent (not great, just decent) tutorial on the web that discusses sending the status of a button attached to an Arduino to an Android device.  I’ve been making changes and learning about bitmasks and bit shifting (something they never teach traffic engineers!).

The initial (key word!) Arduino and Android code is written and up on Github.  Right now, I am writing a test routine that will eventually morph into a functional program.  I’ve really only spent time on the Arduino

I took the code from the tutorial link above and made quite a few changes.

Before being able to compile the code, you need the microbridge Arduino headers.  Then, you have to fix some of the source files – in usb.cpp, max3421.h, and Adb.h, there is an #include “wiring.h” which needs to be changed to “wiring_private.h”.  Once you’ve installed the library (copy the files to the Arduino libraries folder in it’s own folder), the following should (key word!) compile and send a binary output string to the serial monitor based on the buttons that are pressed.

 

The binary strings on the screen represent the buttons that are pressed in the arrangement of 1abc1 where a is 1 if button 1 (pin 4) is pressed, and 0 if it is not, b is button 2 (pin 5), and c is button 3 (pin 6).  So…

10001 = no buttons pressed
11001 = button 1 pressed (pin 4 high)
10101 = button 2 pressed (pin 5 high)
10011 = button 3 pressed (pin 6 high)
11101 = buttons 1 & 2 pressed
11011 = buttons 1 & 3 pressed
10111 = buttons 2 & 3 pressed
11111 = buttons 1, 2, & 3 pressed

IN THEORY, this will all be sent to the Android device and the Android will display what buttons are pressed on the screen.  I have that designed, but I haven’t tested it and my Android code won’t compile yet.  With luck, that’ll be next week’s blog post.

REVISION: Note the fact that the preceding paragraph says “IN THEORY” in all caps.  That means that it really doesn’t work at all so don’t use my code… yet. 🙂

On the todo list for this is using interrupts to listen for the button as opposed to listening for a change every 100 milliseconds.

2013-10-23 08.47.38

This is – so far – the development device. An Arduino Uno and a USB Host Shield from Sparkfun.

-73-


Category: Arduino

This is the new server