Vous êtes sur la page 1sur 7

HMI CONTROLLER (/)

FOR ARDUINO (/) DOWNLOADS (/DOWNLOADS.HTML) F.A.Q. (/FAQ.HTML) CONTACT (/CONTACT.HTML)

HMI CONTROLLER FOR ARDUINO


The Hmi Controller for Arduino is an application for the Android OS that allows you to connect your
Arduino board (UNO and Mega) with your Android device in an easy way, it can be connected over
Bluetooth or LAN (Local Area Network), without the need of understanding nothing about Android
programming, also without the need of knowing a lot of functions or writing extended code in your
Arduino sketch to make the communication. Hmi Controller managed all the control process of the
pins and variables declared in your Arduino project.

Make your own customizable hmi in the app without the need of a computer, you can select from six
dierent objects (widgets): button, switch, led, display 7 segments, bar indicator and slider.

Never as been so easy to control your Arduino board!

(https://play.google.com/store/apps/details?
id=com.casdata.hmicontrollerforarduino)

The Widgets
You can nd six dierent components (widgets) to interact with your Arduino, which are divided into two groups. The rst group are the
input widgets that are conform by:

1. Button: Is used with the variables pin-out and virtual-boolean-in. In the conguration box in the app, only requires a name tag and
the variable which is going to be associated.

2. Switch: Used the same variables like the button widget and it have the same conguration box.

3. Slider: It changes a variable of type int from a min value to a max value, it acts like a potentiometer. It's compatible only with the
virtual-int-in variable. In the conguration box, it requires to put the name tag, the min value, the max value and the variable to
associate.

The second group of widgets are the output widgets, these are:

1. Led: This widget turns on or o according to the state of the associated variable. The variables to associate are: pin-out, pin-in and
virtual-boolean-out. It only requires the variable to associate and a name tag.

2. Display 7 segments: It show an integer number from 0 to 9999, the associate variable is the virtual-int-out. It only requires the
variable to associate and a name tag.

3. Bar Indicator: This widget shows the state of a variable from a min to a max value, the associate variable is the virtual-int-out. In the
conguration box, it requires to put the name tag, the min value, the max value and the variable to associate.

Note: The input widgets sends data to the Arduino board and the output widgets reads data from the Arduino board.

Types of variables
The Hmi Controller use six dierent types of variables for the interaction between the application and the Arduino board, this variables
are:

1. pin-in: This variable represents a physical INPUT pin of the Arduino board. This variable is automatically declared when is used the
Arduino pinMode function in the sketch.

2. pin-out: It represents a physical OUTPUT pin of the Arduino board. This variable is automatically declared when is used the Arduino
pinMode function in the sketch.

3. virtual-boolean-in: It's a boolean variable used as an "IN" data from the app to the Arduino. It can be declared in the hmi system by
using the attachBooleanIn function in the sketch.

4. virtual-boolean-out: It's a boolean variable used as an "OUT" data from the Arduino board to the app. It can be declared in the hmi
system by using the attachBooleanOut function in the sketch.

5. virtual-int-in: It's an int variable used as an "IN" data from the app to the Arduino. It can be declared in the hmi system by using the
attachIntIn function in the sketch.

6. virtual-int-out: It's an int variable used as an "OUT" data from the Arduino board to the app. It can be declared in the hmi system by
using the attachIntOut function in the sketch.

Functions for Arduino


One of the great advantages of the this app is that the programing of the Arduino to make the communication is very easy and simple,
there are a serial of functions that make this possible, those are:

Hmi.attachIntIn(intvariable, charletter);

The attachIntIn allows you to attach a variable of type int to the Hmi system, this variable it must be already declared in the Arduino
sketch and is used to read data from the Android device. The argument letter is a tag of type char for identify the int variable inside the
Hmi Controller app.

Hmi.attachIntOut(int variable, char letter);

This function attach an Int variable to the Hmi system, this variable it must be already declared in the Arduino sketch and is used to write
data to the Android device. The argument letter is a tag of type char for identify the int variable inside the Hmi Controller app.

Hmi.attachBooleanIn(boolean variable, charletter);

The attachBooleanIn is used for attach a variable of type boolean to the Hmi system, this variable it must be already declared in the
Arduino sketch and is used to read data from the Android device. The argument letter is a tag of type char for identify the boolean
variable inside the HMI Controller app.

Hmi.attachBooleanOut(boolean variable, char letter);

The attachBooleanOut function attach a boolean variable to the Hmi system, this variable it must be already declared in the Arduino
sketch and is used to write data to the Android device. The argument letter is a char used as a tag for identify the boolean variable inside
the HMI Controller app.

In order to use the Hmi Controller with your Arduino board, you must implement one of the following functions at the end of your sketch:

Hmi.softSerial(SoftwareSerial mySerial): Is used when you're implementing a Bluetooth connection with the Arduino SoftwareSerial
library, this is recommended to be use when implementing the Arduino UNO and Arduino micro.

Hmi.hardSerial(HardwareSerial mySerial): Is used when you're implementing a Bluetooth connection with the Arduino
HardwareSerial library, this is recommended to be use when implementing the Arduino Mega.

Hmi.n Ethernet(Server myServer): Is used when you're implementing an Arduino Ethernet shield.

This functions transmits the data between the two devices, in other words, it allows the connection of your Arduino board and your
Android device.

Note 1: If in your code you're making a loop that ends when a specic variable or an input pin has changed, you must also include one of
this functions inside that loop.

Note 2: For more understanding take a look to the examples.

INSTALLING THE HMI CONTROLLER


The Hmi Controller app can be found for downloading from here (https://play.google.com/store/apps/details?
id=com.casdata.hmicontrollerforarduino). Once you have it installed in your Android device, you must download a modied version of
the Arduino IDE from here (/downloads.html), this version of the Arduino IDE its compatible with the app, it have all the functions of the
Hmi system included, other versions of the Arduino IDE will not work with the HMI Controller app.

USING THE HMI CONTROLLER WITH BLUETOOTH


In order to use the app with a Bluetooth connection, it's necessary to have a Bluetooth module, in case you don't have one, you can get
one here (http://www.dx.com/es/p/jy-mcu-arduino-bluetooth-wireless-serial-port-module-104299#.VH1TAjGG98E) at a low price. The
module used in this guide is the JY-MCU HC-06.

The module use a serial communication with the Arduino so it can be connected in the serial ports that are between the pin 14 to pin 19
when using an Arduino Mega. On an Arduino Uno and Nano the serial pins are the pin 0 and pin 1. The adapter can also be connected in
other pins declared as serial pins with the Software Serial library.

1. Connect the Bluetooth module to the Arduino board.

2. Connect the Arduino to the computer.

3. Open the Arduino IDE for HMI Controller.

4. Write or open a sketch with the HMI functions in it, there are some examples below that you can use.

5. Load the sketch to the Arduino board.

6. Turn ON the Bluetooth in the Android device. In case that the Arduino Bluetooth module isn't paired with Android continue with the
next point , otherwise go to step number eight.

7. Go to the Bluetooth settings in the Android settings, make your Android visible to all nearby Bluetooth devices and tap the "search for
devices" button. The pairing password of the JY-MCU HC-06 module is 1234.

8. Open the HMI Controller app in the Android device, select "Bluetooth" in the type of connection dialog box and select your Arduino
Bluetooth module.

9. To add a widget go to Edit -> "Add widget" that's in the action bar, the "Edit" button looks like a pencil.

10. Once all the widgets are in place according to the desired design, tap the "Play" button to begin the connection.

USING THE HMI CONTROLLER WITH A LOCAL AREA NETWORK


For the connection of the app with the Arduino board over a LAN (Local Area Network) it requires the Arduino Ethernet Shield.

1. Connect the Ethernet Shield to the Arduino board.

2. Plug the RJ-45 cable to the Ethernet Shield.

3. Connect the Arduino to the computer.

4. Open the Arduino IDE for HMI Controller.

5. Write or open a sketch with the HMI functions in it.

6. When using the Ethernet functions in the sketch is important to set the IP address, the subnet or mask, the gateway and the MAC for
the Ethernet Shield, other things to keep in mind is the number of the port, this number must be set to the port number 23.

7. Load the sketch to the Arduino board.

8. Open the HMI Controller app in the Android device, select "LAN (Ethernet Shield)" in the type of connection dialog box.

9. Set the IP address of the Arduino board, the same IP that was congured in the Arduino sketch.
10. To add a widget go to Edit -> "Add widget"that's in the action bar, the "Edit" button looks like a pencil.

11. Once all the widgets are in place according to the desired design, tap the "Play" button to begin the connection.

ARDUINO MEMORY CONSIDERATIONS


The HMI Controller uses great part of the Arduino SRAM (http://arduino.cc/en/pmwiki.php?n=Tutorial/Memory), so it's important to
know the type of applications that's going to be used, for big projects with a lot of variables it's recommended to use the Arduino
Mega, for small to medium projects the Arduino UNO and the Nano will do the job.
There are more use of SRAM when using the Ethernet Shield than the Bluetooth module. Check the next table for reference.

Arduino board SRAM when using the HMI system

Arduino UNO (bytes) Arduino M!A (bytes)


"ree # tota$ SRAM a%ai$ab$e "ree # tota$ SRAM a%ai$ab$e
&$uetooth So"twareSeria$ 1'1 # ' *+,-. */1' # *,+.
&$uetooth HardwareSeria$ 10/ # ' */,-. ' # ,-.
thernet Shie$d 1'-/ # ' *',/-. */ # *,10.

EXAMPLES
For an easy understanding of how to use the app with the Arduino IDE, there are three examples, each one with the Arduino .ino le and
the examples can be found in menu of the app.

Accessing only the pins of the Arduino:

(/uploads/4/3/6/0/43609407/arduino_pins_bluetooth.ino)
arduino_pins_bluetooth.ino
Download File
(/uploads/4/3/6/0/43609407/arduino_pins_bluetooth.ino)
Attaching and using the virtual int variables:

(/uploads/4/3/6/0/43609407/virtual_int_variables_bluetooth.ino)
virtual_int_variables_bluetooth.ino
Download File
(/uploads/4/3/6/0/43609407/virtual_int_variables_bluetooth.

Attaching and using the virtual boolean variables:

(/uploads/4/3/6/0/43609407/virtual_boolean_variables_bluetoot
virtual_boolean_variables_bluetooth.ino
Download File
(/uploads/4/3/6/0/43609407/virtual_boolean_variables_bluet

Car example:

(/uploads/4/3/6/0/43609407/car.ino)

car.ino
Download File
(/uploads/4/3/6/0/43609407/car.ino)
Hmi Controller for Arduino example part 1

Hmi Controller for Arduino example part 2


ARDUINO TEMPLATES

(/uploads/4/3/6/0/43609407/template_ethernet.ino)
(/uploads/4/3/6/0/43609407/template_bluetooth_serial.ino)
(/uploads/4/3/6/0/43609407/template_bluetooth_softwareseria
template_ethernet.ino template_bluetooth_serial.ino template_bluetooth_softwareserial.ino
Download File Download File Download File
(/uploads/4/3/6/0/43609407/template_ethernet.ino)
(/uploads/4/3/6/0/43609407/template_bluetooth_serial.ino)
(/uploads/4/3/6/0/43609407/template_bluetooth_softwarese

2015 Sergio Daniel Castaeda N . All rights reserved.

FREE WEBSITE (HTTP://WWW.WEEBLY.COM/?UTM_SOURCE=INTERNAL&UTM_MEDIUM=FOOTER&UTM_CAMPAIGN=3) POWERED BY (HTTP://W


UTM_SO

Vous aimerez peut-être aussi