Android app

Posted by: on Dec 18, 2013 | No Comments

Got the sending working yesterday so I spent some minutes to hack together a small android app in order to control my switches.

Here’s a current sample on the json that the arduino outputs.
[{"Name":"lampa","deviceId":"A","deviceChannel":1,"mStatus":255},{"Name":"hall","deviceId":"A","deviceChannel":2,"mStatus":255},{"Name":"pult","deviceId":"A","deviceChannel":3,"mStatus":255},{"Name":"bad","deviceId":"A","deviceChannel":4,"mStatus":0}]

Most of the time was used trying to find a good lightbulb icon :(.

Some Arduino goodness

Posted by: on Dec 17, 2013 | No Comments

Managed to get some progress on the code today. Able to switch on and off several Nexa devices through http. Next stop the android app!

In the meantime I though I could list the stuff I’m using.

Some One-wire temperature sensors too but they are not used at the moment.

Arduino Parsing HTTP GETs

Posted by: on Dec 15, 2013 | No Comments

Adding new switches and controlling the switches that are saved is done through some http magic. By using some GET commands. This is an idea how I use the arduino to parse the HTTP GET requests.

A bit troublesome to parse all of it. But I found a great snippet over at arduino forum.


// Function to return a substring defined by a delimiter at an index
char* subStr (char* str, int index) {
char *act, *sub, *ptr;
static char copy[MAX_STRING_LEN];
int i;

// Since strtok consumes the first arg, make a copy
strcpy(copy, str);

for (i = 1, act = copy; i <= index; i++, act = NULL) {
//Serial.print(".");
sub = strtok_r(act, delim, &ptr);
if (sub == NULL) break;
}
return sub;

}

Idea I had was to call a HTTP GET with the following code.
/add=namn&deviceid=A&devicechannel=3&status=0
In order to create a device with the name "namn", having the device id A, device channel 3 and starting with the status 0. Status will changed when controlled. Device id and channel depends on the RF receiver.

My Arduino project

Posted by: on May 30, 2012 | No Comments

This post got somewhat lost when I transisted to the new server hosting and new theme. So I will just draw it up quite rough.

My Arduino project is a home automation project involving and Arduino Mega 2560, WiFly Ethernet Shields. A bunch of One-Wire temperature sensors. IR transmitter and receiver alongside RF transmitter and receiver.

The RF transmitter is supposed to communicate with my Nexa remote-controlled outlet switches and also my dimmer which is yet to be installed. This actually works at the moment quite beautifully. Thanks to some libraries out there for the RF transmitter.

Temperature sensors works as well, the plan is to have a couple around the house and also a couple outside and get an average temperature for outside and inside.

IR is supposed to control my sound system, Xbox and television.

More to come, definitely more detailed and also pictures.