Can we connect Arduino to Android

Program an Arduino on the go with your Android phone or tablet: 7 Steps | 2021

Over the years, Android has grown into an impressive mobile platform that offers many features that were previously only available on PCs. Today I'm going to give you a way to write, compile, and upload Arduino programs on the go with an Android device.


Step 1: Materials Needed

For this instructable you will need:
- An Arduino *
- A compatible USB cable for your chosen Arduino
- A USB OTG ** enabled Android device
- ArduinoDroid application ***
- OTG cables or adapters (I personally prefer adapters as they are more compact and USB drives don't hang on my phone or tablet)
* While the ArduinoDroid application was written for all Arduinos, Arduinos based on ATMega 2560 (Mega) and ATMega328P (UNO and Nano V3) work best in my experience. Arduino Leonardo and Dreamer Nano V4 (Leonardo in nano form factor) might work, but I've had issues with this hardware in the past.
** For those unfamiliar with USB OTG, it stands for USB On The Go, which allows you to use USB flash drives, keyboards, mice, and other USB devices with a micro USB plug-to-USB Socket adapter can connect to the micro USB port of your phone find it as an OTG adapter or cable)
*** ArduinoDroid is a free application on Google Play. Note, however, that at least 210 megabytes of space is required on your phone to store the IDE, compiler, and uploader. Also note that some advanced features like Dropbox access are available as in-app purchases, but are not required by this guide.

Step 2: Check your device for OTG

Before going any further, you need to check that your device has USB OTG. The best way to check is on your device's manual (assuming the manufacturer sent one first).
If you don't have the manual for your device, a quick Google search for your device's specifications will most likely get the information you need. GSMArena records most phones pretty well and indicates if they have USB OTG capabilities. In my experience, most tablets have this functionality and sometimes come with an adapter or cable in the box.
If all else fails, you can try connecting an old flash drive to your device using the adapter to see if it recognizes it. If "Preparing removable media" or something similar to the screenshot above is displayed in the notification bar, you are good to go. If the flash drive is enabled, you will need to eject it by tapping the notification in the notification drawer. Otherwise, there is a risk that it will be damaged.

Step 3: Downloading the ArduinoDroid

Now it's time to download ArduinoDroid and set it up for writing code.
Download ArduinoDroid like any other app from Google Play and once you open it the Arduino SDK will be extracted to your internal storage. Since the SDK is extracted like on a PC, you can add downloads and add libraries to your mobile IDE just like you would on a PC.
I would also like to install USB Serial Monitor Lite whenever I need a serial monitor that is quick and easy to use.

Step 4: connecting your Arduino

After the ArduinoDroid has been installed and the SDK has been extracted, you can connect your Arduino to the device. Personally, I enjoy uploading the blink example to make sure it works properly.
Press your menu button or use the Android overflow menu (three dots) to open the ArduinoDroid settings and load the blink sketch like this: Sketch / Examples / 01. Basic / Blink
You should now see the blink sketch on your screen and you should be almost ready to upload.

Step 5: uploading to your Arduino

In order to upload to your Arduino, there are a few more things you need to do.
If you haven't already connected your Arduino to your device, do so now.
Now connected to the Arduino, we need to set the card type in the settings. You have to open the settings with the menu button or the overflow menu (three dots). Settings / Board-Type / Your_Board Replace your_Board with your Arduino board. For this instructable I am using a Nano v3 with ATMega328P.
After you have made these settings, you must compile the program. On the PC, you would normally do this when uploading to the board, but ArduinoDroid requires you to manually compile before uploading. The compiler button is the lightning bolt at the top.
Once you're done compiling, upload it using the arrow next to the compile button.

Step 6: note: Chinese Arduinos using the CH340G chip

Some Chinese Arduino users may have trouble uploading their sketches to their Arduinos using ArduinoDroid. This is because these cheap Arduinos are electrically identical to the originals except that instead of FTDI chips like "Original" they use a CH340G chip which serves the same purpose. Many people claim this is because FTDI licensing would make these extremely accessible Arduino boards more expensive to manufacture.
Since my Nano had this chip, I had errors while uploading the Nano w / ATMega328 profile. When I changed the Nano w / ATMega328 / CH340G profile, I had no problem uploading it.
On the other hand, my UNO, bought through an official Arduino distributor, worked just fine without having to use the CH340G profiles.

Step 7: you did it!

If everything went smoothly, you should now be able to program your Arduinos on your Android device. Note that the external libraries you are using must be added to the SDK directory to avoid compilation errors.
I hope you found my first instructable useful. If you like it, I would be delighted if you could vote for it in the first authors' competition.