The discussion of the Alien series of films and the props used in them is the aim, but if it's got Big Bugs and Big Guns, then they are welcome too!





Post new topic Reply to topic  [ 79 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
 Post subject: Make your own functional motion tracker
PostPosted: Sat Apr 22, 2017 6:27 pm 

Service Number: A05/TQ2.0.32141E1
Country: United States
I am still wrapping things up and waiting on parts but I have a rough first draft on how to do it yourself:
First and foremost I couldn't do it without the write up at http://virtualfrontiers.co.uk
Mods, please move where appropriate, and I hope some of you may find this information useful.

parts:
https://www.adafruit.com/product/3410 (this is the budget pack)
https://www.adafruit.com/product/1480 (2.2” TFT LCD display)
https://www.adafruit.com/product/1746 (compass)
(not used) http://www.pcsensor.com/usb-handle-keyboard.html (4 key switch)
(not used) https://www.adafruit.com/product/1151 (hdmi to vga with 3.5mm jack)
(not used) https://www.amazon.com/Afunta-90degree- ... ee+adapter (90 degree mini hdmi to hdmi)
https://www.newegg.com/Product/Product. ... 0002-00009 (hdmi to via with 3.5mm plug)
https://www.amazon.com/RAYSUN-Packs-Deg ... usb+a+male (90 degree micro USB male, to USB A Male)
http://www.l-com.com/usb-usb-type-a-fem ... -connector (USB male field termination connector)
https://www.newegg.com/Product/Product. ... lsrc=aw.ds (usb on/off switch)
https://www.adafruit.com/product/987 (3.7 watt class d audio amp)
https://www.adafruit.com/product/1314 (3 watt 4ohm speaker)
Wires:
https://www.adafruit.com/product/266 (6” female/female jumpers)
http://www.mealink-tech.com/index.php?a ... ad&did=728 (90 degree mini HDMI to HDMI)
http://www.mealink-tech.com/index.php?a ... ad&did=731 (90 degree mini HDMI to HDMI)
https://www.adafruit.com/product/826 (6” female/male jumpers)
https://www.adafruit.com/product/758 (6” male/male jumpers)
Tools:
https://www.adafruit.com/product/148 (for your soldering screw ups)
https://www.adafruit.com/product/734 (solder)
https://www.adafruit.com/product/180 (solder iron)
the case:
http://www.nickatronprops.com/products- ... acker-kit/
screws: 2mm or m2 are what you want to use, you can go smaller, but…
https://www.microfasteners.com/tapm2-m2 ... steel.html (2mm tap)
https://www.microfasteners.com/tapm4-m4 ... steel.html (4mm tap)
https://www.microfasteners.com/mspps160 ... nless.html (m1.6 x .25 x 8mm)
https://www.microfasteners.com/mspps201 ... nless.html (m2 x .4 x 10mm)
https://www.microfasteners.com/hnms020- ... steel.html (m2 x.4mm hex nuts)
https://www.microfasteners.com/fwms2-m2 ... nless.html (m2 washers)
Brushes:
https://www.microfasteners.com/tinbrush ... count.html (144 count)
Adapters:
http://www.l-com.com/usb-right-angle-us ... ale-exit-1 (right angle micro b)
http://www.l-com.com/usb-right-angle-us ... ale-exit-2 (right angle other way)
https://www.adafruit.com/product/1959 (battery)
https://www.adafruit.com/product/1387 (type a male usb)
https://www.adafruit.com/product/1099 (microb to a female)
https://www.adafruit.com/product/1388 (type b female)

Misc stuff at your home supply warehouse:
fiberglass resin
rubber, latex, or latex free gloves
brushes
M4 screws to screw case together and 4mm/2mm/1.6mm/1.4mm or equivalent drill bits.
1/2” drill bit
1/2” conduit nipple
1/2” conduit nuts

configuring for tracker

graphic walkthrough of how to disable gui on bootup:
https://www.modmypi.com/blog/boot-to-co ... ian-jessie
Some wifi setup walkthroughs with picures:
https://raspberrypi.stackexchange.com/q ... ian-wheezy

jessie latest build does not have the wireless drivers installed
noobs does, use the full install
latest builds here: https://www.raspberrypi.org/downloads/noobs/
copy to SDCARD with etcher

Goto menu
prefrences
raspberry pi configuration
under interfaces tab turn on everything except camera
under system
set boot to CLI
This will set it to boot to shell only at startup.
Failing to set this will set the display (your monitor) to be the default display when you launch the script.
reboot

for my wireless config I have turned off broadcast of the SSID and use WEP encryption. For CLI usage this command did the trick for me:
sudo iwconfig wlan0 essid “yourssid” channel 6 key “yourkeyhere”
sudo ifdown wlan0 (this releases the IP in windows terms)
sudo ifup wlan0 (this renews the IP address in windows terms)

iwconfig is built into linux. for help on usage run: sudo iwconfig —help
linux can have as many interfaces as you wan the default interface “wlan0” will work

essid is followed by the name of your ssid in quotation marks

channel is optional, but if you are using a static channel (1, 6, and 11 do not overlap) specify that here if your are not using frequency hopping spread spectrum (FHSS.) Theoretically FHSS if enabled could increase battery consumption as you are changing channels and re-authenticating periodically.
key is the security key you have set on your access point or router.

ifdown shuts down the specified interface (in cisco the equivalent is shut, windows disable)

ifup turns on the specified interface (in cisco the equivalent is noshut, windows enable)

I had to chmod dhcpcd.conf to everyone:
sudo chmod 777 /etc/dhcpcd.conf

if you get errors with networking past this check:
/etc/network/interfaces
/etc/wpa_supplicant/wpa_supplicant.conf

Once you think you are online ping a site such as mit.edu
ping mit.edu
hit control+c to end the ping
if you get a response you are online to the internet

alternately and/or additionally you can also check your IP with:
ifconfig and look for wlan0
if it shows an IP on your network that is not 169.x.x.x or 127.x.x.x you should be connected

With linux things are always changing, that said run these commands once you have internet access:
sudo apt-get update
sudo apt-get upgrade

to launch at starup run:
sudo nano /etc/rc.local
add:
python /boot/motiontracker_compass_v3.py
ctrl+x
y
enter

Now we are still working to redo some of the scripts and once I get in the 4 button switch handle, I can rewrite the code to work with a GPIO push button switch. To change the blip creation go to this code section:
done=True # Flag that we are done so we exit this loop
if keys[K_UP]:
bliparray.append([])

if you want to change up to something else say Keypad minus put in:
K_KP_MINUS in place of K_UP

To change the quit key:
if keys[pygame.K_x]:
done=True
change K_x to say Keypad plus enter K_KP_Plus

_________________
The impossible takes a while longer and goes over budget too...


Last edited by knoxvilles_joker on Thu May 18, 2017 1:08 am, edited 3 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Make your own functional motion tracker
PostPosted: Sat Apr 22, 2017 6:33 pm 

Service Number: A05/TQ2.0.32141E1
Country: United States
and two more parts:
https://www.adafruit.com/product/987 (3.7 watt class d audio amp)
https://www.adafruit.com/product/1314 (3 watt 4ohm speaker)

_________________
The impossible takes a while longer and goes over budget too...


Top
 Profile  
Reply with quote  
 Post subject: Re: Make your own functional motion tracker
PostPosted: Sat Apr 22, 2017 6:38 pm 

Service Number: A05/TQ2.0.32141E1
Country: United States
And the file edits you must do:

Now add the needed files and notations:
sudo nano /etc/modules-load.d/fbtft.conf
add:
spi-bcm-2835
fbtft_device

sudo nano /etc/modprobe.d/ili9341.conf
add:
options fbtft_device custom name=fb_ili9341  gpios=reset:25,dc:24,led:18 speed=16000000 rotate=90 bgr=1

sudo nano /boot/cmdline.txt
add:
fbcon=map:10

if i2ctools are already installed run:
sudo i2cdetect -y 1
you should see an entry called 1e in column e row 10

_________________
The impossible takes a while longer and goes over budget too...


Top
 Profile  
Reply with quote  
 Post subject: Re: Make your own functional motion tracker
PostPosted: Sat Apr 22, 2017 6:42 pm 

Service Number: A05/TQ2.0.32141E1
Country: United States
And the wiring:
Wiring it up:
Compass Raspberry Pin # (I had to revisit things after pouring through the online documentation)
VCC 3.3v (Pin #19) This should be VIN as the 3v3 is for other options and on the model board I use that is pin 17
GND GND (Pin #25)
SCL GPIO2 (Pin #3) Correction scl is 5
SDA GPIO3 (Pin #5) Correction sda is 3

TFT Screen Raspberry Pin #
VCC 3.3v (Pin #1) fine (Adafruit’s TFT is 3v3 or 5v tolerant so I used pin #2)
GND GND (Pin #14) fine
CS GPIO8 (Pin #24) (may say LCD CS)
RESET GPIO25 (Pin #22) <--questions on this one but put on pin 22
DC\RS GPIO24 (Pin #18) <--questions on this one put put on pin 18
SD1\MOSI GPIO10 (Pin #19) fine
SCK GPIO11 (Pin #23) fine
LED GPIO18 (Pin #12) fine (it may say BACKLIGHT)
SD0\MISO GPIO9 (Pin #21) fine
SD CS GPIO7 PIN #26 <---not listed in instructions just stabbed a guess on this one. ( I think this is the CS pin for the SDCARD.

Shutdown pin:
Ground : Pin #39
GPIO 21: Pin #40
Blip pin:
Ground: Pin #34
GPIO 14: Pin #8 (this is also the UART TX pin.)

_________________
The impossible takes a while longer and goes over budget too...


Last edited by knoxvilles_joker on Sun Oct 01, 2017 7:01 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Apr 22, 2017 7:31 pm 

Country: United States
Any videos of it running? I love all the MT stuff happening lately.


Top
 Profile  
Reply with quote  
 Post subject: Re: Make your own functional motion tracker
PostPosted: Sat Apr 22, 2017 9:46 pm 

Service Number: A05/TQ2.0.32141E1
Country: United States
ask and ye shall receive

IMG_1703.jpg
IMG_1703.jpg [ 1.6 MiB | Viewed 14749 times ]

IMG_1685.jpg
IMG_1685.jpg [ 1.46 MiB | Viewed 14749 times ]

IMG_1676.jpg
IMG_1676.jpg [ 1.57 MiB | Viewed 14749 times ]

IMG_1704.jpg
IMG_1704.jpg [ 885.23 KiB | Viewed 14749 times ]


_________________
The impossible takes a while longer and goes over budget too...
Top
 Profile  
Reply with quote  
 Post subject: Re: Make your own functional motion tracker
PostPosted: Sat Apr 22, 2017 9:53 pm 

Service Number: A05/TQ2.0.32141E1
Country: United States
And my pulse rifle build. I call it the poor mans smart gun as it is just an electronics piece attached to a fully functional nerf gun.

I also have one of the evike matrix pulse rifles. I am adding a faux shotgun clip. I am not happy with the look, but time is not on my side. I am using the clip to store electronics for a three trigger assemply, load, fire, and soundtrack playing 4 different sound clips

I also have a box I am building to house a 4 button trigger assembly for various predator sounds.

Between the golden armor pieces I have to cut out, sand, and paint and the predator costume attempt, I think it will look OK.

Since documentation and communication are two things I do as part of my normal work, I always try to document this stuff in case I either forget, and to help those who are trying to do what I am trying to do. I also try to arrange the information in such a way that someone new to the craft can easily get exactly what is needed with no extras to make things work.

IMG_1666.jpg
IMG_1666.jpg [ 1.53 MiB | Viewed 14749 times ]

IMG_1670.jpg
IMG_1670.jpg [ 1.27 MiB | Viewed 14749 times ]

IMG_1696.jpg
IMG_1696.jpg [ 1.54 MiB | Viewed 14749 times ]

IMG_1693.jpg
IMG_1693.jpg [ 1.47 MiB | Viewed 14749 times ]


_________________
The impossible takes a while longer and goes over budget too...
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Apr 22, 2017 9:57 pm 

Service Number: A05/TQ2.0.32141E1
Country: United States
The Pi Zero is the only thing that will comfortably fit in the assemblies. A pi b+ could fit but I am afraid things would be so tight functionality may be problematic at best.

Working with my father I always was taught to make everything field repairable and easy to work on by the next guy. Buy using jumper wires, should something get loose, it is a simple field fix for things.

_________________
The impossible takes a while longer and goes over budget too...


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Apr 23, 2017 1:38 pm 
User avatar

Location: Brussels, Belgium
Country: Belgium
Just WOAW !


Top
 Profile  
Reply with quote  
 Post subject: Re:
PostPosted: Sun Apr 23, 2017 6:50 pm 

Service Number: A05/TQ2.0.32141E1
Country: United States
Svenza wrote:
Just WOAW !


To which part? I have only been chipping away on this since January/February. Hour or two a day seven days a week. Now that I am getting more comfortable working with the materials things are becoming much, much more easy.

_________________
The impossible takes a while longer and goes over budget too...


Top
 Profile  
Reply with quote  
 Post subject: Re: Make your own functional motion tracker
PostPosted: Sun Apr 23, 2017 10:45 pm 

Service Number: A05/TQ2.0.32141E1
Country: United States
Here is the code for the pulse rifle:

/*
--------Last edit March 2017 by Knoxvilles_joker@yahoo.com---
+++++++++explanations and parts/layout descriptions added+++++
CryBaby FX Kit v1.0, written by Sean Maio (outcry27@gmail.com)
Designed for use with the Adafruit Pro Trinket and Adafruit audio FX board
Credit and many thanks to the writers of the numerous tutorials available on both the Arduino
and Adafruit websites, without which this project could never have been completed!
-Pin Map-
Pro Trinket:
0. Serial RX, connect to Audio FX Serial TX
1. Serial TX, connect to Audio FX Serial RX
3. Fire Switch -> GND
4. Safety toggle switch -> GND
9. Muzzle LED, connect this to the GATE pin on the muzzle strobe MOSFET

Audio FX board:
TX. Connect to Trinket Pin 2 (labeled RX)
RX. Connect to Trinket Pin 1 (labeled TX)
UG. Jumper to GND to enable UART mode.

!-- DEPRECATED: the following have been replaced by Serial triggering --!
0. Firing sound
1. Firing "tail"
2. "Click" sound (out of ammo/safety on)
3. "Boot-up" sound
4. Music clip 1 (wired to a physical switch)
5. Music clip 2 (wired to a physical switch)
T00 is the boot-up sound
T02 is the click
T03 is the firing sound
T01 is the firing tail sound

We are working to find some copyright free sounds to add as an addition to github

ammo count will work with led backpack without sound board working
Test led backpack first as it is the best test for power and program ability

You can not upload firmware if pins 0 and 1 are used,
they must be disconnected before you can upload.

If troubleshooting set tx and rx to unused pins, but to talk to sound board
software serial (ss.println) or "sfx." function calls will have to be made.

Note that this diagram will not talk to the music maker shield. It only supports software serial
not direct serial communication as it is not the vs1053 chipset and that functionality disabled
per adafruit support.

Will be testing music maker and updated command set to work with it. Per adafruit support the fx board will not be
going away anytime soon.

NOTE: use only the 2220 and 987, other boards with trinket will not work!
use these boards:
https://www.adafruit.com/products/2220
with this for an external speaker:
https://www.adafruit.com/product/987
and this for a main power switch:
https://www.adafruit.com/products/1400
and am attempting to pipe it through a Trinket Pro 5V ( have a 3V model if that is neccessary)
https://www.adafruit.com/products/2000

Wiring and programming walkthroughs are linked on above sites
example switches are listed on walkthrough for fx board.
*/

#include <Wire.h>
#include <SoftwareSerial.h>
#include "Adafruit_Soundboard.h"
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"

// pins used for Serial communication with the audio board
#define SFX_TX 1
#define SFX_RX 0

SoftwareSerial ss = SoftwareSerial(SFX_TX, SFX_RX);
Adafruit_Soundboard sfx = Adafruit_Soundboard(&ss, NULL, NULL);
Adafruit_AlphaNum4 alpha4 = Adafruit_AlphaNum4();

// constants:
const int triggerPin = 3; // the number of the firing trigger pin
const int safetyPin = 4; // pin for the "safety" toggle
const int fireSoundPin = 6; // pin for the firing sound
const int muzzlePin = 9; // the number of the LED pin
const int startSoundPin = 10; // pin for the "boot-up" sound
const int clickSoundPin = 11; // pin for the bolt "click" sound
const int fireTailSoundPin = 12; // pin for the firing "tail" sound
const int fireDelay = 50; // duration in milliseconds for each "shot"

// variables:
boolean safetyOn = false;
int triggerState = 0; // variable for reading the trigger status
int safetyState = 0; // variable for reading the safety switch status
int lastTriggerState = 0; // previous state of the trigger
int lastSafetyState = 0; // previous state of the safety switch
int ammoCount = 299;
String ammoDisp = String(ammoCount);

void setup() {
// initialize the LED pin as an output:
pinMode(muzzlePin, OUTPUT);
// initialize the trigger and safety pins as input:
pinMode(triggerPin, INPUT);
pinMode(safetyPin, INPUT);
// initialize the audio pins
pinMode(startSoundPin, INPUT);
pinMode(clickSoundPin, INPUT);
pinMode(fireTailSoundPin, INPUT);
pinMode(fireSoundPin, INPUT);
pinMode(triggerPin, INPUT);
pinMode(safetyPin, INPUT);

// set up the audio trigger pins to give a path to GND when set to OUTPUT
digitalWrite(muzzlePin, LOW);
digitalWrite(triggerPin, HIGH);
digitalWrite(safetyPin, HIGH);
digitalWrite(startSoundPin, LOW);
digitalWrite(clickSoundPin, LOW);
digitalWrite(fireTailSoundPin, LOW);
digitalWrite(fireSoundPin, LOW);

Serial.begin(9600);
ss.begin(9600);
alpha4.begin(0x70); // pass in the address

delay(800); //give the audio board time to power up; otherwise bootup sound will be called before audio board is ready

Serial.print("#0\n");

alpha4.writeDigitAscii(0, '0');
alpha4.writeDigitAscii(1, '2');
alpha4.writeDigitAscii(2, '9');
alpha4.writeDigitAscii(3, '9');
alpha4.writeDisplay();
delay(500);

for (int x = 4; x > 0; x--) {
updateAmmoCounter();
ammoCount--;
delay(50);
}
updateAmmoCounter();
}

// this function calls the current value of ammoCount and writes it to the LED display
void updateAmmoCounter() {
String ammoDisp = String(ammoCount);
if (ammoCount < 10) {
alpha4.writeDigitAscii(0, '0');
alpha4.writeDigitAscii(1, '0');
alpha4.writeDigitAscii(2, '0');
alpha4.writeDigitAscii(3, ammoDisp[0]);
}
else if (ammoCount < 100) {
alpha4.writeDigitAscii(0, '0');
alpha4.writeDigitAscii(1, '0');
alpha4.writeDigitAscii(2, ammoDisp[0]);
alpha4.writeDigitAscii(3, ammoDisp[1]);
}
else if (ammoCount < 1000) {
alpha4.writeDigitAscii(0, '0');
alpha4.writeDigitAscii(1, ammoDisp[0]);
alpha4.writeDigitAscii(2, ammoDisp[1]);
alpha4.writeDigitAscii(3, ammoDisp[2]);
}
else if (ammoCount < 10000) {
alpha4.writeDigitAscii(0, ammoDisp[0]);
alpha4.writeDigitAscii(1, ammoDisp[1]);
alpha4.writeDigitAscii(1, ammoDisp[2]);
alpha4.writeDigitAscii(1, ammoDisp[3]);
}
alpha4.writeDisplay();
}

void setSafe() {
safetyOn = true;
alpha4.clear();
alpha4.writeDisplay();
delay(50);
alpha4.writeDigitAscii(0, 'S');
alpha4.writeDigitAscii(1, 'A');
alpha4.writeDigitAscii(2, 'F');
alpha4.writeDigitAscii(3, 'E');
alpha4.writeDisplay();
delay(50);
alpha4.clear();
alpha4.writeDisplay();
delay(50);
alpha4.writeDigitAscii(0, 'S');
alpha4.writeDigitAscii(1, 'A');
alpha4.writeDigitAscii(2, 'F');
alpha4.writeDigitAscii(3, 'E');
alpha4.writeDisplay();
}

void setArm() {
safetyOn = false;
alpha4.writeDigitAscii(0, ' ');
alpha4.writeDigitAscii(1, 'A');
alpha4.writeDigitAscii(2, 'R');
alpha4.writeDigitAscii(3, 'M');
alpha4.writeDisplay();
delay(50);
alpha4.clear();
alpha4.writeDisplay();
delay(50);
alpha4.writeDigitAscii(0, ' ');
alpha4.writeDigitAscii(1, 'A');
alpha4.writeDigitAscii(2, 'R');
alpha4.writeDigitAscii(3, 'M');
alpha4.writeDisplay();
delay(50);
alpha4.clear();
alpha4.writeDisplay();
delay(50);
alpha4.writeDigitAscii(0, ' ');
alpha4.writeDigitAscii(1, 'A');
alpha4.writeDigitAscii(2, 'R');
alpha4.writeDigitAscii(3, 'M');
alpha4.writeDisplay();
delay(50);
alpha4.clear();
alpha4.writeDisplay();
delay(50);
alpha4.writeDigitAscii(0, ' ');
alpha4.writeDigitAscii(1, 'A');
alpha4.writeDigitAscii(2, 'R');
alpha4.writeDigitAscii(3, 'M');
alpha4.writeDisplay();
delay(300);
updateAmmoCounter();
}

//this needs to be fixed... commented out for now
/*void playSound(int s);
void playSound(char *name) {
pinMode(s, OUTPUT);
delay(100);
pinMode(s, INPUT);
//Serial.print("P"name"\n");
}*/

// --MAIN LOOP STARTS HERE--
void loop() {
safetyState = digitalRead(safetyPin);
if (safetyState != lastSafetyState) {
if (safetyState == LOW) {
if (safetyOn == false) {
setSafe();
}
else if (safetyOn == true) {
setArm();
}
}
}
triggerState = digitalRead(triggerPin);
if (triggerState != lastTriggerState) {
if (triggerState == HIGH) {
// turn muzzle strobe off:
digitalWrite(muzzlePin, LOW);
}

while (triggerState == LOW) {
if (safetyOn == true) {
//playSound(clickSoundPin);
Serial.print("#2\n");
triggerState = digitalRead(triggerPin);
return;
}
if (ammoCount <= 0) {
//playSound(clickSoundPin);
triggerState = digitalRead(triggerPin);
return;
}
if (safetyOn == false) {
if (ammoCount > 0) {
// turn muzzle strobe on:
//pinMode(fireSoundPin, OUTPUT);
Serial.print("#3\n");
digitalWrite(muzzlePin, HIGH);
ammoCount--;

// update the ammo counter
updateAmmoCounter();

// cleanup (TAIL SOUND IS CURRENTLY COMMENTED OUT)
delay(10);
digitalWrite(muzzlePin, LOW);
delay(39);
triggerState = digitalRead(triggerPin);
if (triggerState == HIGH) {
// turn muzzle strobe off:
digitalWrite(muzzlePin, LOW);
//pinMode(fireSoundPin, INPUT);
Serial.print("q\n");
//delay(10);
//playSound(fireTailSoundPin);
//Serial.print("#1\n");
//delay(400);
}
if (ammoCount == 0){
digitalWrite(muzzlePin, LOW);
pinMode(fireSoundPin, INPUT);
//playSound(clickSoundPin);
Serial.print("q\n");
delay(10);
Serial.print("#2\n");
}
}
}
else {
return;
}
}
lastTriggerState = triggerState;
}
lastSafetyState = safetyState;
}

_________________
The impossible takes a while longer and goes over budget too...


Top
 Profile  
Reply with quote  
 Post subject: Re: Make your own functional motion tracker
PostPosted: Thu May 04, 2017 1:16 am 

Service Number: A05/TQ2.0.32141E1
Country: United States
OK got the pcsensor.com handheld in. It plays characters a, b, c, d. just change the triggering to K_a, K_b, K_c, K_d plug in the unit and it works.

I'm still chewing on a reboot or reload script, though the way my setup is I unhook the pkware unit and plug it in and a reboot has occurred.

an init.d script would work better and I can get that crafted to run at startup.

_________________
The impossible takes a while longer and goes over budget too...


Top
 Profile  
Reply with quote  
 Post subject: Re: Make your own functional motion tracker
PostPosted: Fri May 05, 2017 1:58 am 

Service Number: A05/TQ2.0.32141E1
Country: United States
The simplest way to launch it at startup:

cd /etc/
sudo nano rc.local

insert before exit 0
"python /boot/motiontracker_compass_v3.py &"

ctrl+x
y
enter

reboot
enter

script should now run at startup.

Hit the key to end the script mentioned above and you can get a terminal back to do whatever.

linux changed the way scripts are done so the old init method doesn't work anymore.

_________________
The impossible takes a while longer and goes over budget too...


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri May 05, 2017 10:34 pm 
Range Safety Officer
User avatar

Location: Edinburgh Scotland - UK
Country: United Kingdom
Very nice work. Couple of questions..? How long is the battery life in the motion tracker? What triggers the alien event?

_________________
STEVENSON F.
A11/TQ0.0.82148E1

"You are not your Drop Count."


Top
 Profile  
Reply with quote  
 Post subject: Re: Make your own functional motion tracker
PostPosted: Sat May 06, 2017 12:02 am 

Service Number: A05/TQ2.0.32141E1
Country: United States
I set a to trigger and b to quit. a is 1 on the handle and b is two.

Waiting on some low profile adapters so I can make things fit nicely in the main cavity.

As an FYI I have both the Spatcave and the Nickatron castings. I think the nickatron is sturdier, but spat cave has a smidgen more detail and has some thinner casting pieces. Both appear to be equally good products regardless...

Ian's code base is solid and does not appear to be buggy.

I brought the unit into work and powered it on and off all day running for random time periods with no noticeable effect in battery life.

The 2200VA pkcell battery puts out a constant 5v regardless of charge level. I have a second one on the way as a backup along with my backup parts order for replacements in case anything breaks. As per adafruit support this was the best unit they could find of all the ones that they tested.

as far as mounting it I am replacing the photo flash unit above the screen casing with a resin coated foam piece I glued together. I am trying to make sure I have some fit issues sorted out before I superglue it to the casing.

Have to work on a convention repair kit so I can go back to my room and do emergency repairs if needed. Plan for the worst hope for the best and you never run into anything you can't handle. Makes you look negative but really it ensures a positive outcome to any situation.

I have been requested to bring the whole thing into work to show off when I am done. I can give a more appropriate performance report when I do that.

_________________
The impossible takes a while longer and goes over budget too...


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat May 06, 2017 6:03 pm 
Range Safety Officer
User avatar

Location: Edinburgh Scotland - UK
Country: United Kingdom
Cool.

Ideally my MR replacement (now I know how much its worth) would be to switch it on and it just clicks with no detection until I trigger it. Make scripted scenarios easier..

So, keep it up.. People *are* interested..:)

_________________
STEVENSON F.
A11/TQ0.0.82148E1

"You are not your Drop Count."


Top
 Profile  
Reply with quote  
 Post subject: Re:
PostPosted: Sun May 07, 2017 11:34 am 

Service Number: A05/TQ2.0.32141E1
Country: United States
JediFraz wrote:
Cool.

Ideally my MR replacement (now I know how much its worth) would be to switch it on and it just clicks with no detection until I trigger it. Make scripted scenarios easier..

So, keep it up.. People *are* interested..:)


I would have to alter the code to get GPIO triggering to work, once I can get that done I can use a regular push button switch. The thread I started on the raspberry pi forums indicates that the triggering section can be redone to get a push button switch to work.

Given the franchise developments of late I kind of feel that this sort of information and findings I am providing will help the community as a whole greatly for others that are not used to thinking outside of the box and re-inventing the wheel.

Majenkos updated electronics kit will be smaller than what I have and possibly more expensive.

From what I have been reading the motion units use the actual trigger switch built into the case to trigger objects. I think the winning touch will be getting the script to work with GPIO triggering. Due to time factors that will be a next year deal as I am running out of time not he costume builds. The other objects in the picture is the shoulder piece for my predator costume, which I am also running out of time making.

IMG_0014.jpg
IMG_0014.jpg [ 1.77 MiB | Viewed 14436 times ]

IMG_0009.jpg
IMG_0009.jpg [ 1.23 MiB | Viewed 14436 times ]


_________________
The impossible takes a while longer and goes over budget too...
Top
 Profile  
Reply with quote  
 Post subject: Re: Make your own functional motion tracker
PostPosted: Sun May 07, 2017 11:36 am 

Service Number: A05/TQ2.0.32141E1
Country: United States
knoxvilles_joker wrote:
The simplest way to launch it at startup:

cd /etc/
sudo nano rc.local

insert before exit 0
"python /boot/motiontracker_compass_v3.py &"

ctrl+x
y
enter

reboot
enter

script should now run at startup.

Hit the key to end the script mentioned above and you can get a terminal back to do whatever.

linux changed the way scripts are done so the old init method doesn't work anymore.


For you non linux folks out there, /boot/ is what will mount when you mount the flash drive as a storage device on your computer. placing the items there will easy code edits and customizations. per standards this IS NOT a recommended practice due to security and other issues. As the units will not go online, not as much of a concern per se.

_________________
The impossible takes a while longer and goes over budget too...


Top
 Profile  
Reply with quote  
 Post subject: Re: Make your own functional motion tracker
PostPosted: Sun May 07, 2017 2:33 pm 

Service Number: A05/TQ2.0.32141E1
Country: United States
If anyone has any valid contact info for this Ian Bremner that wrote the script, I am all ears.

_________________
The impossible takes a while longer and goes over budget too...


Top
 Profile  
Reply with quote  
 Post subject: Re: Make your own functional motion tracker
PostPosted: Sun May 07, 2017 10:11 pm 

Service Number: A05/TQ2.0.32141E1
Country: United States
knoxvilles_joker wrote:
If anyone has any valid contact info for this Ian Bremner that wrote the script, I am all ears.


I got a response from him on the raspberry pi forums. I'll post the updated code once I get it.

_________________
The impossible takes a while longer and goes over budget too...


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon May 08, 2017 6:43 pm 
User avatar

Country: United Kingdom
Hello,
I am Ian Bremner and I wrote the motiontracker script although I haven't updated it in a while as real life got in the way a few months back.
I have updated the just script on the site with a few changes.

1. The action to add a blip to the screen has been amended, I have take out the Key up press and replaced it with a button press on GPIO 23 or pin #16 on the block. On my tracker this is connected to the trigger switch on the hammer drill.
This just involves replacing the line
if keys[K_UP]:
with these two lines
input_state = GPIO.input(23)
if input_state == False:

2. The speed of the wave has been increased as it was deathly slow on the pi zero (the script was originally written on a Pi 2)

Things that are on the to-do list:
Find some better quality audio, especially for the snap noise.
Tweak the pitch of the beep so it gradually gets higher pitched as the blips get nearer to the centre, at the moment, it only changes the pitch when the nearest signal is within 10 meters.
Add a subroutine to automatically calibrate the digital compass.

Any other suggestions are welcome.


Top
 Profile  
Reply with quote  
 Post subject: Re:
PostPosted: Tue May 09, 2017 2:00 am 

Service Number: A05/TQ2.0.32141E1
Country: United States
Vypr wrote:
Hello,
I am Ian Bremner and I wrote the motiontracker script although I haven't updated it in a while as real life got in the way a few months back.
I have updated the just script on the site with a few changes.

1. The action to add a blip to the screen has been amended, I have take out the Key up press and replaced it with a button press on GPIO 23 or pin #16 on the block. On my tracker this is connected to the trigger switch on the hammer drill.
This just involves replacing the line
if keys[K_UP]:
with these two lines
input_state = GPIO.input(23)
if input_state == False:

2. The speed of the wave has been increased as it was deathly slow on the pi zero (the script was originally written on a Pi 2)

Things that are on the to-do list:
Find some better quality audio, especially for the snap noise.
Tweak the pitch of the beep so it gradually gets higher pitched as the blips get nearer to the centre, at the moment, it only changes the pitch when the nearest signal is within 10 meters.
Add a subroutine to automatically calibrate the digital compass.

Any other suggestions are welcome.


well alone those lines won't do anything.

First I had to add under import
RPi.GPIO as GPIO

Then I had to set the GPIO mode and pin setup:
GPIO.setmode(GPIO.BCM)
GPIO.setup(23, GPIO.IN)

Then it recognized the button press on pin 16 with ground running to pin 14.

The problem I have is that it will not do anything until I hit a button on the keyboard then the blips show up.

Now I think the core issue is how this is coded:
while done==False:
closest = 999

#Create a temporary surface that we can resize later to match the screen resolution
tempsurface=pygame.Surface((400,300))

#check for a key up press. If one exists, add a randomly positioned blip if an 'x' is entered, quit the program
keys=pygame.key.get_pressed()
for event in pygame.event.get(): # User did something
if event.type == pygame.QUIT: # If user clicked close
done=True # Flag that we are done so we exit this loop
if keys[K_UP]:
bliparray.append([])
bliparray[len(bliparray)-1].append(random.randint(1,359))
bliparray[len(bliparray)-1].append(200)
bliparray[len(bliparray)-1].append(0)
bliparray[len(bliparray)-1].append(0)
bliparray[len(bliparray)-1].append(random.randint(5,10))
bliparray[len(bliparray)-1].append(bliparray[len(bliparray)-1][4])
bliparray[len(bliparray)-1].append(bliparray[len(bliparray)-1][1])
if keys[pygame.K_x]:
done=True

This line:
keys=pygame.key.get_pressed()
seems to be key to the problem.

In my prior tweaking I found if I changed anything other than keys the script broke itself.

Now this post on the pi forums:
https://www.raspberrypi.org/forums/view ... 180042&e=0

and this section on it:
def produceEvent():
while True:
time.sleep(1)
pygame.event.post( pygame.event.Event(pygame.USEREVENT, code='BUTTON' ))

t = threading.Thread(target=produceEvent)
t.start()
here a thread is created which runs the method produceEvent(). Current implementation just places an event each second, but here you could add code like:
CODE: SELECT ALL
while True:
GPIO.wait_for_edge(channel, GPIO.RISING)
... produce Event
GPIO.wait_for_edge(channel, GPIO.FALLING )

indicates to me that the loop has to be run differently to function with the GPIO button press.

Thoughts?

_________________
The impossible takes a while longer and goes over budget too...


Top
 Profile  
Reply with quote  
 Post subject: Re: Make your own functional motion tracker
PostPosted: Tue May 09, 2017 2:46 am 

Service Number: A05/TQ2.0.32141E1
Country: United States
And I noticed that the code was updated on the virtualfrontiers.co.uk. Thank you Vyper/Ian!!!!!!!!!!!!!!!!!!!!!!!!!!!!

The new code works perfectly. No way to quit the code and that is my only minor complaint and even that has a work around.

However, in my case, I placed the whole code base in /boot. I had to update the script to point explicitly to the files in /boot when it launches from rc.local at boot up.

Doing it this way if the script requires editing, just mount the SDCARD to your computer and edit the script that way.

I will stress that this is not the best way to do things, but this does work.

_________________
The impossible takes a while longer and goes over budget too...


Top
 Profile  
Reply with quote  
 Post subject: Re: Make your own functional motion tracker
PostPosted: Tue May 09, 2017 8:52 am 
User avatar

Country: United Kingdom
knoxvilles_joker wrote:
And I noticed that the code was updated on the virtualfrontiers.co.uk. Thank you Vyper/Ian!!!!!!!!!!!!!!!!!!!!!!!!!!!!

The new code works perfectly. No way to quit the code and that is my only minor complaint and even that has a work around.

However, in my case, I placed the whole code base in /boot. I had to update the script to point explicitly to the files in /boot when it launches from rc.local at boot up.

Doing it this way if the script requires editing, just mount the SDCARD to your computer and edit the script that way.

I will stress that this is not the best way to do things, but this does work.


There should be an easier way to start the script at boot, it should just involve putting a script into rc.local, I'll mess around with it when I get home tonight.
As for putting a quit option in, that should be fairly simple once we figure e out what condition we want to use to trigger the exit.
For example. say we rig a button GPIO8 (Pin #24) then we can add the following line of code:

exit_check=gpio.input(8)
if exit_check==false:
GPIO.cleanup()
exit(0)

Again, I'll check this out when I get home form work.
Working for a living sucks :(


Top
 Profile  
Reply with quote  
 Post subject: Re: Make your own functional motion tracker
PostPosted: Tue May 09, 2017 10:58 am 

Service Number: A05/TQ2.0.32141E1
Country: United States
rc.local works fine.

The recommended practice for this would be to run it as a service at startup. Systemctl or init.d are the methods to do this.

Just launching the script via rc.local would be sufficient.

_________________
The impossible takes a while longer and goes over budget too...


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 79 posts ]  Go to page 1, 2, 3, 4  Next



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: