Adding additional sensors to your Mbot using your Android phone and Automate


#1

Hi all - I am using Android’s Automate app (llamalabs)

http://llamalab.com/automate/

to communicate with my Mbot by IR.

Automate lets you set up “flows” on your cell phone (using block programming). I’ve set up a flow that uses the cell phone (LG4) orientation sensor so that when the phone is pointing north it sends an IR signal. The Mbot picks this up (The signal turns out to be the same as the “4” on the IR Remote that came with Mbot) and then “knows” when it is headed north. The problem is I have to have “raw codes” to put in the Automate “Transmit IR” block. The IR code that corresponds to “4” on the IR remote is as follows:

8950, 4400, 550, 550, 600, 500, 600, 1650, 550, 550, 600, 500, 600, 550, 600, 500, 600, 550, 550, 1650, 600, 1600, 600, 550, 550, 1650, 600, 1600, 600, 1600, 600, 1650, 600, 1600, 600, 500, 600, 550, 600, 500, 600, 1600, 600, 550, 600, 500, 600, 550, 600, 500, 600, 1600, 600, 1650, 600, 1600, 600, 500, 600, 1650, 550, 1650, 600, 1600, 600, 1600, 600

This code was in an app on the Automate community, so I just got lucky to find it - but I can’t find any other raw codes to use in my project. I understand Makeblock uses NEC protocol and I’ve done searches but so far haven’t found anything that works.

Any suggestions or help appreciated!

I should mention I am also working on this project using a flow that flashes the LED on the LG4 to communicate with the Mbot - (I tape or otherwise attach) the cell phone to the top of the Mbot and when an event (say that the phone is pointed north) is triggered - the phone flashes the LED and this is then read by the Mbot ambient light sensor (built in)… You could use multiple flashes to communicate other directions - but this has proven to be pretty slow as there is a minimal time that it takes to turn the FLASH LED on and off. That’s why I want to use the IR signals.

One final use I’ve made of this idea is to stick a LumaLight on top of the Mbot. The LumaLight is a PIR night light that comes in a little disc form. It fits perfectly on top of the Mbot and when triggered, you can read the onboard light sensor values to trigger some behavior in the Mbot - for example, when I get up at night and step out into the hallway, the LumaLight triggers, the Mbot reads the light level and then travels down the hal way in front of me -l lighting my way!


#2

Have you looked here? It’s the source code for the Makeblock library that contains the IR Remote code. :slight_smile:


#3

I’ll have a closer look but I don’t think it’s the same thing. The automate app uses an array of numbers as in the ex I posted for each command.


#4

Here is an example of some of the “raw” codes (NEC) that the Automate app needs to work:

http://irdb.tk/codes/

example:

+9024 -4512 +564 -1692 +564 -564 +564 -564 +564 -1692 +564 -1692 +564 -564 +564 -564 +564 -564 +564 -564 +564 -1692 +564 -1692 +564 -564 +564 -564 +564 -1692 +564 -1692 +564 -1692 +564 -564 +564 -1692 +564 -564 +564 -1692 +564 -1692 +564 -564 +564 -564 +564 -564 +564 -1692 +564 -564 +564 -1692 +564 -564 +564 -564 +564 -1692 +564 -1692 +564 -1692 +564 -39756

but I don’t know if it will work with Mbot

S


#5

So I downloaded an Arduino program to the Mbot that reads RAW IR codes. Then I used the IR remote on the Mbot to grab the codes. Then I reset the default Mbot program and tried the “1” key. I didn’t get a code that was different from the “4” but I did with the “9”. You can increase the resolution on the Arduino code and I may try that. So I know have two IR codes and I can also turn the flashlight on/off - so if I stick it on top of the Mbot I can send two IR codes and a flashlight and the fourth is no signal, so I can map all four cardinal directions this way and communicate them from my Android to the Mbot so now I have a working compass for the Mbot without giving up any ports to a sensor. I may write this up for Lets Make Robots or do an Instructable. I think others would be interested in expanding their Mbot this way.


#6