I have access to a 50 Watt laser cutter. So I acquired some old bar coasters. I had some fun. I used mat settings.
Yea literally an old bar coaster. I formed tabs so that it goes together quite tightly. I created the thing in Inkscape saved as .pdf. It was pretty fun actually. I think it would be cool with some led lighting inside and such. Perhaps I'll get to it sometime. Here is the file.
Monday, September 24, 2012
Friday, February 3, 2012
PD sketch controlling a servo
I’ve got a tiny 9g servo from sparkfun, and decided to control this with
a PD patch. There are some things you need to know about this
patch/sketch. First off keep in mind that your arduino programmer, and
your patch can not control the same comport. Also (on win7) I’ve
occasionally had problems with one or the other refusing to release the
com port resulting in having to restart both programs (I blame PD,
sometimes it doesn’t like to let me switch GPU’s after it closes
either.) Another interesting quirk deals with types of Data. As we
learned Pd puts out x values in terms of 0-1 (in the case of this
patch) so what I did (blatantly so there wasn’t any magic in my patch)
was to multiply by 100, then modulus 100 to give me an integer. I don’t
know about the Arduino specifically, but I avoid floats with
uproccessors in general. Bad juju for a beginner IMHO. Then out to the
comport. There may be a more elegant solution for the comport selection
process, but I simply used device manager to find out what comport my
arduino was on, (you need to know to program it anyway which is
annoying) then simply put that as the argument for the patch. on the
arduino side, you have to start serial communications, then read that
value into some variable. It seems like I did a little magic in the
sketch, but not really the map function is an awesome function to use (I
found it when I was outputting sounds through the arduino) and the
servo library is a huge help in something like this. For the sketch I
modified the examples->servo->knob. I just replaced the
potentiometer bit with the incoming serial values.
and the sketch...
/*
So this sketch will control a servo from data sent from PD
if I keep this up I'm likely to find my self halfway to jupider arguing with my spaceship as to whether or not it will let me back in.
*/
#include
Servo myservo;
int val;
void setup() {
// initialize serial comms
Serial.begin(9600);
myservo.attach(9); //Servo is going to be controlled on pin 9
}
void loop() {
if (Serial.available()){//check to see if something is coming in
val = map(Serial.read(),0,99,0,179);//this maps the in comeing value to a value that the arduino can send to a servo.
}
myservo.write(val); // this 'writes' the value to the servo
delay(15); // servos don't work instantaniously.
}//abandon all hope ye who enter here....
Monday, January 23, 2012
PD VS ARDUINO... FIGHT!!!
While they duke it out for control of Com 8, Let me explain.
I'm in a class, and one of the things we are learning is Pure Data. In reality you have to just play with it awhile to understand what it really is. For now let's say its a way to patch functions and variables together.
So I have an Arduino, and I want to control it with the touch screen interface on my laptop.. I think we all know where this is going...
I was successful too. I've got a very good starting point to go further with whatever it is I want to do. Which is good, because I'm building an original electronic instrument and I have to perform with it in May.
we shall see....
I'm in a class, and one of the things we are learning is Pure Data. In reality you have to just play with it awhile to understand what it really is. For now let's say its a way to patch functions and variables together.
So I have an Arduino, and I want to control it with the touch screen interface on my laptop.. I think we all know where this is going...
I was successful too. I've got a very good starting point to go further with whatever it is I want to do. Which is good, because I'm building an original electronic instrument and I have to perform with it in May.
we shall see....
Saturday, January 21, 2012
stand off pegs for the Mega
SOOO I'm always real paranoid about the little nipple things (can I say nipple in a blog?) on the bottom of a board grounding out on something bla bla... I thought about covering the bottom in a layer of hot glue, and decided against it. I saw some standoff screws at RadioSmack though and thought that was a good idea. It almost was! I'm SO glad I didn't get metal ones. The nipples on the PWM/Communication side are TOO CLOSE TO THE HOLES. So I did some artful dremmel work. (on the standoffs not the arduino) and beveled the standoff just enough so it fits snug. I am quite pleased with myself. All the other nerds are going to be jealous... I've an Arduino Mega... with standoffs...
The Altoids tin
I ordered some parts from Mouser, and picked up some from Radio Shack. The wife asked what I was up to which came with the usual... Nuthin... She knows better. I saw this link on one of my Favorite Websites I saw what he had done, but I thought with a few changes I might be able to do a bit better. I decided that instead of a normal open switch that you have to set it off to disable the alarm, I would instead use a reed switch. This would allow me to open it up to get one out, while palming the magnet, then hand it to the intended victim (let's say, my wife) and it goes off when she opens it up.
So the whole thing runs off a 555 timer. Here are a pair of them. I bought the stuff for two so that I could make two (and sell one) I also picked up a smaller speaker. UNFORTUNATELY the 1N914s I picked up were surface mount, and I didn't actually order a reed switch, just the magnet. Well I'll have to use the magnet anyway, I picked up some through hole diodes (and a PCB) at Radio Slack and began the process of bread-boarding. I wanted to breadboard it so that I knew that it would work before spending time soldering it. That makes sense. I would love to say that it went together smoothly... Alas it did not. It got pushed aside, and forgotten. Over time parts got moved, project got set aside, picked back up, put back down... I finally (after the tardis light even) got back around to working with this. I soldered it all onto a protoboard and it didn't work. I poked, prodded, cussed, stamped my feet, left it, came back, and gave up.
I gave up hope for real and set about to desoldering all the components. By the time that was all done I had decided to 'dead bug' it. For the rest of the world, that is an artful composition of components, harmoniously placed together... for me it's two vodka and cokes, a hot soldering iron and a ton of hot glue.
it worked
Most bizarre thing I've seen, but it worked. I've shown it around had a few laughs with it, surprised a few people, and played a tune that was exactly like the Dr Who theme doesn't sound like. I didn't post a pic, because really... its a 9v battery lead going into a giant blob of hot glue wired to a speaker... I doubt the TSA would let me through with it...
Arduino Mega
Love shipments from Sparkfun! |
Parallax PIR Sensor (the dome thing) |
Arduino controlled LED driven by a PIR |
Serial out from the Arduino showing data |
/*
* Motion sensing
*Started with an intro to the paralax motion sensor by Kristian Gohlke http://www.arduino.cc/playground/Code/PIRsense
*
*Then added my own stuff.
*in this case reading in a photosensor data
*
*/
//Datasheet wants 10-60sec to calibrate I don't have 60sec... I'll give it 30.
int calibrationTime = 30;
//the time when the sensor outputs a low impulse
long unsigned int lowIn;
//the amount of milliseconds the sensor has to be low
//before we assume all motion has stopped.. otherwise it shoots data every 5 sec.
// I considered increasing this actually.
long unsigned int pause = 5000;
boolean lockLow = true;
boolean takeLowTime;
//pin variables, Keep in mind I'm using an arduino mega 2560 R3
// so if you are wanting to change pins around this is the place to do it.
int pirPin = 30; //the digital pin connected to the PIR sensor's output
int ledPin = 31; // the LED pin
int phopin = 32; // the Pin for the Photo resistor
//setup like a falling pin
void setup(){
Serial.begin(9600);
pinMode(pirPin, INPUT);
pinMode(ledPin, OUTPUT);
pinMode(phopin, INPUT);
digitalWrite(pirPin, LOW); //this looks weird I'm sure. This means low means 0
digitalWrite(phopin, LOW); // and high means 1 I think...
//give the sensor some time to calibrate
//according to Parallax it has to get used to the environment
//I prefer to think of it as arming the system :)
Serial.println("Freeze... Don't move a muscle");
for(int i = 0; i < calibrationTime; i++){
Serial.println("tick");//it's important to see the difference between Serial.println and Serial.print the former
delay(1000); //prints then creats a newline, the latter, just prints.
}
Serial.println(" -BING!!"); //do not put three ! in a row... it's some sort of weird command...
//tells the bootloader you want a menu, and causes it to hang up when uploading
//you'll tear your hair out till you find this ~> //http://arduino.cc/forum/index.php/topic,52254.0.html
Serial.println("SENSOR ARMED"); // a little bit of nonsense now and then is relished by
delay(50); //the wisest men.
}
//loop di loop
void loop(){
if(digitalRead(pirPin) == HIGH){
digitalWrite(ledPin, HIGH); //the led visualizes the sensors output pin state
if(lockLow){
//makes sure we wait for a transition to LOW before any further output is made:
lockLow = false; //serial wibble wabble to show it's doing something
Serial.println("---");
Serial.print("I see you at ~ ");
Serial.print(millis()/1000);
Serial.println(" sec~");
Serial.println("ambiant light value is ");
Serial.println(analogRead(phopin));//write the value of the photoresistor to the serial monitor.
delay(50);
}
takeLowTime = true;
}
if(digitalRead(pirPin) == LOW){
digitalWrite(ledPin, LOW); //the led visualizes the sensors output pin state
if(takeLowTime){
lowIn = millis(); //save the time of the transition from high to LOW
takeLowTime = false; //make sure this is only done at the start of a LOW phase
}
//if the sensor is low for more than the given pause,
//we assume that no more motion is going to happen
if(!lockLow && millis() - lowIn > pause){
//makes sure this block of code is only executed again after
//a new motion sequence has been detected
//and a snarky comment is made
lockLow = true;
Serial.print("I think you left at ~ "); //output
Serial.print((millis() - pause)/1000);
Serial.println(" sec~");
delay(50);
}
}
}//abandon all hope ye who enter here.
Current Circuit configuration |
Subscribe to:
Posts (Atom)