Melexis Contact-less Infrared Sensor - Code Port

@peekay123

After playing with Ubidots and seeing how easy it is to get sensor data logged and graphed over the internet using the Spark Core and more importantly how simple it is to setup email or text message alert events based on your sensor data I wanted to try something new and useful for me.

My fridge does not get my pop as cold as I like it even though its on the coldest setting. I like to drink pop thats almost frozen, key word is ALMOST Frozen :beer: So I find myself putting a single pop in the freezer from the fridge to cool it down some more before drinking it. Alot of the time I simply get side tracked and forget that its in the fridge and the drink ends up frozen so you can’t drink it or it simply explodes and causes a big mess :frowning:

So I started thinking that it would be cool if I put one of these Spark Core’s to good use by having it send temp data from the contact less temp sensor shown above to Ubidots.com . Once I have the sensor data flowing to Ubidots I can then setup email / text message alerts to be sent to my phone. These text message alerts will show up on my Pebble Watch as a notification letting me know my pop’s temp as it moves towards freezing. So I can tell Ubidots to send me a message when the pop is at its perfect temp so I know when to go get it out of the freezer at the perfect time vs forgetting and letting it completely freeze or explode.

With this new touch-less infrared temp sensor I can basically sit the can directly over the top of it and only measure the soda can temp.

All I need to accomplish this real quick is to get the Arduino code ported over to the Spark Core. I’m hoping this is something that @peekay123 can whip up easily :smiley:

Once I have this working I’ll make simple disk shaped enclosure the size of a hockey puck that I can sit a can or bottle on to measure its temp easily. I’ll post a Project Share thread once I have the code to get the temp sensor working.

1 Like

@RWB, I can port it but you will have to test it. The STM32 should support I2C repeated-start as required by the library but it also may not. :smile:

1 Like

@peekay123 I’m ready when you are! I hope the Spark can handle the Repeated-Start :smiley:

I’m planning to use your Adafruit OLED screen code you ported over to the Spark Core also since I have a couple of those OLED screens which always make the project cooler than if there was no screen :cool:

@RWB, turns out I already had ported that library in May 2014! I updated it to include conditional compilation so it will work for both Arduino and Spark platforms. Let me know if it works so I can make a formal IDE library. There library is on my github here. :smile:

3 Likes

@peekay123 It works!! You Da Man!! :smile: @aguspg

OK so after a few hours of playing with the code I have this up and running now! It so nice to go from idea to reality so quickly! I never dreamed I could do something like this so easily but with Adafruit, Ubidots, Spark Core, and @peekay123 I can do just about anything.

So the Spark Core box turned out to be a perfect quick case solution for measuring stuff like Pop cans so that worked out great.

Basically you sit a object over the top of the temp sensor and the temp is sent over the web to Ubidots.com

Then I setup events at Ubidots to send me emails when the temp hits 40F, then at 35F telling me the pop is almost frozen and to take it out to drink, and then at 32F telling me to take the pop out of the fridge or get ready to clean up a frozen pop can mess. That’s all I wanted it to do. Its very simple and for me very useful.

I’ll try to do a whole project thread soon. Thanks @peekay123 & @aguspg & Spark Team @zach @zachary @Dave @mohit

7 Likes

Awesome @RWB !!

I’m literally running around the office showing your creation to my colleagues. Thanks for sharing!

1 Like

@aguspg I couldn’t have done it without Ubidots! Before your Spark tutorial on how to get data on to your platform I had no way to get a email sent based on a particular variable condition. Your super easy to use Event application makes it super simple to do stuff like this.

There is so much more I want to do with all this stuff but I have very little free time these days.

I’m sure some beer drinkers could put some good use to this also, they wouldn’t have to wait 1 min to long to get that ice cold beer out of the freezer :beer:

Really this could be used to monitor the temp of anything hot or cold.

Fun stuff :smile:

@RWB @aguspg - I am a newbie playing with Spark/ microcontrollers. I am trying to set up Melexis Contact-less Infrared Sensor with my spork core. However, for some reason my temprature readings would always come as constant 1037.5 in C and 1899.5 in F. I would think my circuit is not setup correctly and thus the sensor is not working in its current form.

Some help/input from you guys would be appriciated. Attaching the circuit diagram.

1 Like

@sdaftary19, one of your pull-ups is actually going to ground! Fix that and see if things work better. :smile:

Yea let us know if you get this working.

Mine quit working in December and I have not had the time to try to fix it yet.

I just tried checking all the wring to see if one of the wires are broken but that’s not the problem.

Ubidots seems to not be getting any response from the Spark Core at all, so the data is not being received or sent from the Spark. I just did the deep update and the code compiles just fine so Spark IDE is saying all is good.

I have a temp and humidity sensor and Spark Core also setup and its working with Ubidots just fine still so I know its not Ubidots but something with the code or something after the upgrades over the last 4 months for this setup.

If you get your setup working then I’ll just try to copy your code and see if I still have issues. It worked just fine for many months and then just stopped. I used this sensor many different times for many different little task. I added a small lipo battery and 500ma USB charger so it’s totally portable.