6 Easy Ways to Connect Arduino to Android
Arduino boards and similar microcontrollers are making creativity more accessible than ever. Whether you are controlling LED strips , automating your home , or even protecting your property , these little marvels are the heart of most DIY electronic builds.
If you need to tell your Arduino to change the state of a pin (for example to turn the lights on), it requires the user to press a physical button or use a sensor. Relying on a human finger press or similar is fine for many projects, but what if you just want to set up your circuit and access it remotely?
This article takes you through 6 ways to connect your Android device to any Arduino compatible board. Lets dive in.
First on our list is ArduinoDroid. This app works via USB On The Go (OTG) to connect your device to Arduino via USB cable. One of the benefits of USB is that it requires no internet or Bluetooth connection in order to operate.
The app is a fully functional IDE, which allows you to code on your phone, upload previously written sketches stored in your Dropbox or Google drive, and compile sketches on the go.
The benefits of using this app are obvious. Having an IDE to hand is the perfect thing to make quick changes in the field. Attaching an Android device is much less cumbersome than having to balance a laptop on your hand!
One obvious negative is that typing code out on your device might not be too comfortable, especially if it is a smart phone. This is only a small issue when compared to the convenience of having an ultra portable way of programming your board without the need for an internet connection.
This is also an inexpensive way to learn the basics of Arduino , as a clone Arduino board and USB OTG cable cost only a few dollars. Perfect for those without frequent access to a computer!
2. Arduino Bluetooth Controller
Next on our list is the aptly named Arduino Bluetooth Controller app. This app is less about programming an Arduino on the fly, and more about triggering changes in the uploaded sketch. The app sends data to your board via Bluetooth, allowing you to send serial data by pushing a button in the app. You will need a Bluetooth module for your board, though the HC-06 module is widely used and available for just $3 at the time of writing.
For an excellent primer on getting started with these cheap little modules see this video from Tinkernut Labs:
The video above recommends a different app, though some users report it doesn’t work on modern smartphones. The Arduino Bluetooth Controller appears not to suffer from this problem. It is worth noting that the app does download in English, rather than Italian as displayed in the Play Store pictures!
We’ve covered creating projects with Blynk before, and found it to be a great service. Its flexibility and simplicity make it an intuitive way to trigger events on your board. Blynk requires an internet connection to run, since it uses its own server. You can use either Wi-Fi or mobile data to access Blynk [Broken URL Removed], making it perfect for smartphone use.
One of Blynk’s strengths is the range of ways you can connect to a device. Along with support for almost every development board out there, you can connect to the server wirelessly, using ethernet, or even use a computer’s connection via USB. The service is well documented, and its intuitive app makes it simple to put together custom controls for your project. The Blynk library for the Arduino IDE takes care of all the communication.
If you are the type of person that wants to start their coffee machine from their phone before they get up in the morning, then this one is for you!
Blynk isn’t the only service in this field, also worth checking out are the highly customizable Thinger.io, and the practically limitless yet fiendishly difficult OpenHAB. Out of the three, Blynk is certainly the quickest to get up and running, though learning OpenHAB is a great idea in the long term.
4. Communication From Scratch
Everything we have covered so far makes use of already existing services to help you connect in various ways, but what if you want total control over every aspect of the Android app? Why not make it yourself from scratch?
Hariharan Mathavan takes us through the whole process in this extensive step by step tutorial. The app created here is designed simply to open a USB connection, and pass serial data back and forth between the app and the Arduino board. This is a great way to get acquainted with Android Studio and app building in general.
The guide takes you through all of the code required to communicate with your Arduino via USB, providing explanations at each step. The follow up tutorial on how to implement Bluetooth connectivity is equally well explained.
While there are ways to create Android apps without coding , it’s well worth learning the basics of coding in Java. Making your own apps is cool, but before you know it you could have a whole new career !
5. Turn Your Arduino into a Server
Another way to communicate with your board is to turn it into a tiny server. The benefit of this is that it opens up the possibility of communicating with the board from anything that can navigate to an IP address, or make a web request.
This incredibly detailed tutorial from startingelectronics.org requires an Ethernet shield To attach your board to your home network. Here is a video of it in action:
If node.js is your jam, then it might make sense for you to take a look at the arduino-android github project. An Android app is once again provided with source code so that you can get under the hood and tinker to your heart’s content. It’s pretty bare bones, but everything is there to implement a node.js server on an Arduino board of your choice.
6. Infrared Control
Looking for a real wild card way to talk to your Arduino? Do you want to go full MacGyver? Then rip out an Infrared (IR) receiver from an old stereo or VHS player and use it to talk to your Arduino board!
This method requires your Android device to have an IR blaster built in. There are many apps available to make use of this feature, though the Mi Remote controller is free, and functions with many other household devices.
Once you have the app up and running, you will need to create a simple circuit to “sniff out” IR signals. This IR remote tutorial takes you through the process of building the circuit.
While this tutorial uses an old remote, the process is exactly the same for using an IR blasting Android device, and the availability of the parts make it a great beginner project.
This method only works within line of sight. It is, however, the cheapest way to communicate with your board wirelessly. Even if you cannot scavenge the parts to do this, an IR receiver costs less than a dollar. For a static device like a set of ceiling mounted LED strips, it could be the perfect solution to a simple problem.
Have We Missed a Tool?
These are a few ways to free your Arduino from your computer, though we are sure there are many more out there. Whatever method you use, why not implement it in a cool project such as a DSLR shutter release or an LED cube ?
How do you talk to your Arduino board? Do you always use a computer? Is there a crafty way to talk to our boards we have missed here? Let us know in the comment section below!
Image Credit: almoond/Depositphotos