How to control Devices with Android-Part 1

BrotherV
Sun Dec 06, 2015 9:57 am
WiFi Telnet between ESP8266 and Android Device

Hi, maybe this topic not good for here but it’s a part of a big project (How to control Devices with android).
There are many ways to control other devices via android such as Bluetooth, Wifi and etc.
In this topic we try to focus on Wifi protocol. I have an ESP8266_ESP 201 module and I connected to PL2303 as you can see in fig1.
In this project I tried to create an Access Point with ESP8266 and I set up a server on port 9000, then I wrote an application for Android, so I can communicate with modules. Application after creating the socket communicates directly with the module.
there is a button in application, when you press it application tries to communicate through the socket and LED remains lit as long as the connection is not established.
fig1
Image

PL2303 USB to Serial Converter
Image

Make sure Android device connected to ESPap (pass: 12345678)

Image

Chat between PC (COM port) and Android Device

Image

Image

Android and Arduino Source code (apk file stored in WiFiTelnet\bin\ Dir)

http://4upld.com/X7mj


RogerClark
Sun Dec 06, 2015 7:38 pm
Thanks BrotherV

I have been working in something similar using Bluetooth Low Energy.

I am using this module

http://www.aliexpress.com/item/Micro-Bl … eb201560_2

And the Arduino IDE

I use a reprogrammed STM32F103C8 board to act as the SWD programmer
http://www.aliexpress.com/item/STM32F10 … eb201560_2

I am using a free App by RedBearLab for serial, as I have a sketch for BLE written by RedBearLab, but of course i could change the sketch and use another App.


BrotherV
Sun Dec 06, 2015 8:16 pm
RogerClark wrote:Thanks BrotherV

I have been working in something similar using Bluetooth Low Energy.

I am using this module

http://www.aliexpress.com/item/Micro-Bl … eb201560_2

And the Arduino IDE

I use a reprogrammed STM32F103C8 board to act as the SWD programmer
http://www.aliexpress.com/item/STM32F10 … eb201560_2

I am using a free App by RedBearLab for serial, as I have a sketch for BLE written by RedBearLab, but of course i could change the sketch and use another App.


RogerClark
Sun Dec 06, 2015 8:21 pm
Thanks for the information on HC05.

I have also been using HM10 modules, but they only have an AT command set, so are not as useful as devices which are fully programmable.

BLE is short range and does not penetrate walls very well, but I find it is easier to connect to BLE devices as you do not need to change wifi settings


BrotherV
Sun Dec 06, 2015 8:35 pm
I am working with a team whose job it is to design and build cranes, they are very keen to be able to control the device via Android, So I chose ESP8266 module for this work(this module works well up to 60 meters in close area).

BrotherV
Sun Dec 06, 2015 9:01 pm
RogerClark wrote:Thanks for the information on HC05.

I have also been using HM10 modules, but they only have an AT command set, so are not as useful as devices which are fully programmable.

BLE is short range and does not penetrate walls very well, but I find it is easier to connect to BLE devices as you do not need to change wifi settings


RogerClark
Sun Dec 06, 2015 9:50 pm
nRF51822 is a Bluetooth 4.0 (aka Bluetooth Smart, aka Bluetooth Low Energy) SoC uP

I think although the nRF24L01 uses 2.4GHz it is not Bluetooth and uses a proprietary Nordic Semi protocol to send data to other nRF24L01 devices.

The HM10 uses a TI CC2540 or CC2541 device, but its not possible to compile firmware for this chip unless you have the IAR compiler which costs $$$$$$$$$$.
So most people just use the HM10 module as it comes with some AT Command firmware that allows you to connect via Bluetooth as a Uart.
But the HM10 uses its own BLE GATT profile, so you have to use an App that uses that GATT.
(You can’t use any Apps that use the Nordic UART GATT profile as its not the same as the HM10 GATT profile)


BrotherV
Mon Dec 07, 2015 6:26 am
RogerClark wrote:nRF51822 is a Bluetooth 4.0 (aka Bluetooth Smart, aka Bluetooth Low Energy) SoC uP

I think although the nRF24L01 uses 2.4GHz it is not Bluetooth and uses a proprietary Nordic Semi protocol to send data to other nRF24L01 devices.

The HM10 uses a TI CC2540 or CC2541 device, but its not possible to compile firmware for this chip unless you have the IAR compiler which costs $$$$$$$$$$.
So most people just use the HM10 module as it comes with some AT Command firmware that allows you to connect via Bluetooth as a Uart.
But the HM10 uses its own BLE GATT profile, so you have to use an App that uses that GATT.
(You can’t use any Apps that use the Nordic UART GATT profile as its not the same as the HM10 GATT profile)


zoomx
Mon Dec 07, 2015 1:21 pm
nRF24L01 uses 2.4GHz , there is an Arduino sketch for doing 2.4GHz frequency scanner, known as “Poor Man’s 2.4 GHz Scanner”.

https://arduino-info.wikispaces.com/Nrf … Hz+Scanner

http://forum.arduino.cc/index.php?topic=54795.0


mrmonteith
Mon Dec 07, 2015 2:58 pm
I used a HC-05 connected to an Arduino. But the key was I used App Inventor 2. They have some cool videos out for it. But it’s real easy to develop an app that can control your micro. My Arduino is on a 4 wheel chassis with motor controller. With App Inventor it’s drag-n-drop development. My next step was to try out it’s Google Voice Recognition piece. It would let me use voice commands to control my RC car chassis. But so far just using buttons works great.

RogerClark
Mon Dec 07, 2015 8:07 pm
OK

i just looked uo the HC05 and Hc06 and they use a different BLE SoC, by Cambridge Silicon Radio.
But it looks like it uses an expensive proprietary toolchain.

I have now managed to get a demo working for both the types of nRF51822 modules that I have, by using mbed.

However Im still working towards getting all the modules working under the Arduino IDE ( but at the moment one of them still doesnt work with Arduino)


mrmonteith
Fri Jan 08, 2016 9:18 pm
I wanted add a comment about using an Android app to control your projects. If you’re not big on app development for Android I found MIT App Inventor 2. It’s more of a visual programming environment but you can get an app up and running pretty quickly. I created one to control my rc car chassis that has an Arduino, motor shield, and HC-05. My first app was to control it via buttons. My next step was to use AI2’s option to connect to Google voice recognition components so that I could actually talk to my project.

Bottom line it’s easy to build and app for your phone. There’s a couple of YouTube videos on how to do it.
http://ai2.appinventor.mit.edu/

Michael


RogerClark
Sat Jan 09, 2016 2:32 am
Thanks for the link

I have done some programming on Android using Eclipse but that was ages ago, and its not my specialty.

So a visual alternative for simple projects sounds appealing


weiming
Sat Jan 09, 2016 3:33 am
eclipse or android studio ?

RogerClark
Sat Jan 09, 2016 9:22 pm
Both

mrmonteith
Sun Jan 10, 2016 1:04 am
My time is so limited these days. I squeeze what time I can playing with electronics and micros. So I do cut a few corners when I can. But it is kind of cool to control things with your phone. If I can win the Powerball or retire I could have more time to do a lot more. lol

I must say I don’t miss Eclipse. lol My last job was Java app development using Eclipse for some in-house apps. But I spent more time solving Eclipse issues. It’s very powerful. But just as finicky. lol


stevech
Sun Jan 10, 2016 4:58 am
mrmonteith wrote: I must say I don’t miss Eclipse. lol My last job was Java app development using Eclipse for some in-house apps. But I spent more time solving Eclipse issues. It’s very powerful. But just as finicky. lol

jonr
Sat May 28, 2016 1:15 am
I’ve been using generic CC2541 modules and reprogramming them with simple serial port transfer code based on Redbear BLE Mini code. Then I use their Android chat app to talk to it. The IAR IDE is free for a month.

If power is not a concern, I’d just use an ESP8266.


RogerClark
Sat May 28, 2016 1:26 am
AFIK

IAR has a 1 month evaluation period. I don’t think you are supposed to do anything with any binaries you produce in that month (apart from determining if you want to buy IAR).
Otherwise you can just keep re-registering on a slightly different email address each month and keep on developing….

There is a repo in github called bluebasic which allows you to use the CC2541 as a BASIC interpreter, but I’ve heard its quite buggy :-(
However it may be good enough for some things.


EldenNelson
Thu Jun 16, 2016 3:38 pm
Hi..i am new to this forum. As per my knowledge the HM10 uses a TI CC2540 or CC2541 device, but its not possible to compile firmware for this chip unless you have the IAR compiler which costs.So most people just use the HM10 module as it comes with some AT Command firmware that allows you to connect via Bluetooth as a Uart.But the HM10 uses its own BLE GATT profile, so you have to use an App that uses that GATT.

Luc_Exe
Fri Jul 08, 2016 2:30 pm
I’ve used a HC05 module to interface Arduino with a cheap bluetooth OBD2 scanner to get Speed and RPM data from the car.

While is not plug and play, I’ve found it easy to work with. Just an init code with AT commands wich you can save and almost just copy & paste to the upcoming projects. Thes rest is clean UART.

As far as I know, the HC05 (master and slave modes) and the HC06 (slave only) are in fact the same hardware, but with different firmware, despite the different board versions.


Leave a Reply

Your email address will not be published. Required fields are marked *