Show Posts
Pages: [1] 2 3
1  Forum 2005-2010 (read only) / Troubleshooting / Re: Max/MSP - mutliple serial read on: July 15, 2006, 08:16:53 am
ok, after a long night.... i was looking for the wrong data on the processing side of my project, got it sorted in the end.

will.
2  Forum 2005-2010 (read only) / Troubleshooting / Re: Max/MSP - mutliple serial read on: July 14, 2006, 04:10:13 pm
Hi there,
anyone tried to do this with processing? Benoit has been helping out but I'm still not having that much luck.
I'm basically usingthis code (slightly altered ):

http://webzone.k3.mah.se/projects/arduino-workshop/projects/arduino_meets_processing/instructions/ultrasound.html

to read from two ultrasounds on pins 6 and 7 on the i/o.
I have tried formatting the messages as discussed above, i.e:

serialWrite ('A');
printInteger (sensor1);
serialWrite (10);
delay (20);
serialWrite ('B');
printInteger (sensor2);
... and so on.

I can see that the data from both sensors is getting through to processing, yet one is domminant, the other only appears in processing every 8th - 10th line.

any ideas or do you think this is this more of a processing question?

(i hope) this is the relevant processing code:

  if(serial!=10) {        
          buf += char(serial);          
          } else {
          //extract the value from the string 'buf'
          buf = buf.substring(1,buf.length());
          //cast the value to an integer
          value1 = int(buf);
          buf="";
      }

any help greatly appreciated.

will.
3  Forum 2005-2010 (read only) / Troubleshooting / Arduino and netcat on: April 04, 2006, 05:12:17 pm
hello.
i am trying to use my arduino boards with netcat, but i know nothing of tcp/ip or udp, i'm just taking a bunch of stabs in the dark really.
is there a local port number that the board uses? setting /dev/cu.usbserial-181, which is the method for specifiying where to listen in processing for instance, doesn't work in netcat.
any ideas??

will.
4  Forum 2005-2010 (read only) / Syntax & Programs / Re: Array? on: July 14, 2006, 02:20:22 pm
yeah, got it from the lovely arduino playground, just trying to get it to work for multiple sensors on one board. haven't quite got there yet though..... i'll let you know when it works.

will.
5  Forum 2005-2010 (read only) / Syntax & Programs / Re: Array? on: July 12, 2006, 01:46:58 pm
Hi Benoît,
A delay of that length will be no problem at all. I had thought that looping the routine and alternating the active pins might be a way around the problem but it was a little late to start working on that last night.
I'll try a few things out this evening.

cheers,

will schrimshaw.
6  Forum 2005-2010 (read only) / Syntax & Programs / Re: Array? on: July 11, 2006, 05:19:37 pm
Hi Benoît,

Thanks for digging that out, I'll give it a shot sometime this week. However....

Only just had time to sit down and start figuring out how I might do this (before reading your message).
I have been doubling up some code that worked with one sensor, the data I am getting back seems to be the combined value of the two sensors wired to digital pins 6 and 7, which I am guessing is something to do with this bit:

Code:
serialWrite('A'); // Example identifier for the sensor
printInteger(aultrasoundValue);
printInteger(bultrasoundValue);
serialWrite(10);

I was wondering how I might go about sepparating the streams being received on pins 6 and 7? sending some kind of array of the two values rather than their combined value.

all the code is pasted below incase you have time to take a look, I am sure there will be a million things wrong as I'm rather new to arduino.

cheers.

Code:
// Ultrasound Sensors

int aultraSoundSignal = 6; // US 1
int bultraSoundSignal = 7; // US 2
int aval = 0;
int bval = 0;
int aultrasoundValue = 0; //US1 Value
int bultrasoundValue = 0; //US2 Value
int atimecount = 0; // Echo counter
int btimecount = 0;
int ledPin = 13; // LED connected to digital pin 13

void setup() {
  beginSerial(9600);                  // Sets the baud rate to 9600
  pinMode(ledPin, OUTPUT);            // Sets the digital pin as output
}

void loop() {
 atimecount = 0;
 btimecount = 0;
 aval = 0;
 bval = 0;
 pinMode(aultraSoundSignal, OUTPUT); // Switch signalpin to output
 pinMode(bultraSoundSignal, OUTPUT);

/* Send low-high-low pulse to activate the trigger pulse of the sensor
 * -------------------------------------------------------------------
 */

digitalWrite(aultraSoundSignal, LOW); // Send low pulse
digitalWrite(bultraSoundSignal, LOW);
delayMicroseconds(2); // Wait for 2 microsecond
digitalWrite(aultraSoundSignal, HIGH); // Send high pulse
digitalWrite(bultraSoundSignal, HIGH);
delayMicroseconds(5); // Wait for 5 microseconds
digitalWrite(aultraSoundSignal, LOW); // Holdoff
digitalWrite(bultraSoundSignal, LOW);

/* Listening for echo pulse
 * -------------------------------------------------------------------
 */

pinMode(aultraSoundSignal, INPUT); // Switch signalpin to input
aval = digitalRead(aultraSoundSignal); // Append signal value to val
pinMode(bultraSoundSignal, INPUT); // Switch signalpin to input
bval = digitalRead(bultraSoundSignal);

while(aval == LOW) { // Loop until pin reads a high value
  aval = digitalRead(aultraSoundSignal);
  }

while(bval == LOW) { // Loop until pin reads a high value
  bval = digitalRead(bultraSoundSignal);
    
}

while(aval == HIGH) { // Loop until pin reads a high value
  aval = digitalRead(aultraSoundSignal);
  atimecount = atimecount +1;            // Count echo pulse time
  }
  while(bval == HIGH) { // Loop until pin reads a high value
  bval = digitalRead(bultraSoundSignal);
  btimecount = btimecount +1;            // Count echo pulse time
}

/* Writing out values to the serial port
 * -------------------------------------------------------------------
 */

aultrasoundValue = atimecount; // Append echo pulse time to ultrasoundValue
bultrasoundValue = btimecount;

serialWrite('A'); // Example identifier for the sensor
printInteger(aultrasoundValue);
printInteger(bultrasoundValue);
serialWrite(10);

/* Lite up LED if any value is passed by the echo pulse
 * -------------------------------------------------------------------
 */

if(atimecount+btimecount > 0){
  digitalWrite(ledPin, HIGH);
}

/* Delay of program
 * -------------------------------------------------------------------
 */

delay(100);
}
 
7  Forum 2005-2010 (read only) / Syntax & Programs / Array? on: July 08, 2006, 08:08:33 am
Hello,
Does the Arduino language cater for arrays?
i'm wanting to use three ultraound sensors with one of my i/o boards; is it possible to do something like this:

digitalWrite([1,2,3], LOW);
delayMicroseconds(2);
digitalWrite([1,2,3], HIGH);
delayMicroseconds(5);
digitalWrite([1,2,3], LOW);

(which is how i'd use an array in SuperCollider)

insead of declaring a variable and doing this:

int ultraSoundSignal = 7; // Ultrasound signal pin

digitalWrite(ultraSoundSignal, LOW);
delayMicroseconds(2);
digitalWrite(ultraSoundSignal, HIGH);
delayMicroseconds(5);
digitalWrite(ultraSoundSignal, LOW); // Holdoff

or is there some other way of using an array or list, or do I have to do the above for each pin I am using?

cheers,
will schrimshaw.
8  Forum 2005-2010 (read only) / Troubleshooting / Re: Can't install driver on Mac OS 10.4.5 on: April 01, 2006, 11:16:26 am
thanks for the link, very useful.
all i had to do was sort out the permissions, ownerships and so on.

cheers,
will.
9  Forum 2005-2010 (read only) / Troubleshooting / Re: Can't install driver on Mac OS 10.4.5 on: April 01, 2006, 06:46:32 am
hi there,
i am having a similar problem on my powerbook. the problem is, I am running 10.3.9 so can't use the intel friendly drivers. any ideas?
i've tried the drivers from the download site and those that come with the ide download (both version 2.0.1). i get the following message when I connect my board:

The system extension “/System/Library/Extensions/FTDIUSBSerialDriver.kext“ was installed improperly and cannot be used. Please try reinstalling it, or contact the product's vendor for an update.


cheers,
will.
10  Forum 2005-2010 (read only) / Troubleshooting / Re: sound trigger on: April 28, 2008, 04:13:28 am
Hi,
There's good information on microphone and amplifier circuits here:

http://itp.nyu.edu/physcomp/sensors/Reports/CondenserMicrophones

As for triggering things with sound, there is a schematic for a sound trigger circuit (built by Jeff Mann) available here:

http://www.interaccess.org/telekinetics/template.php?show=The_Talking_Fish_Circuit

I got something similar up and running just plugging the output from the amp circuit into the sound trigger circuit. Jeff seemed to think it might work without the amp circuit but I never tried it that way. You don;t actually need an arduino in this circuit, although I had originally run the amp circuit linked above into an arduino to calculate the amplitude which was then used as a trigger (there is inofrmation on how to do this in Physical Computing).. but it turned out to be a bit overkill.

If you just want on/off I imagine you would only need minor modifications, replacing the motor end of the trigger circuit with whatever your piston requires to trigger it.

hope that helps,

Will.
11  Forum 2005-2010 (read only) / Troubleshooting / Re: avrdude can't open input file on: January 31, 2008, 11:35:30 am
tried it with ATmegaBOOT.hex in the current directory with no luck, if by that you mean cd /Applications/arduino-0009/...directory with bootfile.hex the running the script..

I am using AVRISPmkII on osx, so I have to do it from command line no?
12  Forum 2005-2010 (read only) / Troubleshooting / avrdude can't open input file on: January 31, 2008, 06:22:35 am
Hello.
I'm having a go at uploading the bootloader to a new chip using AVRISP mkII and AVR Dude.
To get things set up I followed the instructions here: http://www.arduino.cc/playground/Code/OSXISPMKII
Everything worked out fine.
However,
when I try to burn the bootloader using the burn-bootloader-usb.command file
I get this error amongst avrdudes reports:

Reading | ################################################## | 100% 0.10s

avrdude: Device signature = 0x1e9307
avrdude: reading input file "ATmegaBOOT.hex"
avrdude: can't open input file ATmegaBOOT.hex: No such file or directory
avrdude: write to file 'ATmegaBOOT.hex' failed

avrdude: safemode: Fuses OK

avrdude done.  Thank you.


avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.10s

So it can't find the file, but I have ATmegaBOOT.hex installed in both /Applications/arduino-0009/bootloader-usb and /Applications/arduino-0009/bootloader-usb/bin as the latter location seems to be where burn-bootloader-usb.command file code, copied from web location above, is looking (CMD="$IPATH/bin/avrdude" )  

anyone know where it needs to go?

cheers.
13  Forum 2005-2010 (read only) / Development / Socket Size on: May 07, 2007, 10:56:30 am
Hello,

I'm gathering parts for a project which is built around a "standalone" ATmega8 programmed with the arduino virtual gizmo.
Can anyone tell me what size IC or DIL (what's the difference?) socket I need to use for this chip. I could measure it but I'd like to get it right before ordering and I'm not sure which part of the chip to measure for a socket.

cheers,

will.
14  Forum 2005-2010 (read only) / Interfacing / Re: Multiplexed Stepper Control on: October 06, 2008, 11:26:08 am
okay forget this, my brain is full of pine nuts.
This code does work, with two motors, it was just that I had forgotten that Q0 was on the right hand side of the 595...

Bone Head.
15  Forum 2005-2010 (read only) / Interfacing / Multiplexed Stepper Control on: October 06, 2008, 07:39:28 am
I'm trying to control a couple of steppers via a 74HC595 shift register and a ULN2004 transistor array. I'm currently testing the setup with a single stepper but want to attach between 5 and 8, which is reason for the multiplexing.

The result I'm currently getting is as if the steppers were wired up incorrectly, i.e. they seem to take one large step CW and then three smaller steps CCW. As far as I can tell, the wiring is correct, so for now I'm inclined to think it's a code problem.

Here is what I have so far. Any suggestions are greatly appreciated.

Code:
#define latchPin 8
#define clockPin 12
#define dataPin  11
#define ledPin 13
#define numOfSteps 100
#define rate 60
#define input 0
int amp  = 0;
int motorSpeed = 20;
byte dataArray[4];
byte data;


void setup() {
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);

// step orders:
  dataArray[0] = 0xAA; // 1010
  dataArray[1] = 0x66; // 0110
  dataArray[2] = 0x55; // 0101
  dataArray[3] = 0x99; // 1001

}

void loop() {

// do numOfSteps steps and then wait for a second:
for (int i = 0; i < numOfSteps; i++) {
  for (int j = 0; j < 4; j++) {
    


    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, dataArray[j]);
    digitalWrite(latchPin, HIGH);
    delay(200);
    

    }
  }
 delay(1000);
}
Pages: [1] 2 3