Coat Checker invention

We live in Southern California, so we don’t have a lot of variability in our weather. My kids asked me every morning whether they needed a coat or not for school each day. So I suggested they build a weather station with their littlebits.

First off the bits:
USB power, Cloud bit, Servo bit.

I found that the littlebits IFTTT applets didn’t work with Weather Underground as well as I would have hoped. In particular the temperature coming from WU is a string, and so it can’t be used as an ingredient for a Littlebits Set Output Level applet. I remedied this by creating a custom applet using IFTTT maker platform.

You can see the applet here:
https://ifttt.com/applets/yiyAFHne-littlebits-coat-checker

Here is the underlying code:
var highTemp = parseInt(Weather.currentWeatherAtTime.HighTempFahrenheit);
if (highTemp > 70) {
Littlebits.setOutput.setPercent(“100”);
} else {
Littlebits.setOutput.setPercent(“50”);
}

if (Weather.currentWeatherAtTime.TodaysConditionImageURL.indexOf("drizzle") > 0 ||
Weather.currentWeatherAtTime.TodaysConditionImageURL.indexOf("lightning") > 0 || Weather.currentWeatherAtTime.TodaysConditionImageURL.indexOf("rain") > 0 
) {
  Littlebits.setOutput.setPercent("0");
}
Littlebits.setOutput.setDurationMs("-1");

The script does the following:
Convert the temperature to an integer/number. If today’s high temperature is greater than 70 degrees F, set the output level on the servo to 5100. If today’s high temperature is less than 70 degrees F, set the output level on the servo to 50.
Then there is some complicated pattern matching to see if the image is rain, because WU oddly doesn’t provide a rain indicator as an output. If rain or thunder is present we set the output level to 0.
Finally we set the duration to -1, which means set the output level, to the number we specified, forever (or until the next run basically).

My kids built the invention, decorated it and I taught my older kid (8) to understand the javascript code so that he could recognize the concepts and give me a single line of code back. He co-authored the setoutput level to 50 line.

Issues we have had with this build. Obviously needing to write a custom applet was more than I expected. The cloud bit is unreliable. This is the second cloud bit I’ve gotten, the first wouldn’t connect at all. When I connect to the cloud bit using my phone I can set the output level 3 times, then the cloudbit no longer responds. For this invention that limitation works fine since the applet only runs once a day. But it does not instill confidence in me trying to use it for inventions where near real time communication would be needed. Also the bit is regularly disconnecting from the wifi. I’ve moved the Coat checker to the same room as the wifi router and it does not maintain a stable connection. The kids know not to trust it if the lights are blinking. That’s unfortunate.

Joseph Elwell.


We’re so sorry you’re having all this trouble. Can you please connect with us at support@littlebits.cc. We can help you troubleshoot and send you replacements if needed.

Hi there !
Great invention you made and very useful too !
Concerning your cloud bit issue, the unstable connection could be caused by your WiFi network.
Have you tried to measure it with a WiFi analyser app on your smartphone ?
It happened to me so I checked the WiFi and noticed that many nearby routers transmitted on the same channel. So I changed my router settings to transmit on an empty channel.
This solved my unstable connection.

Greetings

I bought a Smart Home Kit today and it turns out the cloudbit is fine. :slight_smile: The Smart Home kit came with a number bit. That made it easier to test the cloudbit. Sure enough, I can send many repeated numbers over and over to the cloudbit and they show up on the number bit. I tested the servo with the slide bit and I can control the servo in realtime. But I guess a combination of the cloudbit and servo bit has some sort of cool down? I’m not sure how long it is.

I like this weather station over all the others I have seen on the website because the others all feature Tomorrow’s weather. My kids need to know the weather for Today. Weather Underground makes that a bit difficult to gather, which is why the custom applet was needed. This implementation does not require any service to run, which is another huge win over the other implementations we’ve found.

Fantastic! !
Be aware that the servo draws more power then other bits so you probably need a wall power adapter.
Also, you might need to filter the power line as the servo causes spikes on the 5v line. There is a post somewhere here to deal with this.
:slight_smile:

I don’t have any bits after the servo bit. So I don’t think spikes will matter for this invention, but that is good information to know. I am using wall power.
Thanks,
Joseph Elwell.