MUFF WIGGLER Forum Index
 FAQ & Terms of UseFAQ & Terms Of Use   Wiggler RadioMW Radio   Muff Wiggler TwitterTwitter   Support the site @ PatreonPatreon 
 SearchSearch   RegisterSign up   Log inLog in 
WIGGLING 'LITE' IN GUEST MODE

Maxuino & bee....is it possible?
MUFF WIGGLER Forum Index -> nw2s  
Author Maxuino & bee....is it possible?
djthopa
Hi Scott!

I been getting into max recently and was wondering if Maxuino could be used with the Bee. I think i have read is compatible with Arduino duet, and there is even a max for live device too smile

http://www.maxuino.org/

It would be great to make sequencers on max and use the bee to interface with the Eurorack,

But i dont know of those patches could be stored on the be,(maybe on the sd???) so it would always have to be connected to the computer trough usb.

Would love to hear!

Thanks Scott!
scottwilson
That's kinda cool. If it works on the due, then getting it working on the 'b would probably only take some code tweaks to support the DAC outputs instead of PWM for "analog" support.

Another option I was considering which would leave max running on the computer but support the 'b as an output device was a tweak of SerialOSC to support OSC commands in the 'b. I'm just not much of a Max user, so I haven't had the opportunity to hack much with that.

s
djthopa
Hi Scott!
i have managed to get the bee talking to max with maxuino and firmdata, I have managed to se all the analog imputs, digital outs etc, but im going crazy trying to access the 16 analog outs, the ones with the blue leds,
i have checked the docs and I have seen the addition of the adafruit board, and on the pdf it says I can be used as servos,
any idea how could I access this outs, I'm gong crazy trying servo settnga,pwm etc in max,
hope you or someone can help me out, got lots of ideas for the bee and max!!!!!!
djthopa
Also, ther is no mention of the analog aouts on the pinout file.....
What pins are used for the analog outs? hmmm.....
scottwilson
(sorry - was't watching the thread)

The DACs are Microchip MCP4822 attached via SPI. The API uses a C++ class so that the outputs can be stateful. The Adafruit board is only used to control the LEDs and nothing else.

When you use the outputCV() or outputRaw() method, it sets the DAC value as well as the LED value. Take a look at testAnalogOutputs.ino for a fairly simple example of how to initialize and use an analog output.

(for 1.1+ I'm moving to a more static allocation of the interface values which will make this a little simpler, but that's an in-progress migration that may wait until 1.2...)

Hope that helps - glad to hear that it's at least working easily with the native IO... Would be cool to see it working with peripherals too!

-s
scottwilson
I'm about to head to see family for a few days, so cloning the maxuino git repo and will take a look.

Quick question - did you need to do anything in particular to get it running on the Due, or was it straight forward?

I don't have Max, so won't be able to test too much, but can at least see what it will take to add hardware support for the MCP4822.

EDIT:

I see... maxuino is only the max patches... It talks to an arduino that's running Firmata. So looking at that now.

Also, there is a python client which will do just fine. The question is if I can hook into the existing analogWrite() method to avoid having to have custom client updates to support the 'b... Maybe. maybe not.

s
djthopa
Hi Scott!

Thanks for the reply.

Its all explanied here: http://www.maxuino.org/video

Basically you have to upload the firmata sketch to the bee with arduino.

Open the maxuino.help.maxpat.

Choose the right pinmode and pins and you can have different communications with the bee.

The only ones i could not get to work wwhere the analog outs.

Please let me know if you run into any problems.

In the maxfile, choose the board, snd on the right of the patch you open the pin mode. So choose punmode (digital out, analogin, etc) then choose the corresponding pin.

Go back to the main patch and depending on what pinmode you have chosen you chose what subpatch to use.

Inside that subpatch you have to enter the same number of pin you entered on thr pinmode subpatch.

I found out pins 22-37 are the digital out.

40-45 are the leds of the beat clock

46-53 are the digital inputs

54-65 are the analog in

As i said what i cannot figure out is how to access the 16 analogouts.

I have managed to control the 16 analog outs lights with An arduino test patch for the adafruit 16 servo.

Please let me know if i can help with anything.

Cheers!!!
scottwilson
So the complication is that the DACs are attached via SPI rather than through individual pins like the ones that you've discovered.

While there is an SPI library in development for firmata that I saw, there are two issues with going with that approach. The first issue is that it would be incredibly inefficient to abstract the raw SPI protocol over a virtualized serial MIDI connection. The second issue is that it would take quite a bit of work for the clients to implement the hardware drivers which probably is best not to live at that layer.

My preferred approach would be to implement a set of custom sysex commands that abstract most of the capabilities of the module. While this will be the most efficient, it would still require just a bit of development which can happen eventually, but would require me to have max and update the max code...

So, the quick and dirty solution would be to update the StandardFirmata code to have a custom analogWriteCallback handler. My proposal would be to use some fake pins (101 - 116 for analog outputs 1 - 16) and customize the handler to write CV values to the DACs for the channel that corresponds to the fake pin...

That would at least get you running. I can't test it until I get back to town, but in theory, that's the way to go. You'd have to hardcode whether or not you have a +/-5V or +/- 10V version.

Here's what I'd change...

Code:

void analogWriteCallback (byte pin, int value)
{
   if (pin < TOTAL_PINS)
   {
      switch (pinConfig[pin])
      {
      case PIN_MODE_SERVO:
         if (IS_PIN_DIGITAL (pin))
            servos[servoPinMap[pin]].write (value);
         pinState[pin] = value;
         break;
      case PIN_MODE_PWM:
         if (IS_PIN_PWM (pin))
            analogWrite (PIN_TO_PWM (pin), value);
         pinState[pin] = value;
         break;
      }
   }
}


To some pseudo code like...

Code:

void analogWriteCallback (byte pin, int value)
{
   if ((pin > 100) && (pin < 117))
   {
      analogOuts[pin - 101].outputCV(value);
   }
}


I'll let you know when I check it in to github...

s
djthopa
hey Scott, thanks so much for taking the time to work on this.
Im out of town too ( no bee at hand) so hopefully wheni get back i can test this code out.

Just thnking it would be great to have the bees in / outs available frm max to create sequencers, sample players, etc.

Thanks for your work and merry xmass.

T
MUFF WIGGLER Forum Index -> nw2s  
Page 1 of 1
Powered by phpBB © phpBB Group