PDuino and DigitalIn

Hi there,

I'm new to using Arduino together with PD. Basically I want to use Arduino to use some buttons to trigger PD messages.

This should be pretty easy to do but I get stuck when using the digital ins on the board. Here's my setup:

Windows, PD-extended v 0.40.3, Arduino Diecimila and Software v 0015

I compiled and uploaded the StandardFirmata example to have the Firmata Firmware on the board. Then, using the PDuino-help patch i tried to interface the buttons with my pins.

Actually it was pretty easy to read analog values from the analog ins. However - I never got the digital ins to work. (Of course I deactivated the digital outs and activated the digital ins - without any result). I of course tried various configurations here but it really seems, that the digital ins are dead...

What am I missing here?
Thanks for any help!

How are you wiring up to the digital input pins? Are you using pull up or pull down resistors? Most problems with reading digital input pins have to do with allowing the input pin to 'float'. Lots of examples on how to wire up switches in the reference and playground areas of this site.

Lefty

hi,

i used a pull-down resistor (resistor right before ground). but i'm pretty sure that random values are not the problem (as i said - connecting the same thing to the analog in works flawlessly).

the problem is, that i do not get any input to the digital pins at all (not even random).

Sorry, but I would need to see a drawing and the code to figure out what you are actually doing, words don't do it for me. :wink:

Digital inputs are not that hard to get going usually.

Lefty

here's what i do:

O +5V
|
o---o[button]o---o [digital pin]
|
o---o[button]o---o [digital pin]
|
|
Z
Z Resistor (10k)
Z
|
|
O Ground

i hope that's clear. i know that this is working because when i connect the button to an analog in instead of the digital in i can read out the high and low values in the PD help-patch. i also know, that my digital ins are working from other patches.

i really assume the problem has something to do with the pd-patch or the firmata firmware. do you use these without any other configuration?

thanks for your help so far.

As drawn that is not going to work for a digital input pin as when the switch is open the input pin sees nothing and will be floating. I also don't see how it can work for an analog input either as it will never see the o voltage, just float when not pushed. The switch should be in series with the +5vdc and one end of the resistor. Also each digital input will need it's own seperate pull down resistors. There is a simpler method of using the prgrammable pull ups for a digital input pin and then just wire the switch between the input pin and ground.

Lefty

As you've drawn it, that resistor is not functioning as a pull-up or a pull-down but is just wasting power. If you want to use external pull-down resistors (and not the internal pull-ups), then you'll need one 10k resistor per input.

check PD main window. i guess u get moocow any2string error messages, don't u?

if so, then here is what u do:
replace EVERY [moocow/any2string] object with [flatspace/any2string] objects. you can search these objects in the patch by using the menu->edit->find.

ps: your new friends live here:
http://puredata.hurleur.com/
:wink:

hi there,

thanks for your help - i got it working now using a pull-up as described. also the moocow objects had to be replaced with the flatspace versions.

what seems strange though is that i don't get any reading on pins 7 and 13. all the others work fine (i did not try pins 0 and 1 as i understood that they are used for serial communication). when using pin 13 the onboard led lightens up but that's it. might it be possible that i burned these two at some point (i don't have another board right now to compare this behaviour).

also i wonder if it is possible to activate the internal pull-ups in the firmata firmware so i can spare the external ones. i read the thread (http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1229849197) on doing this in the setup routine but did not dare to mess with the firmata firmware. what do you think - is that easily possible (or even intended)?

thanks again and good night!

did u already test pin 7 and 13 with a simple arduino sketch(digitalIn+Serial.print)? that would probably be the best way to answer your question.

i don't believe that you could activate the pull-ups in the firmata, since firmata is more like a communication patch for talking to other programs.
what you could try is to activate them with pduino. though, since you have to declare in- and outputs in PD for pduino, i guess that wouldn't work out.

also, (depending on what you want to do), soldering the pinups won't be that hard, since u can connect the buttons with each other and only have one +cable and -cable and the pincables going to the board/ or sth like that(i'm not exactly sure about now :slight_smile: )

but...if u find a workaround, please let us now. would be awesome!