Categories

A look at four Arduino related Android apps

Arduino apps on Android devices are very hit and miss they generally seem to consist of the free and open source content on the Arduino website which can be in the form of the  reference library or they can be some of the examples.

Another problem appears to be that because its free content that makes it an excuse to show way to many ads – banner ads I can handle but the pop up (interstitial ads) are frankly some of the most annoying that I have seen. Now everyone needs to make a living and a free app obviously won’t have paid purchases but this brings on to the next issue which is the lack of content – I’ve seen some with no more than 20 basic examples, full of typo’s, no schematics, poor quality schematics with mistakes, bugs in the code, code that is not formatted and so on.

My perception is that the people putting these apps together have not a lot of idea about the arduino otherwise some of these issues would be obvious and sorted.

I’ll let you decide on the next 4 apps – there is a video of each and the link if you want to install any of them

 

Arduino Codes Free

A couple of examples for arduino – very basic, could have done with schematics and layouts. You do get a picture of what you are building.

Really needs a lot more examples, its free but does show banners

Video

Link
https://play.google.com/store/apps/details?id=com.arduino.codes&hl=en

 

Arduino Handbook 2

A basic reference for the Arduino that explains many of the basic concepts with code examples. Menu and navigation are clear but think of this as a reference guide and not a tutorial that will guide you from start to finish.

 

Video

 

Link
https://play.google.com/store/apps/details?id=com.oleksandrdovhaliuk.ard_hb&hl=en

 

Arduino LED Projects

This app contains various LED related projects for your Arduino, schematics look clear , parts list is supplied and the code is clear enough.

A bit heavy on the interstitial ads

 

Video

Link
https://play.google.com/store/apps/details?id=org.vivek.cherala.arduinoledprojects

Arduino sensors app on Android

This app has 20 sensor type examples for the Arduino, I would have liked the code to have been spaced out a bit better and also on the same page as the layout but as this is a free app you cant really complain

 

Video

Link
https://play.google.com/store/apps/details?id=com.projects.arduino.vivek.cherala.arduinosensors

Arduino 4 channel line tracker sensor example

The next module to take a look at is quite often entitled 4-CHANNEL LINE TRACKER SENSOR, thats exactly what it does the module consists of a main module and 4 little sensor/reciever modules that connect via a 3 pin cable

here is a typical module and cables

The 4-Channel Line Tracker sensor provides an easy way for line tracking. A line sensor is composed of a number cells and each cell is composed of a sender and a receiver. The particularity of this sender/receiver pair is that it sends light that shall be reflected by the line to be detected but not by the eventually opaque background surrounding this line. Any sender/receiver pair that is able to make a difference between a line and the rest of ground (of a different color) can be used in a line sensor.

VCC pin is connected to 5V , GND pin is connected to the GND, S1, S2, S3, and S4 pins are connected to the digital I/O pins 2 – 5 but you can use others

Features

Operating voltage: DC 3.3V-5V
Operating Current:>1A
Operating temperature: -10 C – +50 C
Mounting Hole: M3 screws
Detection distance: 1mm to 60 CM adjustable, the closer the distance,the more stable performance, and white reflection farthest.
Output Interface: 6-wire (1234: signal output, +: positive supply -: ground)
Output signal: TTL level

 

Schematic

Code

Basic stuff here

void setup()
{
 Serial.begin(9600);
}
 
void loop()
{
 Serial.print(digitalRead(2));
 Serial.print(" ");
 Serial.print(digitalRead(3));
 Serial.print(" ");
 Serial.print(digitalRead(4));
 Serial.print(" ");
 Serial.println(digitalRead(5));
 delay(1000);
}

 

Testing

The sensor module has a HIGH output when its placed over a black line, otherwise its LOW.

 

Links

You can pick one of these modules up for as little as $2.10
Newest 4-Channel Infrared IR Line Detector Patrol Tracking Sensor Module DC 3.3V-5V Durable Quality Sensors Modules lines

Arduino rubber duck example – hello world

Requirements

Arduino Leonardo, Micro Pro, Teensy 3.0 or later. Any micro that you can simulate a keyboard basically

 

Rubber Duck Script

DELAY 3000
GUI r
DELAY 500
STRING notepad
DELAY 500
ENTER
DELAY 750
STRING Hello World!!!
ENTER

To convert this to Arduino code visit https://thehacktoday.com/ducky/, paste the code above and then click compile. You then get the Arduino code in the right hand side which can be pasted into the IDE

Arduino Code

Here is the script above converted to Arduino code

/*
 * Generated with <3 by Dckuino.js, an open source project !
 */
 
#include "Keyboard.h"
 
void typeKey(uint8_t key)
{
  Keyboard.press(key);
  delay(50);
  Keyboard.release(key);
}
 
/* Init function */
void setup()
{
  // Begining the Keyboard stream
  Keyboard.begin();
 
  // Wait 500ms
  delay(500);
 
  delay(3000);
 
  Keyboard.press(KEY_LEFT_GUI);
  Keyboard.press('r');
  Keyboard.releaseAll();
 
  delay(500);
 
  Keyboard.print("notepad");
 
  delay(500);
 
  typeKey(KEY_RETURN);
 
  delay(750);
 
  Keyboard.print("Hello World!!!");
 
  typeKey(KEY_RETURN);
 
  // Ending stream
  Keyboard.end();
}
 
/* Unused endless loop */
void loop() {}

Arduino and QYF-TM1638 module example

When I was browsing various web sites to see what electronic components to buy one day I noticed some interesting little kits comprising of switches, LEDs and a couple of 4 digit seven segment displays saw I decided to purchase one, the first thing I noticed was at the heart of the module was a chip called a TM1638, never heard of it. A quick search dug up links to the datasheet (link supplied underneath in the links section) and an arduino library (in the code section). That makes life easier.

The module I bought had 5 connections.

VCC – 5v from Arduino
Gnd – GND from Arduino
STB – strobe pin, an output from your Arduino
CLK – clock pin, an output from your Arduino
DIO –  data pin, another ouput from your Arduino

Layout

Code

You can get a library to make development easier from https://github.com/rjbatista/tm1638-library

This is a test example

#include <TM1638.h>
#include <TM1638QYF.h>
 
TM1638QYF module(8,9,10);
word mode;
 
unsigned long startTime;
 
void setup() {
  startTime = millis();
 
  module.setupDisplay(true, 7);
  mode = 0;
}
 
void update(TM1638QYF* module, word* mode) {
  word buttons = module->getButtons();
  unsigned long runningSecs = (millis() - startTime) / 1000;
 
  // button pressed - change mode
  if (buttons != 0) {
    *mode = buttons >> 1;
 
    if (*mode < 128) {
      module->clearDisplay();
      delay(100);
    }
  }
 
  switch (*mode) {
    case 0:
      module->setDisplayToDecNumber(runningSecs, 1 << 6);
      break;
    case 1:
      module->setDisplayToDecNumber(runningSecs, 1 << 5, false);
      break;
    case 2:
      module->setDisplayToHexNumber(runningSecs, 1 << 4);
      break;
    case 4:
      module->setDisplayToHexNumber(runningSecs, 1 << 3, false);
      break;
    case 8:
      module->setDisplayToBinNumber(runningSecs, 1 << 2);
      break;
    case 16:
      char s[9];
      sprintf(s, "Secs %03d", runningSecs % 999);
      module->setDisplayToString(s, 1 << 1);
      break;
    case 32:
      if (runningSecs % 2 == 0) {
        module->setDisplayToString("TM1638QY", 1);
      } else {
        module->setDisplayToString(String("LIBRARY "), 1);
      }
 
      break;
    case 64:
      module->setDisplayToError();
      break;
    case 128:
      module->setDisplayToDecNumber(*mode, 0);
      break;
    case 256:
      module->setDisplayToString("ABCDE", 1 << (runningSecs % 8));
      break;
    default:
      module->setDisplayToBinNumber(buttons & 0xF, buttons >> 8);
  }
}
 
void loop() {
  update(&module, &mode);
}

 

Links

TM1638 English datasheet
8 Bits LED Digital tube Module Keyboard Scan and Display Module TM1638 MCU

Control an RGB led using a remote control

In this example we will control an RGB led with a remote control, this will involve us connecting an infrared reciever to our Arduino as well.

We will use the buttons 1,2 and 3 to control the Red, Green and blue colours of the RGB LED. You will be able to switch the colours ona nd off which of course means you can mix the colours as well

Here is the remote control we will use in this example
1pcs/lot 38khz MCU learning board IR remote control Infrared decoder for protocol remote control For arduino

Layout

Arduino pins used

Pin 3 : IR receiver input
Pin 8 : Red cathode
Pin 9 : Green Cathode
Pin 10 : Blue Cathode

I used an IR module and RGB led module as well, the following shows this

 

Code

The code needs the IRremote remote library to be installed. Then you need to find the codes for the various buttons on the remote control that you wish to use

#include <IRremote.h>
int RECV_PIN = 3;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}
void loop()
{
if (irrecv.decode(&results))
{
Serial.println(results.value, HEX);
irrecv.resume();
}
}

Now upload the code above and open the serial monitor, when you press each button you should see the hex code for the keys you want to use, here is an example

0xFF30CF
0xFF18E7

These are the hex codes for buttons 1 and 2, we will use these in our full example underneath

Here is the complete code example
#include <IRremote.h>
 
int RECV_PIN = 3;
#define  redpin 8 
#define  greenpin 9
#define  bluepin 10 
 
boolean state1 = true;
boolean state2 = true;
boolean state3 = true;
 
IRrecv irrecv(RECV_PIN);
decode_results results;
 
void setup()  
{
    Serial.begin(9600);
    pinMode(redpin, OUTPUT);
    pinMode(greenpin, OUTPUT);
    pinMode(bluepin, OUTPUT);
    // Set high for common anode type
    digitalWrite(redpin, HIGH);  
    digitalWrite(greenpin, HIGH);
    digitalWrite(bluepin, HIGH);
  irrecv.enableIRIn(); // Start the receiver
}
 
 
void loop()  
{
  if (irrecv.decode(&results))
  {
    switch(results.value)
    {
      case 0xFF30CF:  
        Serial.println("1");
        if(state1==true)
        {
          digitalWrite(redpin, LOW);  //red on 
          state1=false; //change the state
        }  
        else
        {
          digitalWrite(redpin, HIGH);  //red off
          state1=true; //change the state
        }      
        break;
        
      case 0xFF18E7:  
        Serial.println("2"); 
        if(state2==true)
        {
          digitalWrite(greenpin, LOW); //green on 
          state2=false;
        }
        else
        {
          digitalWrite(greenpin, HIGH); //green off 
          state2=true; //change the state          
        }
        break;
        
      case 0xFF7A85:  
        Serial.println("3"); 
        if(state3==true)
        {
          digitalWrite(bluepin, LOW);  //blue on
          state3=false;
        }
        else
        {
          digitalWrite(bluepin, HIGH);  //blue off
          state3=true;           
        }
        break;
        
        
      case 0xFF6897:  
        Serial.println("OFF"); 
        digitalWrite(redpin, HIGH);
        digitalWrite(greenpin, HIGH);
        digitalWrite(bluepin, HIGH); 
        state1 = true;
        state2 = true;
        state3 = true;
        break;
        
      default :
          Serial.println("Invalid Option");
        break;
    }
  delay(250);
  irrecv.resume();
  }
}

 

Links

KEYES Infrared receiver sensor module for arduino
5PCS/LOT RGB 3 Color SMD Full Color LED Module For Arduino