Android Question App to control AC lights

skyluke83

Member
Licensed User
Longtime User
Hi All,

do you have ideas or experiences on how to create an app to control AC lights on/off? what should be the right hardware platform if i want to use a library for b4a that already exists?

Thank you in advance
Luca
 

derez

Expert
Licensed User
Longtime User
1. This http://www.aliexpress.com/item/Smar...er-supply-Wireless-Switch-for/1755194653.html
does it without any other HW, just its supplied application, directly from your phone to the plug at home.
2. Arduino uno + relay + b4j server application on your home computer + b4a application on your phone. Phone calls the home server and tell it your switch position, the command is transferred to the arduino by usb or by Bluetooth, the arduino switch the relay to the requested position.
Arduino http://www.aliexpress.com/item/UNO-R3-MEGA328P-For-Arduino-without-USB-Cable/2041245131.html
With bluetooth you need this http://www.aliexpress.com/item/1pcs...-serial-pass-through-wireless/1107225252.html
The relay is here http://www.aliexpress.com/item/Free...lay-Module-Shield-for-Arduino/1726504761.html
 
Upvote 0

skyluke83

Member
Licensed User
Longtime User
Hi, wow thanks for the information! I like the second option better, because i want to create a complex scenario. One question: which library should i use for Arduino? Is there any example?

Thank you
Luca
 
Upvote 0

derez

Expert
Licensed User
Longtime User
You don't need any special library for using Arduino. You need Serial, Asyncstreams and maybe ByteConverter.
The establishment of the connection is done by the pc or the device to the arduino - pc starts serial object to the arduino com port (when in usb) or device finds the Bluetooth of the arduino. In both cases the data is passed by Asyncstreams. I have found that using AsyncstreamsText is very useful to receive complete data messages from Arduino.
 
Upvote 0

skyluke83

Member
Licensed User
Longtime User
Derez, thank you 100000000 times for your precious help. I noticed Arduino "Mega ADK" board seems to be more suitable for android. Do you know the difference? is that i can directly plug to the android USB, right? 'cause that would help..

Thank you!
Luca
 
Upvote 0

derez

Expert
Licensed User
Longtime User
I am not familiar with this Arduino. I have received Arduino Uno starter set from my kids as a birthday present 3 month ago and I'm building cars since then...:)

I've googled and saw what it is. I don't see the advantage of connecting with a usb cable to the android, I prefer the BT connection, but may be I don't see your app type. As I wrote above, I build cars and they do not move well with a cable hanging from them.
 
Last edited:
Upvote 0

microbox

Active Member
Licensed User
Longtime User
Hi, in my case I used the following hardware setup.
1. Arduino mega(Uno will be fine)
2. Solid state relay(to switch motored appliances)
3. Android phone as main controller and SMS receiver
4. OTG cable
See example()
 
Upvote 0

tchart

Well-Known Member
Licensed User
Longtime User
Hi All,

do you have ideas or experiences on how to create an app to control AC lights on/off? what should be the right hardware platform if i want to use a library for b4a that already exists?

Thank you in advance
Luca

Why not just get WiFi controlled LED lights like Limitless or Mi-light? Much cheaper and safer than messing around with relays and AC power. You can use my library or check out my app that turns lights on and off based on a schedule (https://play.google.com/store/apps/details?id=com.tchart.scheduled). All my outdoor lights are automated.
 
Upvote 0

Thuong

Member
Licensed User
Longtime User
simple: Arduino Uno + Bluetooth + relay with B4A code Bluetooth
difficult : Arduino UNO + Ethernet + relay with B4A code UDP
more: Arduino UNO + GSM Shield + relay with B4A code SMS

I can help you , Luca
 
Upvote 0
Top