Close
0%
0%

IR Wearable Human/pet tracking and Gesture Control

Humans and Pets wear small invisible beacons that allow robots and smart homes to track and easily recognize humans and pets

Public Chat
Similar projects worth following
1.2k views
0 followers
I build these projects and submit them to Hackaday in competition to earn money for College, So I have submitted this project to the Human / machine interface Challenge.

This project is multi part. 1st is a IR emitting bracelet used to track humans, pets or small robots from room to room. Simple , effective and absurdly cheap. A project I think anyone can do with enough example code. This is a spin off from the IR QR code robotics navigation project. Completely open project to integrate the bracelet into systems like raspberry pi, arduino, ez robot and other boards.

The second portion takes advantage of gesture motion control, and each person can have their own permissions so kids cannot control certain items in the home. A machine vision camera watches the light from the bands to recognize the gestures as shapes like glyphs.

Indoor Rooom Tracking of humans and kids

IR beacons on dogs and cats

IR beacons for robotics

Advanced Goal

Positioning within each room, using machine vision and camera, coupled with the base features. EZ-Robot with Pi cam without the IR filter would be best.

  • 1 × Pi Zero
  • 1 × SD card
  • 1 × Infrared LED
  • 1 × PN2222 transister
  • 1 × 680 ohm resister

View all 7 components

  • Sender Circuits for bracelets or robotic beacons

    Josh Starnes08/22/2018 at 21:10 0 comments

    Sender Circuit to be installed in the bracelets

  • NEC Infrared Transmission Protocol

    Josh Starnes08/22/2018 at 21:07 0 comments

    https://techdocs.altium.com/display/FPGA/NEC+Infrared+Transmission+Protocol

    he NEC IR transmission protocol uses pulse distance encoding of the message bits. Each pulse burst (mark – RC transmitter ON) is 562.5µs in length, at a carrier frequency of 38kHz (26.3µs). Logical bits are transmitted as follows:

    • Logical '0' – a 562.5µs pulse burst followed by a 562.5µs space, with a total transmit time of 1.125ms
    • Logical '1' – a 562.5µs pulse burst followed by a 1.6875ms space, with a total transmit time of 2.25ms

    When transmitting or receiving remote control codes using the NEC IR transmission protocol, the WB_IRRC performs optimally when the carrier frequency (used for modulation/demodulation) is set to 38.222kHz.

      When a key is pressed on the remote controller, the message transmitted consists of the following, in order:

    • a 9ms leading pulse burst (16 times the pulse burst length used for a logical data bit)
    • a 4.5ms space
    • the 8-bit address for the receiving device
    • the 8-bit logical inverse of the address
    • the 8-bit command

  • Example RPI code for sending and recieving over IR

    Josh Starnes08/22/2018 at 21:00 0 comments

    import RPi.GPIO as GPIO
    import math
    import os
    from datetime import datetime
    from time import sleep
    
    # This is for revision 1 of the Raspberry Pi, Model B
    # This pin is also referred to as GPIO23
    INPUT_WIRE = 16
    
    GPIO.setmode(GPIO.BOARD)
    GPIO.setup(INPUT_WIRE, GPIO.IN)
    
    while True:
    	value = 1
    	# Loop until we read a 0
    	while value:
    		value = GPIO.input(INPUT_WIRE)
    
    	# Grab the start time of the command
    	startTime = datetime.now()
    
    	# Used to buffer the command pulses
    	command = []
    
    	# The end of the "command" happens when we read more than
    	# a certain number of 1s (1 is off for my IR receiver)
    	numOnes = 0
    
    	# Used to keep track of transitions from 1 to 0
    	previousVal = 0
    
    	while True:
    
    		if value != previousVal:
    			# The value has changed, so calculate the length of this run
    			now = datetime.now()
    			pulseLength = now - startTime
    			startTime = now
    
    			command.append((previousVal, pulseLength.microseconds))
    
    		if value:
    			numOnes = numOnes + 1
    		else:
    			numOnes = 0
    
    		# 10000 is arbitrary, adjust as necessary
    		if numOnes > 10000:
    			break
    
    		previousVal = value
    		value = GPIO.input(INPUT_WIRE)
    	
    	print "----------Start----------"
    	for (val, pulse) in command:
    		print val, pulse
    	print "-----------End-----------\n"
    
    	print "Size of array is " + str(len(command))
    
    

    Raspberry Pi GPIO pin layout for reference. This script uses pin #16, or GPIO23

    Raspberry Pi GPIO pin layout for reference. This script uses pin #16, or GPIO23

    It just runs in an infinite loop, waiting for a 0 to be read from the infrared receiver. It'll then take note of the time and keep reading 0s and 1s, each time making note of how long a run of 1s or 0s was. Once it reads 10,000 1s, it decides the command has probably ended and returns to the top of the loop. 10,000 is arbitrary and could differ depending on your Pi's CPU speed or other factors, so you may need to adjust it. Once the command has ended, the script will print out the pulses and their durations. Here's some sample output when I ran the script and pressed my light switch remote:

    0 8982
    1 4399
    
    0 631
    1 497
    
    0 628
    1 1607
    
    0 635
    1 490
    
    0 629
    1 509
    
    0 627
    1 500
    
    0 633
    1 500
    
    0 625
    1 500
    
    0 624
    1 1623
    
    0 629
    1 1605
    
    0 622
    1 501
    
    0 626
    1 1606
    
    0 628
    1 1606
    
    0 631
    1 499
    
    0 634
    1 1605
    
    0 661
    1 1569
    
    0 632
    1 504
    
    0 626
    1 498
    
    0 627
    1 1615
    
    0 620
    1 496
    
    0 635
    1 1614
    
    0 629
    1 1599
    
    0 629
    1 504
    
    0 625
    1 505
    
    0 623
    1 516
    
    0 627
    1 1598
    
    0 631
    1 501
    
    0 625
    1 1606
    
    0 627
    1 501
    
    0 636
    1 496
    
    0 626
    1 1609
    
    0 630
    1 1606
    
    0 628
    1 1607
    
    0 623
    

    I was thrilled to find this matches up very nicely with the NEC protocol! You can see the 9 ms pulse at the beginning, followed by the 4.5 ms gap. The script is off by several hundred microseconds but it's close enough to see what's going on. The next step is to convert this series of pulses to binary.

    The basics of the NEC protocol are simple:

    • A "logical 0" is a 562.5 microsecond pulse, followed by a 562.5 microsecond gap.
    • A "logical 1" is a 562.5 microsecond pulse, followed by a 1687.5 microsecond gap.

    Keep in mind that in my pulse list above, a 0 is a pulse, and a 1 is a gap. So to start, chop off the leading 9 ms pulse and the 4.5 ms gap and then read the lines two at a time. The first two entries are:

    0 631
    1 497
    

    That's a roughly 565 pulse followed by a 565 gap, so this is a 0. Next is:

    0 628
    1 1607
    

    A 565 pulse followed by a 1687 gap (you can start to see why the numbers don't need to be exact). This is a 1. Next:

    0 635
    1 490
    

    565 pulse followed by a 565 gap, that's a 0. And so on. Notice the signal also has a trailing 565 pulse at the end. Some signals have this, some don't, but the NEC protocol suggests that the signal should have it. We end up with

    01000001101101100101100010100111
    

    I did this one by hand, but for my air conditioning remote, you can imagine it getting tedious. The algorithm to convert these pulses into binary is pretty straightforward and it's simple enough to adapt our Python script to do it for us. We can use the heuristic that any gap over 1000 microseconds is likely...

    Read more »

  • PI zero and IR circuits

    Josh Starnes08/22/2018 at 18:57 0 comments

    Example of IR transmitter using PI, I would use Pi Zero I believe.

    http://www.raspberry-pi-geek.com/Archive/2015/10/Raspberry-Pi-IR-remote

    Building and Testing an IR LED Circuit

    Although you can connect an IR LED directly to GPIO pins on the Raspberry Pi, the LED's output signal will be too weak, and the IR transmitter will have a very limited range. A simple transistor circuit solves the problem by amplifying the current output from a pin and thus increasing the IR LED's signal strength.

    To build a transistor-powered IR transmitter, you need two resistors (220ohm and 10K), a transistor (2N2222, BC547, or practically any other transistor will do), and a 940nm IR LED. Additionally, you'll need a breadboard and jump wires to assemble an IR transmitter prototype (Figure 1). Wire the components as shown in Figure 2 to assemble the IR transmitter. The next step is to check to see whether the IR transmitter actually works. To do this, you can use a simple LED Python blinking script (Listing 1) that turns the LED connected to pin 22 on and off.

    Figure 1: Transistor-powered IR transmitter schematics.
    Figure 2: Wiring diagram.

    Listing 1

    Python Blinking LED Script

    01 #!/usr/bin/python
    02 import RPi.GPIO as GPIO
    03 import time
    04 GPIO.setwarnings(False)
    05 GPIO.setmode(GPIO.BCM)
    06 GPIO.setup(22, GPIO.OUT)
    07 while True:
    08     GPIO.output(22, True)
    09     time.sleep(1)
    10     GPIO.output(22, False)
    11     time.sleep(1)

    Because the IR LED is not a regular light-emitting diode, how do you actually find out whether it blinks or not? You can use a camera with an LCD screen or smartphone camera. Point the camera at the circuit and look at the screen. If the circuit works, you should see the IR LED blinking.

    Installing and Configuring the LIRC Package

    To control a device with an IR receiver, the IR LED transmitter must send a specific signal sequence, and the LIRC package [1], which emulates the infrared signals of many remote controls, is the perfect tool for the job. LIRC is available in the Raspbian software repositories, so installing it on Raspberry Pi is just a matter of running

    sudo apt-get install lirc

    Once you've done that, you need to enable and configure the lirc_rpi kernel module. To do so, open modules in the Nano editor

    sudo nano /etc/modules

    and add the lines below to the file:

    lirc_dev
    lirc_rpi gpio_out_pin=22

    Make sure that the gpio_out_pin parameter points to the pin controlling the IR LED (in this case, it's pin 22). Next, open the file /etc/lirc/hardware.conf in Nano as before with sudo and add the following configuration to the file:

    LIRCD_ARGS="--uinput"
    LOAD_MODULES=true
    DRIVER="default"
    DEVICE="/dev/lirc0"
    MODULES="lirc_rpi"
    LIRCD_CONF=""
    LIRCMD_CONF=""

    Now, reboot the Raspberry Pi using the

    sudo reboot

    command to activate the configuration. Finally, you need to specify a profile that emulates a specific remote control. The project's website [2] offers a long list of profiles that emulate practically any remote control in existence, including remote controls for DSLR cameras. So, if you want to use Raspberry Pi to control a Nikon D90 DSLR camera, point the browser to lirc.sourceforge.net/remotes/nikon/ML-L3 and copy the profile. Next, open the /etc/lirc/lircd.conf file in Nano, paste the copied profile into it, save the changes, and restart LIRC with:

    sudo /etc/init.d/lirc restart

    Turn on the DSLR camera and enable the IR triggering mode. On your Raspberry Pi, issue:

    irsend SEND_ONCE Nikon2 shutter

    If everything works properly, your camera should fire.

  • 3D representation

    Josh Starnes08/22/2018 at 18:46 0 comments

    Here is the 3D representation of receivers places in rooms that can pickup IR signals from the IR bracelets in the home, as little as 2 , one on each end of the room to pickup signals regardless of the direction you are standing.

  • Researching products and other projects

    Josh Starnes08/22/2018 at 13:53 0 comments
  • in the beginning

    Josh Starnes08/22/2018 at 13:25 0 comments

    So this project is the spawn of my semifinalist project, QR IR code navigation for robots. I always wanted a way to interface discretely with my home and home devices. In my mind we must compromise the environment of machines and the environment of humans. Making processes simpler makes way for practicality and usefulness.  Not only can a IR bracelet allow machines to better track humans, it can be used as tracking to prompt facial recognition, emotion recognition and gesture control as well. I will post any links i find for research and proceed from there.

View all 7 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates