Arduino is an Open Source, single-micro-controller electronics board with easy-to-use hardware and software. The Arduino board consists of 8-bit Atmel AVR microcontrollers. In addition, the board has a standard way of connecting the CPU with various other complementary components to increase its functionality through a number of add-ons called shields. You can either assemble an Arduino board yourself
When you are finished with installation, start off with Arduino programming. When working with electronic prototyping boards, all programmers must be familiar with ‘Hello World’ sample of physical computing—for microcontrollers that don’t have a display device, an LED is added. So just start the Arduino software, select your board model and enter the following code:
int ledPin = 13;
// LED connected to digital pin 13
void setup()
{
pinMode(ledPin, OUTPUT);
// sets the digital pin as output
}
void loop()
pinMode(ledPin, OUTPUT);
// sets the digital pin as output
}
void loop()
{
digitalWrite(ledPin, HIGH);
// sets the LED on
delay(1000);
// waits for a second
digitalWrite(ledPin, HIGH);
// sets the LED on
delay(1000);
// waits for a second
digitalWrite(ledPin, LOW);
// sets the LED off
delay(1000);
// waits for a second
}
connect your board via USB, and upload the program to it. As the LED has polarity, you need to fix it onto the board carefully. The long leg, typically positive, should be connected to pin 13, and the short leg to GND. The LED starts turning ‘on’ and ‘off’ at intervals of one second,as shown in Fig. 1.
The Amarino toolkit consists of three main components:
1. Android application called Amarino
2. Arduino library called MeetAndroid
3. Amarino plug-in bundle (optional)
Fig. 2: Amarino app homescreen
Now follow these steps to get the Arduino board connected to Android:
Open the installed Amarino application and click ‘Add BT Device’ to search for your Arduino BT device. Make sure that it is turned on. But before the two can talk to each other, they must be authenticated. Select the device and confirm pairing with it from the notification bar. Typically, the pin number is 1234, 12345 or 0000. Once your Arduino BT device is authenticated, it’s ready to go. See Fig. 2.
Fig. 3: Arduino ‘test’ program code
Next, install the plug-in bundle (AmarinoPluginBundle.apk) from . Thereafter you can head to event creation. Start the Amarino application and launch ‘Event Manager’ of your Arduino BT device. Click ‘Add Event→Test Event.’ This is a test event—a demo that sends a random number (0-255) every three seconds. Now your Android device is ready to communicate with the Arduino board, so set up the latter.
3. Setting up Arduino.
3. Setting up Arduino.
Open your Arduino software and select ‘File→Examples→MeetAndroid→Test.’ When the project opens, change the baud rate of your Bluetooth module from 57600 to 9600, as highlighted in Fig. 3. Upload the sketch to the board. If there is no LED on the board, you can attach one to pin 13.
Running the test program
Now your Android device and Arduino board are ready to talk to each other. In the Amarino application on your Android device, click ‘Connect’ to communicate with the Arduino board.
As soon as Android connects to Arduino, it starts sending a random number every three seconds, and that lights the LED for one second. You can monitor the process by pressing ‘Monitoring’ on the main screen of the application.
Applications
This concept of connecting Android to Arduino can be very handy in making electronics projects more useful by increasing their flexibility.
It can easily be used in home automation controls, power consumption meters, Bluetooth-controlled robots, managing devices from the computer and much more.
There is little doubt that Amarino brings us more power by helping us connect Arduino with Android.
No comments:
Post a Comment