RSS

Remote Operated Laser Pointer – Part 1

26 Jan
Remote Operated Laser Pointer – Part 1

Like it or not, Internet of Things (IoT) is going to be all more prevalent in the world around us. I wanted to explore how things could become smart, indicate events to humans in innovative ways.

I have this idea of a small camera drone, such as the RYZE Tello that I’ve been playing around with for a while being able to fly around and recognize objects. When it does, let’s say a picture of a cat, then there should be some way for the drone to indicate a positive identification. One inexpensive way of doing this could be a laser pointer mounted on top of the drone that could light up and cast a beam on the object. The object would light up with a red dot, positively indicating to the casual observer that the drone has honed in on the object in the actual physical world.

Such a setup would need several key components:

  • A drone with a camera that is able to stream images or video, such as the RYZE Tello. I showed in an earlier article that it is possible to control the flight of the drone through a program running on a Raspberry pi device. It is also possible to stream images or video to the pi for processing.
  • A remote-controlled laser beaming device that could be controlled programmatically.
  • Image recognition using neural network processing hardware.

I will blog on the end to end development of this project and will upload videos of the implementation in action. As a first step, I’ve begun with a connected device. The laser beaming device itself has been sourced from a cheap keychain laser pointer.

Keychain laser pointer

Using a hacksaw and a pair of pliers, I stripped opened the aluminium canister shell to reveal the glorious miniature electronics inside. Using a soldering iron, I removed the two LEDs. However, I left the switch pots on, since it would very tricky to remove them given the tiny size of the PCB. The laser beam diode is the cylinder-like unit at the top. The covering connects to the positive (+4.5 V) and negative to the lead just below. In the unit, the LR 44 button cells go into the circuit through the spring at the other end.

Laser pointer diode board

Fantastic! I have the laser pointer. Next, I need to wire up a few components.

Components

Several parts are needed for this project. Let’s look at the most important components.

  • Raspberry Pi 3 Model B – For the compute power and as the bridge between the hardware and software worlds.
  • One channel relay board – This is a mechanical relay switch that can close or open a circuit as it receives an input signal from the Raspberry Pi.
  • Button coin cell battery socket holder – That’s a long name for a unit that can house 2 LR 44/AG 13 button cells to give a combined voltage feed of around 3 V. For this project, I would be using two of them.
  • Plexi glass sheets – These are amazing to work with to create custom housing to hold the electronics. In this case, I’m using a bit of this to act as separators. A hook cutter makes it easy to work with these.
All components wired up

Connections are fairly straight forward. Let me start with the right side of the relay. You’ll see that I took 4 LR44 batteries stacked together with two coin cell battery socket holders to get a tiny power pack supplying +6 V approx. This power pack will be important when mounting on the drone later in the project. The horse carving is meant to simulate the object onto which the laser beam would be projected.

The relay wiring on the left side is very similar to how it is described in this you tube video by PiddlerInTheRoot. Here you will get to see the setup in action. I had to replace the carved horse with a black cardboard box to show the laser beam in a clearer way.

Circuit in action

As I needed around 4.5 V for the laser diode, I added a few resistors to step down the voltage to a safe operating level. Using this handy voltage divider calculator, that gave me 220 Ohms connected to +ve, followed by 1 K Ohm resister to -ve. Here is the python code that switches on and off the laser pointer diode circuit.

import RPi.GPIO as GPIO
import time

channel = 4

# GPIO setup
GPIO.setmode(GPIO.BCM)
GPIO.setup(channel, GPIO.OUT)

def laser_on(pin):
    GPIO.output(pin, GPIO.HIGH) # Turn laser on

def laser_off(pin):
    GPIO.output(pin, GPIO.LOW) # Turn laser off

if __name__ == '__main__':
    try:
        laser_on(channel)
        time.sleep(3)
        laser_off(channel)
        time.sleep(3)
        GPIO.cleanup()
    except KeyboardInterrupt:
        GPIO.cleanup()

So that is the progress over a weekend. Using VNC Viewer it is possible to login to the Raspberry pi from a laptop, tablet and even a mobile phone. Once in, the python script above can be executed and the laser pointer can be observed to shine a beam and stop. The script could also be written to call an API on the web periodically, and when the API returns a value of interest, the program could set the laser to turn on. This has plenty of practical applications, such as a silent alarm. Let’s say the laser unit is pointed to the front of a room, where a development team is facing. The program loop checks if a build has failed on a CI/CD server. If it is the case, shine the beam on…the whole team sees it on the wall and gets alerted that the build has broken.

As mentioned at the start of this blog, I’m going to use the laser pointer for the drone to indicate visually whether it has detected an object of interest by shining a laser beam on the object.

More to come as I move on to the next steps. Stay tuned!

 
1 Comment

Posted by on January 26, 2020 in IoT

 

Tags: ,

One response to “Remote Operated Laser Pointer – Part 1

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

 
%d bloggers like this: