This project aims to simplify creation of basic Arduino programs by just editing a UI on Android.

Overview

ArdUI

A video explanation

If you are more a fun of video explanation go to this youtube video

Project aim

This project aims to simplify creation of basic Arduino programs by just editing a UI on Android. Instead of the usual Arduino development cycle:

arduino-usual-flow

You have just to create your program via the Android UI and send it Arduino via Serial.

In order to make the setup work you have to do two things

Build and deploy the generic program to your Arduino board

in order to do that

  • Include the ArdUI.zip (./arduino-library/generated/c/ArdUI.zip) library

    (You can include the Library zip can in Arduino IDE via: Sketch -> Include Library -> Add .ZIP Library.)

  • Upload GenericProgram.ino to your Arduino board.

That's it!

All subsequent changes to the Arduino Program can be done with Android UI now.

Technical details

Below is a technical description for whats happening under the hood

The workflow go as described here

  • a Protobuf file is used to describe the serialization/deserialization of data between Kotlin objects, byte streams and C structures. the Protbuf file used here to describe the data format is located at ./proto/common.proto

  • The Android application allows to create a program in UI which is translated to data classes generated by the Protobuf generator.

  • This data is serialized and sent to Arduino via the Serial.

  • The C program in Arduino deserializes the received bytes and construct the set of instructions to run.

The fact that Protobuf is supported for an array of languages allowed us to write programs in Kotlin (for Android), C (for Arduino) and JS (for a NodeJS app)

Web interface

A NodeJS application is provided too in case you don't have access to an Android phone. The interface is pretty simple and basic; you have 2 text fields:

  1. For setup instructions
  2. For loop instructions

This is the syntax to use for writing instructions:

pinmode [input|output|input_pullup]
digitalwrite pin [low|high]
analogwrite pin value
sleep duration

Press upload button and it should work.
More details can be found Here

How bindings are generated?

Java bindings

This is generated using the wire library, the gradle plugin seemed like the easiest way, all you need is for this case is to include

wire {
    sourcePath {
        srcDir '../../proto'
    }
    kotlin{}
}

in your build.gradle file, and it will keep your generated stub up to date with the protobuf spec.

C bindings

The C binding is generated with nanopb library; it is a small code-size Protocol Buffers implementation in ansi C. It is especially suitable for use in microcontrollers, but fits any memory restricted system.

C bindings are generated for our project with the following steps:

  1. clone the repository locally
git clone https://github.com/nanopb/nanopb.git
  1. generate the bindings from .proto files:
NANOPB=path/to/nanopb
${NANOPB}/generator/nanopb_generator.py \
  -D ./arduino-library/generated \
  -I ./proto \
  common.proto
  1. create the library as a ZIP file:
zip -j arduino-library/ArdUI.zip \
   ${NANOPB}/pb_common.h \
   ${NANOPB}/pb_common.c \
   ${NANOPB}/pb_decode.h \
   ${NANOPB}/pb_decode.c \
   ${NANOPB}/pb.h \
   arduino-library/generated/common.pb.h \
   arduino-library/generated/common.pb.c \
   arduino-library/ArdUI.h \
   arduino-library/ArdUI.cpp

You can include the Library zip can in Arduino IDE via:
Sketch -> Include Library -> Add .ZIP Library..

N.B: probably you will need the nanopb dependencies for Python.

You can install them with:

pip3 install scons protobuf grpcio-tools

JS bindings

to create the needed JS binding you can run the following command:

protoc --proto_path=./proto \
       --js_out=import_style=commonjs,binary:html-serial-ui/js \
       common.proto

More details can be found Here

Limitations

  • Currently, only 8 instructions are supported for setup and 16 for loop.

  • 4 types of instructions are supported now:

    • setPinMode
    • digitalWrite
    • analogWrite
    • sleep

Contributions

Contributions are welcome!
Just create your pull request and it will be reviewed and merged ASAP.

Found a bug?

Describe your bug and the steps to reproduce it in an issue and it will be addressed by us.

Comments
  • Allow user to change selected port

    Allow user to change selected port

    Hello, In this PR, I tried to improve the dev user experience by implementing the following:

    • Allowing the client (react client) to request for available serial ports
    • Allowing the user to change the selected serial port
    • On initial load, the port witch has "Arduino" in the manufacturer property is selected by default

    There is no need to specify the port on launch, and you can change the port using the UI, in case you are using multiple Arduinos

    Have a good day

    opened by yousfiSaad 2
  • Rework Ardui html UI with react

    Rework Ardui html UI with react

    Actually the HTML UI is with vanilla JS.

    logs are retrieved via a setInterval(func,timeout). Would be better to rework it with React + TypeScript and retrieve logs with WebSockets instead.

    opened by elkasimi 1
  • The UI rewritten in react and websockets

    The UI rewritten in react and websockets

    Fixes #19

    The new UI is in the directory react-serial-ui, It has the same features as the Html-serial-UI. I used WebSocket to communicate between the node server and the react page, sockets are used to display logs in real-time, and also to send code for upload.

    opened by yousfiSaad 0
  • Enable usefull Serial logs

    Enable usefull Serial logs

    By default all Serial logs are disabled except few ones.

    It would be good to have those information always:

    • Decoding status
    • Bytes received
    • Loading instructions status

    Those can be very useful in either the Android app or the Nodejs app.

    opened by elkasimi 0
  • Communication protocol

    Communication protocol

    Hello,

    In this PR I try to improve communication between Nodejs and Arduino Do not merge this PR before adapting the android to the new changes: (the same modifications as in react-serial-ui/server/src/index.js) the class Communication protocol is a state machine that has three states

    • Waiting: this is the idle state, during this state the Arduino receives any char from the serial interface, when a message followed by "\n" is received, the machine moves to the "message received state"

    • Messager received: when in this state it means that Arduino received a message, if the message is "START_UPLOAD:{size}\n" we store the size of the program(buffer) to receive and we move to the "receiving" state

    • Receiving in this state Arduino checks the elapsed time for timeout, and receives the program char by char, updates the program and moves to the idle (waiting) state

    if tine exceeds 1000 ms

    The advantage is that it adds a timeout to the communication, eliminating the need to reset the board when an error occurs and only a part of the program is received.

    Hope it's useful

    opened by yousfiSaad 1
  • Send the bytes by chunks of 32 bytes to Arduino from Android

    Send the bytes by chunks of 32 bytes to Arduino from Android

    Arduino UNO buffer is 64 bytes and can go to 32 bytes in case of low memory available. For more stability it would be better to upload program bytes in chunks of 32 bytes each. one after the other. Probably with some ready message whenever a chunk has been successful received.

    opened by elkasimi 0
  • Send the bytes by chunks of 32 bytes to Arduino from NodeJS

    Send the bytes by chunks of 32 bytes to Arduino from NodeJS

    Arduino UNO buffer is 64 bytes and can go to 32 bytes in case of low memory available. For more stability it would be better to upload program bytes in chunks of 32 bytes each. one after the other. Probably with some ready message whenever a chunk has been successful received.

    opened by elkasimi 0
  • Check in Android for buffer size

    Check in Android for buffer size

    A maximum of 255 bytes can be send currently to Arduino board. This needs to be checked before sending program bytes to Arduino.

    In addition, the check for 8 instructions in setup and 16 instructions in loop must be removed

    opened by elkasimi 0
Releases(0.0.6)
A small library which will save you from writing the same intent creation code again and again for the most simple tasks

Android Intents A small library which will save you from writing the same intent creation code again and again for the most simple tasks. I found myse

MarvinLabs 420 Nov 20, 2022
ModernStorage is a group of libraries that provide an abstraction layer over storage on Android to simplify its interactions

ModernStorage ModernStorage is a group of libraries that provide an abstraction layer over storage on Android to simplify its interactions by apps dev

Google 1.1k Dec 30, 2022
This project is an add-on for the excellent J2V8 Project. It allows users to debug JS running in V8 using Chrome DevTools. Uses Stetho for communication with Chrome DevTools.

J2V8-Debugger This project is an add-on for the excellent J2V8 Project. It allows users to debug JS running in V8 using Chrome DevTools. Uses Stetho f

Alex Trotsenko 76 Jan 3, 2023
MIS49M Final Project

MIS49M MIS49M Final Project MIS49M Final Projesi olarak toplum yararı düşünülerek tasarlanmıştır. Tanıtım Videosu: https://youtube.com/embed/bEVta4UM0

null 5 Dec 12, 2022
Simple project to help people track their crusade progress

Crusade-helper Simple project to help people track their crusade progress Core module Contains: model - package with all database structure service -

null 4 Nov 2, 2021
This project uses AAC and 3rd parties to present NFT collectibles

My NFT Android app This project uses AAC and 3rd parties to present NFT collectibles AAC(Android Archicture Components) Lifecycle-aware components Vie

LouisWu 2 Aug 21, 2022
Sample project displaying process of OTP validation using firebase

OTP-Validation-using-firebase Sample project displaying process of OTP validation using firebase Screenshots Concepts used Integrated Firebase sdk for

Ankita Gaba 2 Jun 18, 2022
Android Shared preference wrapper than encrypts the values of Shared Preferences. It's not bullet proof security but rather a quick win for incrementally making your android app more secure.

Secure-preferences - Deprecated Please use EncryptedSharedPreferences from androidx.security in preferenced to secure-preference. (There are no active

Scott Alexander-Bown 1.5k Dec 24, 2022
Android library which makes it easy to handle the different obstacles while calling an API (Web Service) in Android App.

API Calling Flow API Calling Flow is a Android library which can help you to simplify handling different conditions while calling an API (Web Service)

Rohit Surwase 19 Nov 9, 2021
Gesture detector framework for multitouch handling on Android, based on Android's ScaleGestureDetector

Android Gesture Detectors Framework Introduction Since I was amazed Android has a ScaleGestureDetector since API level 8 but (still) no such thing as

null 1.1k Nov 30, 2022
Use Android as Rubber Ducky against another Android device

Use Android as Rubber Ducky against another Android device

null 1.4k Jan 9, 2023
Android Utilities Library build in kotlin Provide user 100 of pre defined method to create advanced native android app.

Android Utilities Library build in kotlin Provide user 100 of pre defined method to create advanced native android app.

Shahid Iqbal 4 Nov 29, 2022
A util for setting status bar style on Android App.

StatusBarUtil A util for setting status bar style on Android App. It can work above API 19(KitKat 4.4). 中文版点我 Sample Download StatusBarUtil-Demo Chang

Jaeger 8.8k Jan 6, 2023
A logger with a small, extensible API which provides utility on top of Android's normal Log class.

This is a logger with a small, extensible API which provides utility on top of Android's normal Log class. I copy this class into all the little apps

Jake Wharton 9.8k Dec 30, 2022
Java implementation of a Disk-based LRU cache which specifically targets Android compatibility.

Disk LRU Cache A cache that uses a bounded amount of space on a filesystem. Each cache entry has a string key and a fixed number of values. Each key m

Jake Wharton 5.7k Dec 31, 2022
a simple cache for android and java

ASimpleCache ASimpleCache 是一个为android制定的 轻量级的 开源缓存框架。轻量到只有一个java文件(由十几个类精简而来)。 1、它可以缓存什么东西? 普通的字符串、JsonObject、JsonArray、Bitmap、Drawable、序列化的java对象,和 b

Michael Yang 3.7k Dec 14, 2022
gRPC and protocol buffers for Android, Kotlin, and Java.

Wire “A man got to have a code!” - Omar Little See the project website for documentation and APIs. As our teams and programs grow, the variety and vol

Square 3.9k Dec 31, 2022
✔️ Secure, simple key-value storage for Android

Hawk 2.0 Secure, simple key-value storage for android Important Note This version has no backward compatibility with Hawk 1+ versions. If you still wa

Orhan Obut 3.9k Dec 20, 2022
A robust native library loader for Android.

ReLinker A robust native library loader for Android. More information can be found in our blog post Min SDK: 9 JavaDoc Overview The Android PackageMan

Keepsafe 2.9k Dec 27, 2022