ESP8266 Peripherals: Indoor Positioning with IR Camera

DF Robot IR Camera Sensor

The sensor I’m going to talk about here is a very powerful one. And you actually might have a very similar one in your home somewhere. The DF Robot Positioning IR Camera uses the same or similar module that is built into the Nintendo Wiimote controller. The sensor module is capable of simultaneously detect up to four sources of IR light and make them accessible through a I2C interface.

DF Robot IR Camera Sensor
DF Robot IR Camera Sensor

 

Specification

  • Operating voltage: 3.3-5v
  • Interface: I2C
  • Detecting distance: 0~3m
  • Horizontal detecting angle: 33 degrees
  • Vertical detecting angle: 23 degrees
  • Dimensions: 32mm x 16mm(1.26×0.63″)
  • Resolution is 128×96 pixel, with 8 sub pixels, so 1024×768
  • track four objects (IR emitting or reflecting objects)
  • Cost: USD ~$23.55

 

How does it work? 

The chip in the sensor module does all the hard work for you: filtering the noise and figuring out the strongest sources of light that passed through the IR filter in front of the camera. It will send then 4 pairs of x and y coordinates through the I2C interface to your ESP8266 (or any other MCU). If no IR source was detected the pair will just return the maximal value for 2^10 = 1023. If a source has been detected it will return the coordinates with a resolution of 1024×768 pixels to you.

 

How to wire it to the ESP8266? How to program?

Just connect the RED pin to 3.3V, the BLACK to GND and the GREEN (e.g. D6) and YELLOW (e.g. D5) to a free GPIO pin. Then use the following script, adapt the GPIO pins if necessary and upload the script to your ESP8266:

How to visualize the results?

I used Processing to visualize the data points the ESP8266 returns over  the serial line. Here is the Processing script:

 

Then I used an IR bar I still had from my Nintendo Wii and waved it in front of the camera.

Wireless IR Bar from my Wii
Wireless IR Bar from my Wii

And here is the result:

 

What can you use the sensor for?

I bought it because I plan to help my robot navigate indoor with the help of the IR Camera. I’m not yet sure if then the camera should be on the robot and the IR sources all over the room or if several cameras should track the IR sources on the Robot and send its coordinates to the robot.

You could also build a whiteboard or a head tracker. Just search for Wiimote hack on Google and you’ll get plenty of ideas what you can do with the sensor!

Where to buy?

 

Where can I get more resources?

Posted by Daniel Eichhorn

Daniel Eichhorn is a software engineer and an enthusiastic maker. He loves working on projects related to the Internet of Things, electronics, and embedded software. He owns two 3D printers: a Creality Ender 3 V2 and an Elegoo Mars 3. In 2018, he co-founded ThingPulse along with Marcel Stör. Together, they develop IoT hardware and distribute it to various locations around the world.

9 comments

  1. Salve, mi chiamo Giovanni, ho comprato questa camera ma non riesco a realizzare il grafico che si vede sulla DFRobot della posizione X,Y. Sapete dove trovare il codice per Processing-Arduino????
    Grazie mille

    • Hi Giovanni. My Italian is not that good so it would be helpful if you would ask your question in English. However, I understand that you are having problems to receive the coordinates? Did you try the code in the article? It provided me just fine with the coordinates..
      Regards, Daniel

  2. Excuse me, I want to make this graph in real time positioning
    What code do I need to apply with Arduino and Processing?
    This article does not give me the chart in photos ….: ((((

    Thank you

    • Hi Giovanni. Sadly I still don’t understand. My example shows realtime data (see video https://www.youtube.com/watch?v=3U0v_xFz5uE&feature=youtu.be). If the only thing you are missing is the coordinate system as you showed in the linked picture I suggest you have a look at the documentation of Processing. I assume you’d have to have a for-loop with an increment of 50 and then draw straight lines to get the coordinate grids in x and y direction… Is that what you are asking about?

  3. Then gives me error processing this code.

    In this line the number 5 does not want it, if I put the number 0 starts but then stops processing
    myPort = new Serial(this, Serial.list() [ 5 ], 115200);

    Because?

Leave a Reply