How to fire an IFTT Event with a custom http request

Recently the guys from IFTT integrated a new way to trigger events – now you can call the platform with so called “Maker Events”, which are basically customizable http/api requests. Find more details here: iftt.com/maker

The request looks like this: https://maker.ifttt.com/trigger/plant_thirsty/with/key/[your key]

“plant_thirsty” is the name of the trigger that i created. If this request is fired it can trigger anything IFTT can do, you even can install the IFTT app on your iOS/Android device and get event notifications.

This is a feature that has been requested by the community since ages, but it is really awesome that it is now available!

Advertisements
Posted in Allgemein | Leave a comment

Waking up an Arduino with Input from a Sensor

Currently i am investigating ways to wakeup an Arduino out of deep sleep mode with an IRQ Event. If you think of low power standalone measurement applications, this can be very interesting, because the board can sleep with very low power-consumption (less than 10 milli-amps) until something happens.

It works that way (see code example below): After starting the Arduino you call the function sleepNow() which does two things. Define an interrupt for waking up and attach him and then put the device to sleep. For waking up different patterns can be defined, “LOW”, “RISING” and “FALLING”. If the according event is being observed on the wakeup pin the device will wakeup, proceed with the wakeup function (in this case wakeUpNow()) and then execute the loop again.

In my example i am using a tiny solar cell that can output up to 4volts under full sunlight to trigger the RISING-Event on PIN2. The interesting detail about that is that this sensor can power itself obviously, therefore the Arduino could even shut down it’s PINs during sleep and would still wakeup. This setup could be used to turn on a sensor if a box is opened for instance (think of a intrusion detection in your house or a smart geo-cache for instance). In combination with our ArduFona Board this could then trigger a GSM action or call a WEB-API etc.

In my future research i will try to identify more sensors that can be put to work like this – which is not as trivial as you might think because most sensors are working with a more complex output like I2C or do not provide the right output by other means in the first place. But i think many cases can indeed work like this, ultrasonic-sensors for distance, acceleration sensors with analog outputs etc. – i’ll keep this blog posted.

See it in full operation here:

Here is the code for the above example:

#include <avr/sleep.h>
#define buzzer 9
#define led 13

int wakePin = 2; // pin used for waking up

void wakeUpNow() // here the interrupt is handled after wakeup
{
pinMode(buzzer, OUTPUT);
digitalWrite(buzzer, HIGH);
delay(4000);
digitalWrite(buzzer, LOW);
delay(100);
}

void setup()
{
Serial.begin(9600);
pinMode(wakePin, INPUT);
pinMode(buzzer, OUTPUT);
pinMode(led, OUTPUT);
Serial.begin(9600);
attachInterrupt(0, wakeUpNow, LOW); // use interrupt 0 (pin 2) and run function
digitalWrite(led, HIGH);
delay(100);
digitalWrite(buzzer, LOW);
digitalWrite(led, LOW);
}

void loop()
{
digitalWrite(led, HIGH);
digitalWrite(buzzer, HIGH);
delay(1000);
digitalWrite(led, LOW);
digitalWrite(buzzer, LOW);
sleepNow(); // sleep function called here

}

void sleepNow() // here we put the arduino to sleep
{
set_sleep_mode(SLEEP_MODE_PWR_DOWN); // sleep mode is set here
sleep_enable(); // enables the sleep bit in the mcucr register
attachInterrupt(0,wakeUpNow, RISING); // use interrupt 0 (pin 2) and run function
sleep_mode(); // here the device is actually put to sleep!!
sleep_disable(); // first thing after waking from sleep:
detachInterrupt(0); // disables interrupt 0 on pin 2 so the
}

Posted in Arduino | Tagged | 2 Comments

First experience with my new Robomow RC306

I am sitting in my hammock while writing this article – watching my brand new Robomow RC306 cutting the grass in our little garden. I bought the guy a couple of days ago and he is doing his third round in autonomous mode today. As a robotic fan (but also as a lazy person in general) i must say, i am impressed. Ok, to be fair – i was not too impressed in the beginning because the setup procedure is really kind of dumb. Not the software, it comes with an app and even without that the configuration of the device is really ok. What i mean by dumb is how you tell him where your garden is. To do that you have to install a wire around the green parts of your garden, separate it into zones if needed (that’s not your decision), take care if there are difficult trees or other objects that might cause trouble etc. – in 2015 i thought a company with the tagline “friendly robotics” would do a little smarter. But i shouldn’t blame them because it seems to be the standard among these kind of robots at the moment. I read a quote somewhere saying that irobot is working on a different solution without the wire – but yet they have no grass mover in place.

robomow

The thing with the wire is – it’s not just a pain to install it, you even have to check very carefully whether the Robomow is ok with it and can use it as a guide to drive around safely. Plus: just today he cut the wire twice and i had to solder the pieces together to get him working again. Increase cutting height of the robot and position of the wire again, will see…
Besides that i really like it – he is much more silent than a manual mover and once the wire-problem is solved does his job quite nicely. The algorithms to avoid being stuck seem to work ok as well. Although i took the 306, which is meant to work for 600 square meter the battery does not last to do my significantly smaller garden in one approach – but i don’t bother too much. He just moves back to his station and starts over again some hours later.
As said – an app is available for iOS (and Android i guess) which works quite well. All relevant settings can be modified here which is much more convenient than on the device itself.
The Robomow does have a rain-sensor, can’t tell yet how good that works, but i think it’s a crucial feature because cutting in the rain is not a good idea – not so much because of the machine but because the ground starts to get muddy and the mover will not only get stuck but also start messing around with the ground.
We do have an iRobot in the house since quite some time but stopped using the automatic (timer-based) mode bacause it was not really convenient in the end (noise, the need to prepare the ground to some extent etc.). Not sure how this will play out with the Robomow and whether we will use him in full autonomous mode or turn him on manually from time to time. But even in that case – a nasty bit of work has vanished from my life, thank you Robomow.

Posted in Allgemein | Leave a comment

Physical effects of a missing index in MysQL

Last night i had one of these nights where you think about throwing the sh*** out of your window – which in this particular case would have been quite impressive as i was working on my lamps that are made out of concrete…

What happened? Well, we are close to shipping these lamps for our installation at re:publica next week in Berlin. The code on the Ardufona-Boards inside of these lamps has been tested several times and the file-name comes with the obvious “final_final_ship_real2_final” extensions already. I only wanted to add a tiny switch to every lamp to ease up the handling a little bit more. So i checked on these 29 lamps and figured out – most of them were not working properly anymore. After some investigations and test-drives i figured that they seemed to have problems with the network connection, although the LED sequences indicated everything was going well. Spent the rest of the night trying to figure out what was going on (serial console and all that shit) and went to bed angry and depressed. All the lamps should have shown the same test-color – instead they all did something different, different colors, some were off etc. – totally frustrating.

This morning the idea came to my mind to check the get-query the lamps were performing manually in the browser. Bang! Took ages to respond. Went to the source-code, grabbed the most tricky SQL-query (that proved to work fine and quick before), pasted it into the SQL-console – 2.3 seconds (i have three of them in the code)! Asked MySQL to explain the query and saw that it was not using indexes properly – which had no effect in the beginning of the project but now the data had grown a lot…

Still the question – did that cause my problem? Replaced the SQL/PHP-Script with a fake text-file including a static answer. Waited a few minutes and then went down in the cellar. For the first time in my life i saw the physical effect of a query-optimization, i was blown away:

IMG_3635

Posted in Allgemein | Leave a comment

Building a cellular tracker: Part 8 – the Case

As described earlier my cellular tracker did not only have a couple of electrical and software challenges – running autonomously in the wild also would require a safe housing for it, something that can handle rain, high and low temperatures, carry a solar-panel etc.

Below you can see the different cases i tested out – in fact you can see two families of cases – one known as “Otterbox“, the other with the easy mountable screws on the edges are from Adafruit and can be ordered in a small and a large version. The otterboxes can be ordered in three different sizes – also in the Adafruit store (the one in the picture below is medium on the right and small on the left). Then there is the “project case” on the front left side which can be found at Sparkfun and their distributors.

Foto 1(4)

The latter is a very nice and handy enclosure, but it just did not fit into my requirements because it is not made for outside applications. But if you need a non-waterproof solution i can recommend it.

The Otterboxes (just saw that adafruit does not sell them anymore for whatever reason) are really awesome – i take every promise they make regarding durability for granted, these are really absolutely robust and professional boxes, their closing mechanism is very handy and stable in the same time – you don’t need a single screw to fix them very tight. For my purpose a critical disadvantage (besides the price) was the fact that they are shaped in a special way and that the plastic is not perfectly translucent. As my sensor would have to measure light from the inside this was quite an issue. The other problem i faced is mounting a solar panel on it. If you want to do this a “standard” size and flat surface is critical to use the maximum space for your solar-cell. As the surface of the Otterboxes is not flat they were out (in the picture below the one in the middle is the mid-sized Otterbox with a Solar-Panel mounted on the outside). But i would really recommend them if you are looking for the most robust and in a sense beautiful housing for your project.

At the end i chose the Adafruit system, both the bigger and the medium box are in use at the moment. For both versions you can find solar-panels that fit very well into the box, for the small one i used the tiny 0.5w panel from seedstudio that comes in very cheap. The bigger one can easily host this 2w panel from Voltaic Systems for instance that can be bought at Adafruits shop as well. These cases are also of a very nice quality, i like the big plastic screws that can be screwed in with a knife or even with your fingers. They are robust enough for outdoor use and can stand a lot of rain and snow without letting too many of the bad H2O molecule guys in.

Foto(5)

Ah – and not to forget – the guy in the middle. Yes, i was inspired by the GPRS-tracker from Seed that has been sold in a similar enclosure in the past (couldn’t find a picture anymore). I really liked the idea to put the electronics simply into this glass-enclosure originally made to conserve food and marmelade. Unfortunately i cannot recommend it because it is not safe in heavy rain. I think the reason is that the whole concept is made for stuff that get’s heated up and the conserved which creates under-pressure inside the enclosure while cooling down. As i do not plan to do something like this with my Arduino the rubber between cup and case could never really get under pressure, therefore this case would not get tight enough.

Birchsensor_alpha

 

Posted in Arduino | Tagged , | 1 Comment

Finding Europe with Lights – a pan-european Internet of Things installation

One of the reasons why i wanted to have this cellular tracker was a proposal i made to the founders of re:publica – the biggest web- and blogger conference in Berlin, that takes place on May 5th to 7th this year. As i read that they are putting it under the motto “finding europe” this year something immediately jumped into my mind: You cannot find Europe in 2015 without the Internet of Things!

So i made my proposal to distribute 28 color-sensors across all european member-states* and let them measure light information and upload that into the internet (yes, my ubidots installation). And put 28 RGB-Lamps on the ground at the event, that are connected to the sensors and display their color-information. This would offer a way to “find europe” by sensing the different color-informations from these countries, see where the sun is shining at the moment and which country is in the darkness earlier than the other etc.

Foto-164

Well, they said yes, do it. Wow. So i heated up the production of sensors, the finalization (and production) of Ardufona (which will be in Shenzen by Seeedstudio) and the production of some nice, hand-made lamps with a bottom made out of concrete. Here you can see how we are engraving the city-name where the lamp belongs to with a laser:

There is a website that gives more information on the project and has some nice pictures of the lamps and the sensors as well.

We got some nice press-coverage about the project already, Make-magazine Germany covered it, the Adafruit-Blog posted it and a lot of traffic and applications came in. This really was a blast already, but the project has just begun.

At the moment we are trying to get all member-states in with at least one application to host a sensor per country – you can follow this and many other aspects of the project on it’s Facebook-Page. As i am writing this post 20 out of the 28 EU-states applied already, some of the countries with a two-digit number of applications from individuals, maker-spaces, companies and other projects. This is really amazing. And it already gave me a very concrete feeling about the current state of Europe, and what digital could mean to it. For instance, Malta does not have a single Maker-Space at the moment and it seems to be very hard to reach anybody over there. Other countries, most of the other countries do have maker-spaces, even in smaller cities and sometimes surrounded by an impressive crowd – check Radiona as an example, a Zagreb based Space from the youngest EU-memberstate Croatia – what a beautiful webpage they have!

Once the sensors are being shipped to their destinations, you can track their journey through this interactive app (scroll down), it also shows the current color-values for each sensor.

I am so proud and excited about this! Not just because of the technology that is involved. My main motivation behind it is two-fold – i love the internet of things and it’s revolutionary potential for a better society, of course being aware of the huge risks that are coming alongside with it. But i truly believe, that the internet as such and the internet of things in special can be utilized to make our society more connected, more aware of each other and a better civil society. Internet of Things can be more than tracking of air-pollution, parking slots and traffic density. It can even be more than tracking ourselfs, our heart rate, runs and eating behavior. If we get it right, it can mean so much more, presence for example. Presence can mean a lot in a world where things are getting more global, more digital and old institutions and principles less reliable. Presence can mean being in contact with that Makerspace in Zagreb, build strong digital ties between people that share a vision and believes etc. – Finding Europe with Lights is a lot about presence.

The other reason is the political vision behind the European Union. Nationalism has caused so many bad things in history and the idea of a European Society is such a great and peace-driving one, that it deserves every support we can organize. I know this sounds naive and like a dreamer, especially in these days. I even know that the current setup of the EU is far from fulfilling that vision, sure. But that’s the reason for this project, call it a dream: A connected civil society from Lisbon to Helsinki, connected with an open-internet and without mass-suveillance. Finding Europe with Lights.

— Update —-

Just as i posted this i got another application from Greece – let me quote the reason these guys gave why they would be a good host for the sensor:

Impact Hub Athens is a social enterprise which belongs in a universal community and supports innovative ideas which aim to change the society and the world! It is located in the centre of Athens, the capital of Greece and the core of business life and action. Therefore is the perfect host for interesting efforts like this.

 

*yes i intentionally am talking about _the_ EU, the European Union of the 28 member-states, headquartered in Brussels (the Brussels sensor btw will be installed inside an office in the European commission) – not because i think they offer the only solution that is worth considering, but i indeed think they do offer the best political implementation of a civil and open society in this geographical region at the moment. But also intentionally it is possible to apply as a sensor-host for the project even if your country is not a “member-state” at the moment or even in the near future. We already have one non-EU application in, which is Switzerland, great! It will be one outcome of this project to see, whether more of these are coming…

Posted in Arduino, Maker-Movement, Society | Tagged , , , , | Leave a comment

Building a cellular tracker: Part 7 – Please welcome ArduFona

If you followed the previous posts on this matter, it’s not a surprise that i was thinking of a custom board sooner than later. So here it is – Ardufona: It is a low-power Arduino which runs straight from the battery (pretty much the design of any Bareduino project including ADC-regulation) + Grove-Connectors, 2 for I2C, one Digital, one UART and one for Analog Readings.

Foto 1(3)

It can hook up Adafruits Fona and talk to it and also turn it on and off etc. On the right hand side it has an additional circuit which works as an external watchdog as i figured out that the internal one is not reliable enough to operate the board autonomously in the wild. You can read the considerations behind that guy in this earlier post, but the general principle is easy – if the board turns on the 555 circuit gets also turned on and the capacitor starts to load. If the operation of the board would take too long the 555 would switch and trigger the reset-pin of the Arduino. If everything goes fine the Arduino turns off the 555-watchdog before going to sleep.

I will post the Eagle-Files for this Board and probably also an Order-Link at my favorite PCB-manufacturer soon, but if you want to have a look, find the circuit design below.

Special thanks are going to my friend @chaosblog, who helped me to get this awesome board into my hands.

–> this board is the engine of the awesome “Finding Europe with Lights” project which takes place in cooperation with re:publica, the biggest european web-conference in Berlin on May 5-7. Find out more about the project here: findingeuropewithlights.eu.

Foto 2(3)ArduFona555

Posted in Arduino, gsm | Tagged , | 5 Comments