Yep Rad, I always liked that Alien's pinger device. I think there are some 3D prints for it. Got the sound working with the range, then my TFMini pooped out...not a very robust unit. First it lost the range between 6 and 10 m, then it lost part of the Tx Rx... anyway, another in the mail somewhere..
https://www.youtube.com/watch?v=PaERy9LacZo
XRAD'S Electronic Designs
Re: XRAD'S Electronic Designs
Nearly finished with the real working LIDAR. Going on my laser blaster pic rail. Here are some prelim pics:
Re: XRAD'S Electronic Designs
Here is final prototype . Works like a champ!
See vid:
https://www.youtube.com/watch?v=OzD6tEk ... e=youtu.be
See vid:
https://www.youtube.com/watch?v=OzD6tEk ... e=youtu.be
Re: XRAD'S Electronic Designs
Pic is LIDAR into corner betwen 5-7m away.
Here is the Thingiverse project:
https://www.thingiverse.com/thing:3144301
Here is the code if anyone interested:
Here is the Thingiverse project:
https://www.thingiverse.com/thing:3144301
Here is the code if anyone interested:
Code: Select all
#include <TFT.h>
#include <SPI.h>
#include <TFMini.h>
#include <Servo.h>
//Teensy 3.2 pin definitions:
#define DC 9
#define CS 10
#define MOSI 11
#define RST 12
#define SCK 13
#define SERVO_PIN 23 // servo control signal
#define PINAUDIO1 14 // scanner start sound
#define PINAUDIO2 15 // scanner cycle default sound
#define PINAUDIO3 16 // scanner object >0m & <1m
#define PINAUDIO4 17 // scanner object >1m & <2m
#define PINAUDIO5 18 // scanner object >2m & <3m
#define PINAUDIO6 19 // scanner object >3m & <4m
#define PINAUDIO7 20 // scanner object >4m & <5m
#define PINAUDIO8 21 // scanner object >5m & <6m
#define BLACK 0x0000 // 16 bit color choices
#define RED 0x001F
#define CYAN 0x07FF
#define GREEN 0x0400
#define MAGENTA 0xF81F
#define BLUE 0xF800
#define WHITE 0xFFFF
#define YELLOW 0xFFE0
const int r_beam = 100; // pixel length of green scan radius
const int r2 = (r_beam * .33);
const int r3 = (r_beam * .66);
const int rMin = 0;
const int rMax = 600;
TFT tft = TFT( CS, DC, RST );
Servo servo;
TFMini tfmini;
// distance char array to print to the screen
char rc_Printout[ 5 ];
int interval = 0;
double distance = 0;
int r_beam1 = 10;
void setup( )
{
servo.attach( SERVO_PIN );
Serial.begin(115200);
// set up audio
pinMode(PINAUDIO1, OUTPUT);
pinMode(PINAUDIO2, OUTPUT);
pinMode(PINAUDIO3, OUTPUT);
pinMode(PINAUDIO4, OUTPUT);
pinMode(PINAUDIO5, OUTPUT);
pinMode(PINAUDIO6, OUTPUT);
pinMode(PINAUDIO7, OUTPUT);
pinMode(PINAUDIO8, OUTPUT);
//start the TFMini
Serial1.begin(TFMINI_BAUDRATE);
tfmini.begin(&Serial1);
delay(100);
tfmini.setSingleScanMode();
//clear the TFT
tft.begin( );
tft.background( BLACK );
delay(200);
digitalWrite(PINAUDIO1, HIGH);
delay(100);
digitalWrite(PINAUDIO1, LOW);
//cool start up
for ( int i = 0; i < 3; i ++ )
{
tft.setTextSize( 2 );
tft.stroke( RED );
tft.text( "WARNING", 40, 20 );
tft.text( "INITIALIZING", 10, 40 );
tft.text( "LIDAR", 50, 60 );
tft.stroke( WHITE );
tft.text( "MAX RANGE 10m", 4, 90 );
tft.stroke( GREEN );
tft.rect( 2, 2, 158, 124 ) ;
delay(500);
tft.background( BLACK );
}
tft.setTextSize( 2 );
tft.stroke( RED );
tft.text( "RANGE", 10, 1 );
for ( int i = 0; i < 3; i ++)
{
for ( int i = 0 ; i < 10 ; i++) {
tft.stroke (BLUE);
tft.fill (BLACK);
tft.circle(80, 117,(r_beam1 * i));
delay(10);
}
tft.stroke( RED );
tft.setTextSize( 1 );
tft.text( "10m", 3, 38 );
}
// here comes my cool pulse LIDAR ring effect
for ( int i = 0; i < 3; i ++) {
for ( int i = 0 ; i < 10 ; i++) {
tft.stroke (BLUE);
tft.fill (BLACK);
tft.circle(80, 117, ((r_beam1 * .66) * i));
delay(15);
}
tft.stroke( RED );
tft.setTextSize( 1 );
tft.text( "6.5m", 15, 78 );
}
for ( int i = 0; i < 3; i ++) {
for ( int i = 0 ; i < 10 ; i++) {
tft.stroke (BLUE);
tft.fill (BLACK);
tft.circle(80, 117, ((r_beam1 * .33) * i));
delay(30);
}
tft.stroke( RED );
tft.setTextSize( 1 );
tft.text( "3.3m", 30, 120 );
}
tft.background( BLACK );
}
void loop( )
{
tft.stroke( BLUE );
tft.circle( 80, 128, r_beam );
tft.circle ( 80, 128, r_beam - r2 );
tft.circle ( 80, 128, r_beam - r3);
tft.setTextSize( 2 );
tft.stroke( RED );
tft.text( "RANGE", 10, 1 );
tft.setTextSize( 1 );
tft.stroke( RED );
tft.text( "10m", 3, 38 );
tft.setTextSize( 1 );
tft.text( "6.5m", 15, 78 );
tft.setTextSize( 1 );
tft.text( "3.3m", 30, 120 );
//Left display/servo rotation
for ( int i = 60; i < 120; i = i + 1 )
{ tfmini.externalTrigger();
uint16_t distance = tfmini.getDistance();
servo.write( i );
delay( 30 ); //any longer and scans a bit slow, any less and too fast for clean display/sound activation
//This is for 10m display range
int r = distance * 0.1;
String r_Printout = String( r * 0.1 );
if ( r <= 100 ) {
tft.stroke( 0, 0, 0 );
tft.setTextSize( 2 );
tft.text( rc_Printout, 100, 0 );
r_Printout.toCharArray( rc_Printout, 5 );
tft.stroke( WHITE );
tft.setTextSize( 2 );
tft.text( rc_Printout, 100, 0 );
}
//Sound control of FXMini
//I am sure this can be done in an array, but this is very fast
int range = map(distance, rMin, rMax, 0, 5);
switch (range) {
case 0:
digitalWrite(PINAUDIO2, LOW);
digitalWrite(PINAUDIO4, LOW);
digitalWrite(PINAUDIO5, LOW);
digitalWrite(PINAUDIO6, LOW);
digitalWrite(PINAUDIO7, LOW);
digitalWrite(PINAUDIO8, LOW);
digitalWrite(PINAUDIO3, HIGH);
Serial.println(PINAUDIO3);
break;
case 1:
digitalWrite(PINAUDIO2, LOW);
digitalWrite(PINAUDIO3, LOW);
digitalWrite(PINAUDIO5, LOW);
digitalWrite(PINAUDIO6, LOW);
digitalWrite(PINAUDIO7, LOW);
digitalWrite(PINAUDIO8, LOW);
digitalWrite(PINAUDIO4, HIGH);
Serial.println(PINAUDIO4);
break;
case 2:
digitalWrite(PINAUDIO2, LOW);
digitalWrite(PINAUDIO3, LOW);
digitalWrite(PINAUDIO4, LOW);
digitalWrite(PINAUDIO6, LOW);
digitalWrite(PINAUDIO7, LOW);
digitalWrite(PINAUDIO8, LOW);
digitalWrite(PINAUDIO5, HIGH);
Serial.println(PINAUDIO5);
break;
case 3:
digitalWrite(PINAUDIO2, LOW);
digitalWrite(PINAUDIO3, LOW);
digitalWrite(PINAUDIO4, LOW);
digitalWrite(PINAUDIO5, LOW);
digitalWrite(PINAUDIO7, LOW);
digitalWrite(PINAUDIO8, LOW);
digitalWrite(PINAUDIO6, HIGH);
Serial.println(PINAUDIO6);
break;
case 4:
digitalWrite(PINAUDIO2, LOW);
digitalWrite(PINAUDIO3, LOW);
digitalWrite(PINAUDIO4, LOW);
digitalWrite(PINAUDIO5, LOW);
digitalWrite(PINAUDIO6, LOW);
digitalWrite(PINAUDIO8, LOW);
digitalWrite(PINAUDIO7, HIGH);
Serial.println(PINAUDIO7);
break;
case 5:
digitalWrite(PINAUDIO2, LOW);
digitalWrite(PINAUDIO3, LOW);
digitalWrite(PINAUDIO4, LOW);
digitalWrite(PINAUDIO5, LOW);
digitalWrite(PINAUDIO6, LOW);
digitalWrite(PINAUDIO7, LOW);
digitalWrite(PINAUDIO8, HIGH);
Serial.println(PINAUDIO8);
break;
default:
digitalWrite(PINAUDIO3, LOW);
digitalWrite(PINAUDIO4, LOW);
digitalWrite(PINAUDIO5, LOW);
digitalWrite(PINAUDIO6, LOW);
digitalWrite(PINAUDIO7, LOW);
digitalWrite(PINAUDIO8, LOW);
digitalWrite(PINAUDIO2, HIGH);
Serial.println(PINAUDIO2);
}
tft.stroke( GREEN );
tft.line( 80, 128, 80 + r_beam * cos( ( 360 - i ) * 3.14 / 180 ), 128 + r_beam * sin( ( 360 - i ) * 3.14 / 180 ) );
if ( r > 0 && r <= r_beam + 2 )
{
tft.circle( 80 + r * cos( ( 360 - i ) * 3.14 / 180 ), 128 + r * sin( ( 360 - i ) * 3.14 / 180 ), 2 );
tft.fillCircle( 80 + r * cos( ( 360 - i ) * 3.14 / 180 ), 128 + r * sin( ( 360 - i ) * 3.14 / 180 ), 2 , RED );
if (r < r2) {
tft.fillCircle( 80 + r * cos( ( 360 - i ) * 3.14 / 180 ), 128 + r * sin( ( 360 - i ) * 3.14 / 180 ), 2 , WHITE );
}
}
}
tft.background( BLACK );
tft.stroke( BLUE );
tft.circle( 80, 128, r_beam );
tft.circle ( 80, 128, r_beam - r2 );
tft.circle ( 80, 128, r_beam - r3);
tft.setTextSize( 2 );
tft.stroke( RED );
tft.text( "RANGE", 10, 1 );
tft.setTextSize( 1 );
tft.stroke( RED );
tft.text( "10m", 3, 38 );
tft.setTextSize( 1 );
tft.text( "6.5m", 15, 78 );
tft.setTextSize( 1 );
tft.text( "3.3m", 30, 120 );
//Right display/servo rotation
for ( int i = 120; i > 60; i = i - 1 )
{
tfmini.externalTrigger();
uint16_t distance = tfmini.getDistance();
servo.write( i );
delay( 30 );
int r = distance * 0.1;
String r_Printout = String( r * 0.1 );
if ( r <= 100 ) {
tft.stroke( 0, 0, 0 );
tft.setTextSize( 2 );
tft.text( rc_Printout, 100, 0 );
r_Printout.toCharArray( rc_Printout, 5 );
tft.stroke( WHITE );
tft.setTextSize( 2 );
tft.text( rc_Printout, 100, 0 );
}
int range = map(distance, rMin, rMax, 0, 5);
switch (range) {
case 0:
digitalWrite(PINAUDIO2, LOW);
digitalWrite(PINAUDIO4, LOW);
digitalWrite(PINAUDIO5, LOW);
digitalWrite(PINAUDIO6, LOW);
digitalWrite(PINAUDIO7, LOW);
digitalWrite(PINAUDIO8, LOW);
digitalWrite(PINAUDIO3, HIGH);
Serial.println(PINAUDIO3);
break;
case 1:
digitalWrite(PINAUDIO2, LOW);
digitalWrite(PINAUDIO3, LOW);
digitalWrite(PINAUDIO5, LOW);
digitalWrite(PINAUDIO6, LOW);
digitalWrite(PINAUDIO7, LOW);
digitalWrite(PINAUDIO8, LOW);
digitalWrite(PINAUDIO4, HIGH);
Serial.println(PINAUDIO4);
break;
case 2:
digitalWrite(PINAUDIO2, LOW);
digitalWrite(PINAUDIO3, LOW);
digitalWrite(PINAUDIO4, LOW);
digitalWrite(PINAUDIO6, LOW);
digitalWrite(PINAUDIO7, LOW);
digitalWrite(PINAUDIO8, LOW);
digitalWrite(PINAUDIO5, HIGH);
Serial.println(PINAUDIO5);
break;
case 3:
digitalWrite(PINAUDIO2, LOW);
digitalWrite(PINAUDIO3, LOW);
digitalWrite(PINAUDIO4, LOW);
digitalWrite(PINAUDIO5, LOW);
digitalWrite(PINAUDIO7, LOW);
digitalWrite(PINAUDIO8, LOW);
digitalWrite(PINAUDIO2, LOW);
digitalWrite(PINAUDIO6, HIGH);
Serial.println(PINAUDIO6);
break;
case 4:
digitalWrite(PINAUDIO2, LOW);
digitalWrite(PINAUDIO3, LOW);
digitalWrite(PINAUDIO4, LOW);
digitalWrite(PINAUDIO5, LOW);
digitalWrite(PINAUDIO6, LOW);
digitalWrite(PINAUDIO8, LOW);
digitalWrite(PINAUDIO7, HIGH);
Serial.println(PINAUDIO7);
break;
case 5:
digitalWrite(PINAUDIO2, LOW);
digitalWrite(PINAUDIO3, LOW);
digitalWrite(PINAUDIO4, LOW);
digitalWrite(PINAUDIO5, LOW);
digitalWrite(PINAUDIO6, LOW);
digitalWrite(PINAUDIO7, LOW);
digitalWrite(PINAUDIO8, HIGH);
Serial.println(PINAUDIO8);
break;
default:
digitalWrite(PINAUDIO3, LOW);
digitalWrite(PINAUDIO4, LOW);
digitalWrite(PINAUDIO5, LOW);
digitalWrite(PINAUDIO6, LOW);
digitalWrite(PINAUDIO7, LOW);
digitalWrite(PINAUDIO8, LOW);
digitalWrite(PINAUDIO2, HIGH);
Serial.println(PINAUDIO2);
}
tft.stroke( GREEN );
tft.line( 80, 128, 80 + r_beam * cos( ( 360 - i ) * 3.14 / 180 ), 128 + r_beam * sin( ( 360 - i ) * 3.14 / 180 ) );
if ( r > 0 && r <= r_beam + 2 )
{
tft.circle( 80 + r * cos( ( 360 - i ) * 3.14 / 180 ), 128 + r * sin( ( 360 - i ) * 3.14 / 180 ), 2 );
tft.fillCircle( 80 + r * cos( ( 360 - i ) * 3.14 / 180 ), 128 + r * sin( ( 360 - i ) * 3.14 / 180 ), 2 , RED );
if (r < r2) {
tft.fillCircle( 80 + r * cos( ( 360 - i ) * 3.14 / 180 ), 128 + r * sin( ( 360 - i ) * 3.14 / 180 ), 2 , WHITE );
}
}
}
tft.background( BLACK );
}
uint16_t color565( uint8_t r, uint8_t g, uint8_t b )
{
return ( ( r & 0xF8 ) << 8 ) | ( ( g & 0xFC ) << 3 ) | ( b >> 3 );
}
Re: XRAD'S Electronic Designs
XRAD'S EYE OF AGAMOTTO!
Over the last few weeks, I have been busy frankencoding C++ w/arduino IDE using libraries for neopixels, HalloWingMO, and music maker feather for my take on the Eye of Agamotto. Hardware includes neopixels, adafruit music maker , adafruit Hallowing, add on amp, touch sensors, g sensor, lipo charger, speaker, 3D prints, etc.... I admit that the center 'eye' is not green like the infinity stone, but is an 'eye' none the less.
Here is near final product. Three black push buttons: left: color 'hold' - will set all pixels to current color and hold as long as pressed, and random sound. Center: one touch power I/O . Right: Fade last color and random sound. Four brass pins(on front cover) for cap sensors wired to A2-5 = four different pixel effects and random sound trigger. Shake for sound and rainbow. Light sensor functional for iris (which worked out well because the light sensor is shielded from the neopix by the EYE design, so it's not always contracted). 20 sci-fi MP3 files play randomly without hesitation(a few 'real' Agamotto sounds thrown in as well). 2 sounds on start-up w/special neopix pattern. 1000mAh Lipo and 1A charger. Some weathering washes....still a little bit to go. Have to finish weathering and make the strap. Will post a vid soon..... it's pretty cool in action.
Latest version of final code can be had here:
https://forums.adafruit.com/viewtopic.p ... 15#p705579
vid of unit in action:
https://www.youtube.com/watch?v=WZlPtyd ... e=youtu.be
Over the last few weeks, I have been busy frankencoding C++ w/arduino IDE using libraries for neopixels, HalloWingMO, and music maker feather for my take on the Eye of Agamotto. Hardware includes neopixels, adafruit music maker , adafruit Hallowing, add on amp, touch sensors, g sensor, lipo charger, speaker, 3D prints, etc.... I admit that the center 'eye' is not green like the infinity stone, but is an 'eye' none the less.
Here is near final product. Three black push buttons: left: color 'hold' - will set all pixels to current color and hold as long as pressed, and random sound. Center: one touch power I/O . Right: Fade last color and random sound. Four brass pins(on front cover) for cap sensors wired to A2-5 = four different pixel effects and random sound trigger. Shake for sound and rainbow. Light sensor functional for iris (which worked out well because the light sensor is shielded from the neopix by the EYE design, so it's not always contracted). 20 sci-fi MP3 files play randomly without hesitation(a few 'real' Agamotto sounds thrown in as well). 2 sounds on start-up w/special neopix pattern. 1000mAh Lipo and 1A charger. Some weathering washes....still a little bit to go. Have to finish weathering and make the strap. Will post a vid soon..... it's pretty cool in action.
Latest version of final code can be had here:
https://forums.adafruit.com/viewtopic.p ... 15#p705579
vid of unit in action:
https://www.youtube.com/watch?v=WZlPtyd ... e=youtu.be