Giter Club home page Giter Club logo

android-blue-display's Introduction

Convert your smartphone into an Android remote touch display for your Arduino or ARM projects.

Badge License: GPLv3     Badge Version     Badge Commits since latest     Badge Hit Counter

Stand With Ukraine

Button Changelog

If you find this library useful, please give it a star.


SUMMARY

Let the Arduino sketch create a GUI with Graphics, Buttons and Sliders on your smartphone by simply connecting a HC-05 to the rx/tx pins of your Arduino. Directly connecting the Arduino with an USB cable and an USB-OTG adapter to your smartphone is also supported.
It receives draw requests from Arduino over Bluetooth and renders it. GUI callback, touch and sensor events are sent back to Arduino. No Android programming needed!


Features

  • Touch button + slider objects with tone feedback.
  • Button and slider callback as well as touch and sensor events are sent back to Arduino.
  • Graphic + text output as well as basic printf implementation.
  • Draw chart from byte or short values. Enables clearing of last drawn chart.
  • Play system tones.
  • Automatic and manually scaling of display region.
  • Easy mapping of any UTF-8 characters like Ohm, Celsius etc..
  • Up to 115200 Baud using HC-05 modules or OTG cable.
  • USB OTG connection can be used instead of Bluetooth.
  • Local display of received and sent command log for debugging purposes.
  • Hex and ASCII output of received Bluetooth data at log level verbose.
  • Debug messages shown as toasts.
  • Swipe from the left border opens the options menu.
  • C++ Libraries for Arduino. and ARM (STM).

The Arduino library with lot of examples can be found here.

You can load the library with Tools -> Manage Libraries... or Ctrl+Shift+I. Use "BlueDisplay" as filter string. The library includes examples for easy initializing a HC-05 and for a simple DSO with 0.3 megasamples/sec.


Usage

Before using the examples, take care that the BT-module (e.g. the the HC-05 module) is connected to your Android device and is visible in the Bluetooth Settings. For full screen applications, the menu is called by swiping from the left edge of the screen. Otherwise, you can call it by touching the area not occupied by the client application (black display area).


Baudrate

All examples initially use the baudrate of 9600. Especially the SimpleTouchScreenDSO example will run smoother with a baudrate of 115200. For this, change the example baudrate by deactivating the line #define HC_05_BAUD_RATE BAUD_9600 and activating #define HC_05_BAUD_RATE BAUD_115200. AND change the BT-Module baudrate e.g. by using the BTModuleProgrammer.ino example.


Sensor axis for an Arduino application

Android axis are defined for natural screen orientation, which is portrait for my devices:

  • When the device lies flat on a table and its left side is down and right side is up or pushed on its left side toward the right, the X acceleration value is positive.
  • When the device lies flat on a table and its bottom side is down and top side is up or pushed on its bottom side toward the top, the Y acceleration value is positive.
  • When the device lies flat on a table, the acceleration value along Z is +9.81 (m/s^2).

The BlueDisplay application converts the axis, so that this definition holds for each screen orientation.


Example for Hex + ASCII output (on log level verbose):

V Hex= 00 4C 13 A5 01 08 00 53 65 74 74 69 6E 67 73 A5
V Asc=     L                 S  e  t  t  i  n  g  s
V Hex= 70 12 00 04 00 00 00 00 00 60 00 34 00 00 F8 0B
V Asc=  p                          `     4
V Hex= 03 00 00 30 21 A5 01 07 00 48 69 73 74 6F 72 79
V Asc=           0  !              H  i  s  t  o  r  y

Hints

If you need debugging with print() you must use the debug() functions since using Serial.print() etc. gives errors (we have only one serial port on the Arduino) . E.g.

BlueDisplay1.debug("\r\nDoBlink=", (uint8_t) doBlink);

To enable programming of the Arduino while the HC-05 module is connected, use a diode to connect Arduino rx and HC-05 tx. On Arduino MEGA 2560 TX1 is used, so no diode is needed.

                 |\ |
   Arduino-rx ___| \|___ HC-05-tx
                 | /|
                 |/ |

Pictures and screenshots

BlueDisplay example breadboard picture Breadboard picture Fritzing schematic for BlueDisplay example Fritzing schematics DSO with passive attenuator on breadboard DSO with passive attenuator on breadboard At work DSO at work Fritzing DSO Fritzing Schematic DSO Schematic DSO settings menu DSO settings menu DSO frequency generator menu Frequency generator menu Hacked RC car Hacked RC car

RC car control display RC car control display

Revision History

Version 4.3.3 / 20

  • Targeted Android 13 / 33

Version 4.3.2 / 19

  • Targeted Android 12 / 32
  • Support for new function disableAutorepeatUntilEndOfTouch().
  • Added Flag FLAG_SLIDER_VALUE_CAPTION_TAKE_DEFAULT_MARGIN. Margin is set to RequestedCanvasHeight / 60.
  • Inproved color handling for red / green button.

Version 4.3.1 / 18

  • Fixed Permission bug for Andoid 12 / 32

Version 4.3 / 17 - First version build with Android Studio

  • New command FUNCTION_CLEAR_DISPLAY_OPTIONAL to enable resynchronization of slow displays.
  • Bluetooth random delay detection.
  • Fixed bug for micro-swipe suppressing.
  • Added Slider command SUBFUNCTION_SLIDER_SET_DEFAULT_COLOR_THRESHOLD.
  • Opening options menu by swipe now not restricted on full screen and connected.
  • Strings printed with Serial.print() are not interpreted, but stored in the log for debug purposes.
  • Fixed bug in FUNCTION_BUTTON_REMOVE.
  • Fixed bug in SUBFUNCTION_SLIDER_SET_POSITION.

Version 4.2 / 16

  • Swipe from the left border in application full screen mode opens the options menu.
  • Removed unnecessary message on no data received under certain circumstances.
  • Added parameter values *LOCK_SENSOR_LANDSCAPE and *LOCK_SENSOR_PORTRAIT for function setScreenOrientationLock().
  • Slider caption handling improved.
  • Added short drawText functions.

Version 4.1

  • Improved startup. New message if no data received after connect and part of screen is inactive/black, to access the options menu.

Version 4.0

  • Connection with USB OTG cable now also possible. In this case no Bluetooth adapter is needed.
  • Handling of no input for getNumber.
  • Slider setScaleFactor() does not scale the current value, which is delivered as initial value at init().
  • Improved tone volume setting - can be adjusted at the smartphone too. trim() for all button caption strings.

Version 3.6

  • connect, reconnect and autoconnect improved/added. Improved debug() command. Simplified Red/Green button handling.

Version 3.5

  • Slider scaling changed and unit value added.

Version 3.4

  • Timeout for data messages. Get number initial value fixed.
  • Bug autorepeat button in conjunction with UseUpEventForButtons fixed.

Version 3.3

  • Fixed silent tone bug for Lollipop and other bugs.Multiline text /r /n handling.
  • Android time accessible on Arduino. Debug messages as toasts. Changed create button.
  • Slider values scalable. GUI multi touch. Hex and ASCII output of received Bluetooth data at log level verbose.

Version 3.2

  • Improved tone and fullscreen handling. Internal refactoring. Bugfixes and minor improvements.

Version 3.1

  • Local display of received and sent commands for debug purposes.

Version 3.0

  • Android sensor accessible by Arduino.

Credits

The USB driver library used in this project is Kai Morichs fork of usb-serial-for-android

android-blue-display's People

Contributors

arminjo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

android-blue-display's Issues

initDisplay() and drawGui() are not called after connection to JDY-33 module

Hello!
I use a JDY-33 bluetooth module, similar to HC-05.

I started with the BlueDisplayBlink example, and I was able to connect to the module with my phone, and see the blinking circle in the screen. However, there was no pushbutton in the screen.

After some tries, I found out that the initDisplay() and drawGui() functions were apparently never called. If I call them manually inside my loop() function (just to test), the pushbutton appears in the screen.

So it looks like these functions are not called after the connection is established.

I installed the BlueDisplay library v.4.0.1 from the Arduino library manager.
The Android app is v.4.3.1 downloaded from here: https://github.com/ArminJo/android-blue-display/tree/master/APKs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.