Has anyone used the Adafruit MPR121 Touch Sensor Breakout with the Propeller?
Jim_Arlow
Posts: 37
in Propeller 1
Hi All,
Has anyone got any code to drive the Adafruit MPR121 Touch Sensor Breakout? It is an I2C device.
Thanks!
Jim
Has anyone got any code to drive the Adafruit MPR121 Touch Sensor Breakout? It is an I2C device.
Thanks!
Jim
Comments
There are other I2C interfaces in the OBEX. This one is pretty straightforward to use.
FAIR WARNING: the attached code compiles but I haven't tested it as I don't have the board.
Looking through it again I found a copy-and-paste gotcha. The rd_reg8() method should use i2c#NAK instead of i2c#ACK in the read line -- like this:
I will order one of those boards so that I can test the code. Once I've done that I will upload the final object/demo to ObEx. In the meantime, do let me know if you have any troubles or suggestions.
Since the MPR121 is I2C you could use a couple MCP23017s (also I2C) to monitor your buttons -- assuming, of course, that they are simple closures and not velocity sensitive. Depending on scan rate you might want to switch to a PASM I2C interface. If you decided to do that, let me know. I would have to update (well, create a secondary version of) my MPR121 and MCP23017 objects to use an external I2C object so that you're only consuming one cog and not creating issues with collisions.
I hope you'll post the project when you get it working.
Yes, the buttons are just simple closures, so I could use MCP23017s. I'll consider it in the future. The thing is I am trying to keep latency down to a minimum so I want one core monitoring the strings and a different one monitoring the keyboard. The interface between the ATMega328p keyboard scanner and the Uno is 5 bit parallel and one interrupt, so that will be fast. All the chord keyboard does is output a binary number that corresponds to a specific chord.
In fact, I should do some investigation, because I know that latency can be a serious problem but I don't really know the extent of the problem, or where the latency is. It seems to be that if the Uno tries to do much else apart from scan the strings using the MPR121, and send some MIDI, everything gets too unresponsive. Throwing another ATMega328p at the problem is a lazy solution, but it will work.
Actually, I just got my chord keyboard PCBs this morning, so I'll be able to see how it works with the ATMega328p shortly.
EFX-TEK HC-8+ - I took a look at your site - you've got some good looking stuff there.
You would launch this method into its own cog with: Since this is in Spin and you have control of the design, it uses contigous groups for the rows and columns -- this helps keep the code efficient. The scan code is unrolled to help it be as fast as possible, too.
Fair warning: I've only been up for about an hour am just on one cup of coffee!
Again, this sounds like such a fun project -- I'm looking forward to seeing (and hearing) the end result.
With regards to seeing the end result, I have an article in the next edition of Nuts & Volts on a MIDI Lyre, which is the basis of the MIDI Autoharp. I'm planning on 2 versions of the MIDI Autoharp. An Arduino version, that will be an add-on to the MIDI Lyre - this will be published in Nuts & Volts also, and a Propeller version. I can post the Propeller version here. With regards to how it sounds, the main thing design point is that it is a very responsive instrument. So you can stum the strings quite rapidly. This is why I am keeping the string scanning loop as tight as possible.
This sounds like a pretty cool project! I'm a MIDI guy from the 80's. Look forward to N&V articles.
Jon, Did you get one of the new Alexsis Wireless Keyboards?
http://www.alesis.com/products/view2/vortex-wireless-2
I put one on my cart to play with. I sold all of my Rolands and Casios a few years back. Still kept my Moog Liberation, but that's not MIDI.
-- https://www.amazon.com/gp/product/B003RS19XE/ref=oh_aui_detailpage_o04_s00?ie=UTF8&th=1
This was recommended by my friend Ryan Clarke (for a dirt-cheap MIDI controller). I wanted a standard MIDI out port which is really hard to find on budget instruments.
Ryan has a neat channel on Twitch that concerns itself with electronics and electronic music.
-- https://www.twitch.tv/1o57_curiouscodes/videos/all
WOW! That is cheap for a MIDI!
I got an ebay clone of a retired Sparkfun MPR121 touchpad - this has the chip conveniently set up on a board with a touch keypad:
https://www.sparkfun.com/products/retired/10250
And tried it out with Jon's code. It worked the first time!