Freaduino ADK + Android + LCD, Dual Screen Display

Freaduino ADK + Android + LCD, Dual Screen Display

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:

  • Freaduino ADK main board
  • Android Phone above V2.3.4
  • 1602 Character LCD and USB Cable

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???/h6>
  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, 
  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:

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

to

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
[/cce_cpp]

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.

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

void loop(){
 analogWrite(9, CONTRAST);
 ...
}
[/cce_cpp]

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.