Arduino Laser Tag Update #4

PCB Etching and Soldering Components

After working on this project for the past couple of days, I was finally able to fit everything neatly onto a printed circuit board. The breadboard is great for testing an idea, but the wires can get a bit messy as the project becomes more complex. I etched the PCB boards using the tonner method for the mask and ferric chloride as the etchant. With that said, there are a couple of changes I made to the wiring itself. Most of these changes were made to allow components to fit better with the laser tag gun. The process of making these boards begins with a breadboard diagram.

Electronic Schematic RevA_bb

Next, a wiring diagram was made from the connections on the breadboard. It makes the wiring connections easier to read.

Electronic Schematic RevA_schem

Finally the PCB board components were laid out. I used a ground fill to save as much etching as possible.

Electronic Schematic RevA_pcb

The final result.

PCB front

PCB Back

PCB Complete

Troubleshooting the Mini Kossel 3D Printer

For the past few weeks I’ve been taking a break from my laser tag project to put together my Mini Kossel 3D printer. It took a while for me to get it working, but the final print result turned out well. I purchased this printer a few months ago from an on-line company called Mixshop; there was a long delay in their lead time, but they did deliver the product in the end. I basically followed their Kossel Manual for the assembly which is pretty good, but I find their instructions to be somewhat incomplete.

See my troubleshooting guide

Arduino Laser Tag Update #3

Hardware Testing and Refinement

Laser Tag Board 15-1-22

One of the issues I encountered with my proposed setup in Update #1 is that the LED segments will periodically dim. This was because I only used one resistor to power all 7 segments (8 including the dot) in parallel. This would work if all LEDs in the display were manufactured the same way. However, it’s more likely that some LEDs draws more current than the others causing some segments to become slightly brighter while the others dim. The better way to connect the LEDs is to have a resistor after each one. I used a 2K Ω resistor after each segment so that the current flowing through each LED remains low.

Electronic Schematic 15-1-22

This hardware configuration worked out a lot better for me. All the LEDs remained at a constant brightness. I also managed to get the IR Sensor an the IR LED working at the same time. My test code for this setup is shown below.

#include <IRremote.h>

#define RECV_PIN 2

#define DIGIT_1 12
#define DIGIT_2 10
#define DIGIT_3 9
#define DIGIT_4 6

#define SEG_A 7
#define SEG_B 11
#define SEG_C 15
#define SEG_D 17
#define SEG_E 18
#define SEG_F 8
#define SEG_G 14
#define SEG_DOT 16

IRrecv irrecv(RECV_PIN);
IRsend irsend;

decode_results results;

int x = 1;

void setup()
{
  irrecv.enableIRIn(); // Start the receiver
  
  Serial.begin(9600);
  
  pinMode(13, OUTPUT);
  
  pinMode(SEG_A, OUTPUT);
  pinMode(SEG_B, OUTPUT);
  pinMode(SEG_C, OUTPUT);
  pinMode(SEG_D, OUTPUT);
  pinMode(SEG_E, OUTPUT);
  pinMode(SEG_F, OUTPUT);
  pinMode(SEG_G, OUTPUT);
  pinMode(SEG_DOT, OUTPUT);
  
  pinMode(DIGIT_1, OUTPUT);
  pinMode(DIGIT_2, OUTPUT);
  pinMode(DIGIT_3, OUTPUT);
  pinMode(DIGIT_4, OUTPUT);
  
  digitalWrite(SEG_A, LOW);
  digitalWrite(SEG_B, LOW);
  digitalWrite(SEG_C, LOW);
  digitalWrite(SEG_D, LOW);
  digitalWrite(SEG_E, LOW);
  digitalWrite(SEG_F, LOW);
  digitalWrite(SEG_G, LOW);
  digitalWrite(SEG_DOT, LOW);
  
  delay(250);
}

void loop() {
  
  digitalWrite(DIGIT_1, HIGH);
  digitalWrite(DIGIT_2, LOW);
  digitalWrite(DIGIT_3, LOW);
  digitalWrite(DIGIT_4, LOW);
  
  delay(x);
  
  digitalWrite(DIGIT_1, LOW);
  digitalWrite(DIGIT_2, HIGH);
  digitalWrite(DIGIT_3, LOW);
  digitalWrite(DIGIT_4, LOW);
  
  delay(x);
  
  digitalWrite(DIGIT_1, LOW);
  digitalWrite(DIGIT_2, LOW);
  digitalWrite(DIGIT_3, HIGH);
  digitalWrite(DIGIT_4, LOW);
  
  delay(x);
  
  digitalWrite(DIGIT_1, LOW);
  digitalWrite(DIGIT_2, LOW);
  digitalWrite(DIGIT_3, LOW);
  digitalWrite(DIGIT_4, HIGH);
  
  delay(x);
  
  if (irrecv.decode(&results)) {
    irrecv.resume(); // Receive the next value
    
    digitalWrite(13, HIGH);
    
  }else{
    digitalWrite(13, LOW);
  }
  
  if (Serial.read() != -1) {
    
    digitalWrite(DIGIT_1, LOW);
    digitalWrite(DIGIT_2, LOW);
    digitalWrite(DIGIT_3, LOW);
    digitalWrite(DIGIT_4, LOW);
    
    for (int i = 0; i < 3; i++) {
      irsend.sendSony(0xa90, 12); // Sony TV power code
      delay(40);
    }
    
    irrecv.enableIRIn();
  }
  
}

Arduino Laser Tag Update #2

Software Flow Chart

Flow Chart

Over the holidays, I started drawing a flow chart diagram for the software portion of the Arduino Laser Tag project. The idea here is to use software polling to detect the trigger and reload buttons instead of using interrupts. I wanted to get around the issue of the interrupts incorrectly detecting the release of the trigger due to the debounce of the buttons. The HDWController will be a new class created to manage all the hardware components (motors, speaker, IR emmitter and sensor). The LaserGun class will be more of an abstract class that will queue certain tasks for the HDWController to perform. You can view the Excel spreadsheet of the flow chart here.

Arduino Laser Tag Update #1

IR Sensor & 7 Segment Display Initial Testing

IR Sensor, 7 Segment Display

As part of the prototype for laser tag project, I’ve put together a Universal IR Infrared Receiver TL1838 VS1838B working in conjunction with a 4 digit 7 segment display I brought from Aliexpress. I am working towards building a testing platform to something similar to the schematic I’ve drawn below.

Electronic Schematic

We decided to go with a 4 digit display for flexibility in game programming. Mostly likely, the first two digits will be used for health and the last two will be used for ammo. The three IR Sensors on the bottom with their respective LEDs will eventually be attached on to a vest and linked back up to the gun. The IR sensors were tested with the Arduino Nano and the IR detector library from Ken Shirriff’s Blog. It was successful in detecting my remote control from a distance of more than 10 meters away. The testing code for the IR sensor and the 7 segment display is shown below.

#include <IRremote.h>

int RECV_PIN = 6;

IRrecv irrecv(RECV_PIN);

decode_results results;

int x = 1;

void setup()
{
irrecv.enableIRIn(); // Start the receiver

pinMode(13, OUTPUT);

pinMode(12, OUTPUT);
pinMode(8, OUTPUT);
pinMode(7, OUTPUT);
pinMode(14, OUTPUT);
pinMode(15, OUTPUT);
pinMode(16, OUTPUT);
pinMode(17, OUTPUT);
pinMode(18, OUTPUT);

pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);

digitalWrite(12, LOW);
digitalWrite(8, LOW);
digitalWrite(7, LOW);
digitalWrite(14, LOW);
digitalWrite(15, LOW);
digitalWrite(16, LOW);
digitalWrite(17, LOW);
digitalWrite(18, LOW);

delay(250);
}

void loop() {

digitalWrite(2, HIGH);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);

delay(x);

digitalWrite(2, LOW);
digitalWrite(3, HIGH);
digitalWrite(4, LOW);
digitalWrite(5, LOW);

delay(x);

digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, HIGH);
digitalWrite(5, LOW);

delay(x);

digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, HIGH);

delay(x);

if (irrecv.decode(&amp;results)) {
irrecv.resume(); // Receive the next value

digitalWrite(13, HIGH);

digitalWrite(3, LOW);
digitalWrite(4, HIGH);
digitalWrite(6, HIGH);
}else{
digitalWrite(13, LOW);
}
}

The hardware setup of the 7 segment display was a bit complicated because I couldn’t find the specifications for the pins. I had to test each individual segment myself. If anybody is having trouble figuring out where the common anode is, you can refer to my spread sheet here.

Arduino Laser Tag

Ebay Laser Tag Guns

For the past few months, my friends and I have been planning to make our own laser tag system that we can play at home. The goal is to make a laser tag system that we can modify and program different game modes. Why are we doing his? We just want to play some laser tag, and learn a couple of things along the way.

How Laser Tag Works

The technology we are dealing with uses infrared (IR) light. It’s been around for a long time, so if you’ve ever used a remote to turn on a TV, then chances are you’ve already seen this technology. This light is located past the lower end of the visible electromagnetic spectrum, so we can’t actually see it. But most digital cameras can still pick it up, so if you take a picture at the right moment, you can see something like this:

Remote Control

Remote control infrared operates at 38 kHz, which is very uncommon in nature. For our Laser tag set-up, we will be using infrared at the same frequency because it is a common standard. The core idea is very simple, have guns that fire off infrared and attach sensors on vests that can detect them. The logic will be handled by a programmable micro-controller. In our case, the Arduino.

Bill of Materials

Since we will be making several sets of guns, we decided to prototype one first, then mass produce the others. Here is our bill of materials for the first laser tag set, just to get us started.

Bill of Materials V1.0

Most of the parts were from China so we expected at least a month of lead time.

Project Elephant Fish Update 2

In this week I found a problem with the power supply in my  electronics set up. Originally, my idea was to power this device with a 3.7V lithium ion battery, but after some testing I found the voltage from the battery to be too low to power my servo motor. The problem stemmed from the  fact that the servo motor is ratted at a higher 4.8V. At this nominal voltage, the motor draws around 100 to 300 mA of current. However if I try to run the motor at a lower voltage, the motor will try to consume more more current to output the same amount of power. Power is equals to voltage times current so when I lowered the voltage the motor consumes up to 400 mA or more amount of current. This seems so be more than the battery I have can handle.

Battery Requirements

After discussing this issue with my professor, it was agreed that I need to specify some important requirements for the battery. First of all I must make sure the voltage is high enough to support the motor. Second, I need to make sure the battery life is large enough to last through an entire day. It will be pointless to have a device that can only last a few hours. If this device is to be used in every day life it must at least work through 8 or more hours of continuous use. Since the maximum current draw for the motor at the nominal 4.8V is around 300 mA, I would need a power source that can provide at least 2000 mAh to get the 8 hours of continuous usage that I need. Also, in order to make this device easier to handle by the visually impaired, the batteries would also have to be rechargeable so that the user does not have to mess around with the inner components of the device.

New Power Source Set up

After giving this problem some thought, a good solution to this problem would be to use regular rechargeable AA Ni-MH batteries. They are commercially available, very inexpensive to buy, and often comes with a battery charger. You can purchase a complete set on ebay of less than $15. Since each AA Ni-Mh battery only contains 1.2V, I will need 4 batteries connected in series to get the nominal 4.8V to power the motor. However this also works out since most battery chargers can only charge 4 batteries at a time. I already have an unused 4 battery charger at home so all I need now are the batteries. The 4 pack of batteries that I purchased are from Duracell and they provide up to 2450 mAh per charge. This is fantastic because that’s just the amount of battery life that I need for this project.

007

 

Upcoming Tasks

Now that the power supply and the electronic components are figured out, I need to start modelling the mechanical housing that will store all these components. Switching the power supply is a big change in my design and will require some hacking of the battery charger to make it fit with my device. I am aiming to do some mechanical models for the upcoming weeks. The updated gant chart for my progress is shown below.

Capture3

 

Project Elephant Fish Update #1

A lot of progress has been made this week for the haptics project! The workflow for the Arduino IDE has been setup, all of the necessary parts were ordered, and I even got a bit of programming for the servos done. Working with the Arduino IDE again after switching from Eclipse is a bit of a pain. I have always worked with Eclipse to do my Arduino programming but since the Arduino app came out for the Android mobile devices I was a bit curious on how it would perform on my Nexus tablet. Props to those guys who worked to get it on that platform 🙂

Preparing the Arduino IDE Workflow

This is just a short guide on how I like to set up my workflow on the Arduino IDE platform. I’m used to programming with classes on the Eclipse IDE so I was really surprised to find out that you can’t simply include your classes in the Arduino IDE and have it all work. What you need to do is to create your own custom libraries. The Arduino IDE has an option to import custom libraries through the menu: Sketch > Import Library. This functionality makes a copy of the folder you chose and places it in your default windows folder: My Documents\Arduino\libraries\. So if you want your classes to be more self contained, you’ll have to change this directory by modifying your sketchbook directory in File Preferences.

Capture

After that is done, create a folder in your sketchbook directory named “libraries” if it hasn’t been done so already. From now on, any c++ files you place in the “libraries” folder can be included on your .pde file as a custom library. One important note is that the .pde file must contain all the includes in your custom library. When the IDE compiles, it makes a temporary folder and copies of all the includes you’ve listed . If your include files are not all listed in the .pde you will get file missing errors.

Bill of Materials

The parts for the project is finally finalized! The biggest change I made to the design so far is that I removed the vibrator component completely. I did this after realizing that I can simulate vibrations using the servo motor instead which allows me to make the device smaller, less complicated, and less expensive. The bill of materials for this project is presented to you below.

Capture

I was able to source out a couple of items on this list. The items highlighted are being ordered. I even put together a small demo to see if everything comes together. It’s looking good so far.

061

Gant Chart

Due to the time constraints I have for this project I was advised to set up a Gant Chart and some milestones for myself. Hopefully this will keep motivated  till the end of my project. My goal for this week is to start on the electronic schematic and the mechanical modelling.

Capture2

New Projects Ahoy!

So it’s been awhile since my last post! I am currently working two new projects which I will keep up to date on this site. The first project that I would like to share with you is the my plastic extruder project for the 3D printer in our lab. This project is going to between me and my fellow colleague Josh. There are a couple of DIY plastic extruders already out there  but our goal is to design a plastic extruder that is affordable, mostly 3D printed, and can recycle our used plastic parts. This means simplifying the design and making it easy for anyone to assemble. You can view our initial report for this project here.

The second project I want to introduce is going to be a more personal project of mine involving haptics. The term “haptics” refers to any kind of computer generated touch. A good example of this is the vibration feedback you get when you touch a key on a touch screen or the rumble on a joystick for a video game. The haptics project I will be working on involves creating a haptic driven navigation device for the visually impaired. It will be a simple hand held device that will relay range data to the user in the form of tactile touch and force feedback. I am currently working alone on this project so progress is not as fast as I would like it to be.

For my final thoughts, I would like to give cool names for these projects. Stay tuned for new  updates on Project Xtruder and Project Elephant Fish!