[PD] Arduino/Pduino/Accelerometer problem
Martin Peach
martin.peach at sympatico.ca
Mon Nov 2 00:12:52 CET 2009
It should work with the [comport] object.
You need on the Arduino to set analog 4 and 5 as digital outputs (I
think they are digital 17 & 18). Set the pin connected to the
accelerometer module's 5V pin HIGH and the Gnd pin LOW. That will
provide enough current for the accelerometer to work. Then you need to
do analogRead() on the three accel pins and split each value into two
bytes. Then send all six bytes via Serial.print(val, BYTE) commands.
In a Pd patch you need to reassemble each packet of six bytes into three
floats.
Obviously the baud rate must be the same at both ends but it can be very
fast, like 115200.
It might help to have the Arduino send samples only when requested by
the Pd patch, that way you can be sure of getting the six bytes into the
correct frame, otherwise it's not certain which is the first (unless you
add a header byte that is always the same).
I find it easier to do this without using the firmata or pduino stuff,
because it's an unusual implementation. If you want to use pduino, it's
better to connect your module power pins to the Arduino power pins and
just read analog 0 1 2.
Martin
Jose Luis Santorcuato wrote:
> Thanks, that is the regular connection, but not working... maybe the
> capacitor... in the past i worked with ir, potentiometer, bottoms, all
> the sensors, but the acellerometer dont work in pd...very strange...
> When y program in Arduino all works fine.... how can i connect the
> serial to Pd?... with the same firmatas objetc?
>
> Thanks a lot, but the sensor not working in the habitual order.
>
> Somebody?
>
> Thanks a lot people
>
> Best regards
>
> Chile
>
> JOsé
> 2009/11/1 slimboyfatboyslim <slimboyfatboyslim at slimboyfatboyslim.org
> <mailto:slimboyfatboyslim at slimboyfatboyslim.org>>
>
> hi,
>
> Is there any specific reasons why you connect both GND and VCC to
> AIN of Arduino?
>
> The typical connection should be
>
> AXL (GND) -> Arduino (GND)
> AXL (VCC) -> Arduino (3V3) (check the datasheet if VCC = 1.8V-3.8V)
> AXL (X) -> Arduino (A0)
> AXL (Y) -> Arduino (A1)
> AXL (Z) -> Arduino (A2)
>
> enable analog in in firmata, then should give you some readings,
>
> use a small capacitor across XYZ and arduino to avoid noise
>
> On Nov 1, 2009, at 12:26 AM, Jose Luis Santorcuato wrote:
>
>>
>> Dear friends, I'm working on connecting to the pduino arduino with
>> a three-axis accelerometer (sparkfun), when I program from the
>> arduino ide I connect the three axis, gnd and voltage directly to
>> the five analogs ins and from the console terminal reads well,
>> what would be the possibility of connection to incorporate the
>> sensor into pduino?.
>>
>> The connection I make in the arduino ide bd begins with 9600, but
>> the firmata works to 57,600 bd.
>>
>> How do the circuit?, or does it need to be rewritten from the
>> firmata?.
>>
>> I send the picture of Igoe conecction and works fine (in arduino ide).
>>
>>
>> Best regards
>>
>>
>> José Chile
>>
>>
>>
>> --
>> http://www.chilemigra.cl
>> http://arselectronicachile.blogspot.com
>> http://www.myspace.com/santorcuato
>>
>>
>> <ArduinoADXL322.jpg>_______________________________________________
>> Pd-list at iem.at <mailto:Pd-list at iem.at> mailing list
>> UNSUBSCRIBE and account-management ->
>> http://lists.puredata.info/listinfo/pd-list
>
>
>
>
> --
> http://www.chilemigra.cl
> http://arselectronicachile.blogspot.com
> http://www.myspace.com/santorcuato
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Pd-list at iem.at mailing list
> UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
More information about the Pd-list
mailing list