Freaduino ADK + Android + LCD, Dual Screen Display

Freaduino-02

We found a funny Application to create a “dual screen”  to show the SMS notification & time display from Android phone, and we ported the code to Nexus S and Freaduino ADK supplied by us, which provides an Arduino-compatible board that supports the ADK firmware.

Hardware:

Software:

This project makes use of the Android Open Accessory Protocol which requires support on both the Arduino and Android device. The sketch listens for bytes sent over the USB connection and displays them on the LCD–it special-cases two values to determine which row of the display text should be displayed on.

Operating Details

Android application:
  1. Make sure your Android phone is Android V2.3.4 or above. So, please update the system and check the device and Select USB Debug model. In Eclipse, Install the Google APIs API Level 10 add-on library, which includes the Open Accessory library for 2.3.4 devices that support accessory mode. This library is also forward compatible with Android 3.1 or newer devices that support accessory mode. If you only care about Android 3.1 or newer devices, all you need is API Level 12. For more information on deciding which API level to use, see the USB Accessory documentation.
  2. Click File > New > Project…, then select Android > Android Project
  3. In the Project name: field, type BackgroundUsbDemo.
  4. Choose Create project from existing source, click Browse, select the APP directory, and click Finish.
  5. To Build Target, select Google APIs (Platform 2.3.3, API Level 10).

Note: Even though the add-on is labeled as 2.3.3, the newest Google API add-on library for API level 10 adds USB Open Accessory API support for 2.3.4 devices.

The Android App is invisible and starts automatically when you connect the accessory (You probably need to approve the running of the application within a few seconds or the accessory may time out). A background service is started which displays a notification of the accessory found, listens for new text messages and starts sending the current time to the accessory for display. You can use your phone as normal while the service is running in the background.

Monitoring the ADK Board:

1. Used 1602 LCD for dual display and hook everything up EXACTLY like in the picture from Arduino page: http://arduino.cc/en/uploads/Tutorial/lcd_schem.png. How to used 1602 LCD check here.

2. Connecting LCD as above, the Source for Arduino sketch need change two places:


LiquidCrystal lcd(A0, A1, A2, A3, A4, A5);

to

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

As an alternative to the potentiometer you can connect the Vo pin of the LCD with any available PWM-output (I use pin 9) and add the following code in the setup() section, CONTRAST values around 10-20 give a nice bright output.


void setup(){ ...
pinMode(9, OUTPUT);
...
}

void loop(){
 analogWrite(9, CONTRAST);
 ...
}

3.By acc.isConnected() to judgment the connecting status. After connecting Freaduino ADK and Nexus S to each other, there will be a time show from Nexus S, as below:

If there are SMS, but you are playing games at the same time, it will show the Name and Content as below:

When the accessory is disconnected, the notification is removed and the background service cleans up itself before stopping.

This demo just a simple demo for you reference, the demo code is free software; you can redistribute it and/or  modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation. Thanks for reading.

Reference Post:

Dual-screen Nexus One .

Android Open Accessory Development Kit.

 

VN:F [1.9.13_1145]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.13_1145]
Rating: +1 (from 1 vote)

Related Posts

  • roymo

    Hi, Robi:
    I am using G2 MAGIC, CM7 2.3.7 to install the ADK demoKit, also appears INSTALL_FAILED_MISSING_SHARED_LIBRARY error. I have tried to put the maps xml and accessory xml files to /etc/permissions. and also put maps jar and accessory jar to /system/framework, but seems they dont work. I also pulled the /proc/config.gz out and found that CONFIG_USB_ANDROID_ACCESSORY this line is “# CONFIG_USB_ANDROID_ACCESSORY is not set”, so I tried to change it as “CONFIG_USB_ANDROID_ACCESSORY=y”, but it display INSTALL_FAILED_MISSING_SHARED_LIBRARY error either. Do you have any idea of this situation? Need I recompile the android kernal or somthing?

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
    • robi

      Hi roymo,

      I modified the config file on G1, and then install successful. However the APP demoKit can not run at all. Each time will be forced to exit because of USB accessory.

      So I also don’t make sure of that G1 and G2 these early model whether supported ADK.

      Maybe you could try more framework version, not just CM7. I think most of version cut of this function, but not all.

      VN:F [1.9.13_1145]
      Rating: 0.0/5 (0 votes cast)
      VN:F [1.9.13_1145]
      Rating: 0 (from 0 votes)
      • roymo

        Hi,Robi:
        Then how did you modify the config file? Extract /etc/config.gz, modify it and pack it into gz again?
        I saw someone on CM7 forum said that they have done successfully on G1

        VA:F [1.9.13_1145]
        Rating: 0.0/5 (0 votes cast)
        VA:F [1.9.13_1145]
        Rating: 0 (from 0 votes)
        • roymo

          I want at least I should install the demokit successful at first

          VA:F [1.9.13_1145]
          Rating: 0.0/5 (0 votes cast)
          VA:F [1.9.13_1145]
          Rating: 0 (from 0 votes)
          • robi

            Hi roymo,

            I just did what’s you didi. So I not sure why you could not install yet.

            I have tested ADK at G1, Nexus One and Nexus S, unfortunately the G1 always can’t work.

            VN:F [1.9.13_1145]
            Rating: 0.0/5 (0 votes cast)
            VN:F [1.9.13_1145]
            Rating: 0 (from 0 votes)
  • pinky

    ya!! we fix this wrong
    Thank you very much !!!

    If I have other question can I ask you in the future??

    thank you :):):):):):):):)

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
    • robi

      Well done!!

      Anything I can help.

      VN:F [1.9.13_1145]
      Rating: 5.0/5 (1 vote cast)
      VN:F [1.9.13_1145]
      Rating: 0 (from 0 votes)
  • pinky

    Thanks for your answer :))

    I try to check at: / etc/permissions it don’t have that two libraries!

    but when I put those two libraries at: / etc/permissions eclipse still had “INSTALL_FAILED_MISSING_SHARED_LIBRARY” error
    would you know other method can fix that error

    I don’t have any method to kill that

    thank you very much!!

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
    • robi

      Hi Pinky,
      It’s my mistake. The library path should /system/framework

      step one : adb push android.hardware.usb.accessory.xml /system/etc/permissions/

      step two: adb push android.hardware.usb.accessory.xml /etc/permissions/

      step three: adb push com.android.future.usb.accessory.jar /system/framework

      The jar and xml file you can pull from google api-10 sdk

      but to do that first you have to do these steps. you have to be root, once you rooted your phone remount your system folder and then do the first step.

      By these way, maybe resolve the install error. I have test in G1 and install Sucessfull. But the App is cann’t run on the phone, from the logcat get
      ” ERROR/AndroidRuntime(637): java.lang.NoClassDefFoundError: com.android.future.usb.UsbManager”

      Maybe there is some switch that have to be enabled when compiling the kernel. (I will try to get the kernel config “adb pull /proc/config.gz”, and look for the switch in the commit for incredible., CONFIG_USB_ANDROID_ACCESSORY=y)

      So I’m unsure G1 supports accessory mode or not now. Hope there are something helpful.

      VN:F [1.9.13_1145]
      Rating: 5.0/5 (1 vote cast)
      VN:F [1.9.13_1145]
      Rating: 0 (from 0 votes)
  • Pinky

    ‎[2011-08-28 15:09:54 - DemoKitLaunch] Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY
    [2011-08-28 15:09:54 - DemoKitLaunch] Please check logcat output for more details.
    [2011-08-28 15:09:56 - DemoKitLaunch] Launch canceled!

    I was download this file in android http://developer.android.com/guide/topics/usb/adk.html

    Build target I chose SDK in google API 10
    Run in Emulator can install it but when I run on my android 2.3.4 device ,eclipse had those error

    I check in internet but all about google map and USB error I try to that but it still wrong

    I can’t fix this error is anyone can kill it?
    TIA

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
    • robi

      Hi Pinky,
      I think you should first make sure is there “com.android.future.usb.accessory.jar” and “com.google.android.maps.jar” library at: /etc/permissions . You can find it in ADB mode and cd /etc/permissions.
      If not have that’s means your framework of Android2.3.4 is not completion.The error of “INSTALL_FAILED_MISSING_SHARED_LIBRARY” always is without these two libraries.

      VN:F [1.9.13_1145]
      Rating: 5.0/5 (1 vote cast)
      VN:F [1.9.13_1145]
      Rating: 0 (from 0 votes)
  • http://www.labradoc.com/i/follower follower

    It’s nice that you’ve documented some of the parts of getting this project running more clearly than the original site and linked to the site in your references.

    It would be nicer if you were clear you didn’t actually make the software yourself and that some of your documentation is copied & pasted directly from the original project.

    Glad to see the code works on the Nexus S though. :)

    Thanks.

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
    • http://www.elecfreaks.com/ ElecFreaks

      Thank you for your suggestion. Maybe our words made people misunderstanding. We modified some words of the start of this post. Is it clear now? :-)
      You are welcome for any other suggestions.
      Thanks again. :-)

      VN:F [1.9.13_1145]
      Rating: 0.0/5 (0 votes cast)
      VN:F [1.9.13_1145]
      Rating: 0 (from 0 votes)
      • http://www.labradoc.com/i/follower follower

        Thanks for updating the text. :)

        I’ve added your post to the list of project “sightings” on: http://www.labradoc.com/i/follower/p/dual-screen-nexus-one

        Have fun!

        VA:F [1.9.13_1145]
        Rating: 0.0/5 (0 votes cast)
        VA:F [1.9.13_1145]
        Rating: 0 (from 0 votes)
        • http://www.elecfreaks.com/ ElecFreaks

          Thank you. :-)

          VN:F [1.9.13_1145]
          Rating: 0.0/5 (0 votes cast)
          VN:F [1.9.13_1145]
          Rating: 0 (from 0 votes)
      • http://necdisplay@gmail.com lcd displays

        Thanks, I got the batter idea after read your post.

        VA:F [1.9.13_1145]
        Rating: 0.0/5 (0 votes cast)
        VA:F [1.9.13_1145]
        Rating: 0 (from 0 votes)
        • robi

          We are looking forward,and then please share with us. :)

          VN:F [1.9.13_1145]
          Rating: 0.0/5 (0 votes cast)
          VN:F [1.9.13_1145]
          Rating: 0 (from 0 votes)
Go To Top