It's some time now that I'm dealing with these issues and I've got to some point where I can share things. I've put some things together on my website, most of it is dealing with Pd and Arduino with shift registers and multiplexers. Feel free to download and share.
http://drymonitis.me/code/
-
Arduino with shift registers and/or multiplexers
-
Did you mean ..
for (int i = theFirstPinOfNonMultiplexedInputs; i < NUMBER_OF_PINS_I_USE; i++)..?
And where should I determine how many bytes to transfer?Can I wire the other 4 digital pins anywhere, or should be same row on breadboard?
Still not clear with the pd patch.. Where to insert this part and how should I modify to get the right number atoms (for outlets)? If I set the number of chips to one, I see only 8 number atoms blinking..
Your help is already great, I am gratefull ! Trying to solve it, but running out of time, and my place still a mess of cables..
-
Yes, sorry, I meant NUMBER_OF_PINS_YOU_USE, made a mistake there. the bytes to be transferred are number of analog sensors (or potentiometers) times 2, plus 1. The very first byte is set in the beginning of the loop like this:
myArray[0] = 0xc0;
which is hexadecimal 192 and denotes the beginning of the data stream in the Pd patch (the [sel 192] connected to [comport]).
So the total of bytes you have to unpack is the number of sensors times 2.
About where to wire the extra sensors doesn't really matter, as long as they're wired properly (check the examples in Arduino's website if in doubt).
The extra code should go after the last curly bracket of the for loop that controls the multiplexer (if you place the cursor on the outer side of the curly bracket, the corresponding curly bracket - the opening curly bracket - will be highlighted.
Post the code you're using to see if I can help you more. To be honest I have to correct a couple of stuff in the code and patch I've uploaded in github. -
oh sorry , I meant the 4 digital pin for the second multiplexer's S0, S1, S2, S3. Not sure where to wire them.
I am using your uploaded pd patch from github. But I get only 8 blinking number atoms for one multiplexer ( CD74HC4067 16 chanel). Could you modify them for outputing 2 x 16 sensors?
I like to replace the pduino subpatch of my project. This is for my final presentaion at the uni, for a sound installation. Might not the most elagant solutions, but works so far. it controls panels, wich hold piezo sensors (Input) plus speakers(output). Some code snipets might be usufull for someone, commented already in english for further sharing (if it gets ready one day) -
You can't use pduino with the code I've uploaded on github. You'll have to use the Pd patch I've included there (I've updated it to a more correct version).
Try using the sketch in combination with the patch as is, with one multiplexer and see if you get what you want. -
I am still getting only 8 of the number atoms working (for one chip). I have set the number of chips to one, both at multiplexers.ino and multiplexers.pd ....
-
that's strange. you're sure you follow the wiring directions in the Arduino sketch? If for example you miss the connection from Arduino pin D5 to the multiplexer's pin S3, then the multiplexer will never go through the last eight analog pins, leaving you with data coming in only from eight pins (I've just corrected this specific direction if the code uploaded in github).
Can you upload a photo of your circuit? -
this photo is really not beneficial but the wiring is triple checked, its all right. Is it working at your side? On the photo its plugged out..
Its also strange that if I set the number of chips to 2 in PD, it activates 16 number atoms. But for only one 16 chanel chip I get only 8... -
What photo? There's nothing attached.
The number atom that sets the number of chips in the Pd patch, is connected to a- . From what you tell me it looks like it's connected to a
- instead, that's why you get 8 inputs with one chip and 16 with two.
Can you check that? Are you sure you're using the patch as is from github?
It does work for me.
-
sorry I failed somehow to upload the photo. Here is what I use, almost nothing is changed, two message box added.
Must be a trivial thing, but I dont understand the whole sketch and the whole patch.
Thank you for all your struggle.. I presume something around the 10bit conversion, but only cuz my mind is weak for this part (yet). -
The patch looks fine. Can you send me the exact Arduino sketch you're using (I know you downloaded it from my github, but you've might change some stuff)?
-
Not much change here..
-
That's very strange. The Arduino code looks fine too. I really can't tell what the problem is, I'm sorry.