Posts Tagged ‘Arduino’

Yet another electronics idea…

November 10, 2016

Sitting in my (ever growing) box of unstarted projects are a couple of Arduino blue tooth transmitters/receivers. It occurred to me the other day that I could integrate a receiver into my beat Buddy midi controller (the Hackman) and put the other one as a transmitter up on the keytar near where my thumb sits. I could hook up a couple of switches to the transmitter on the keytar so that I could get the BeatBuddy to play fills and transitions by pressing the buttons on the keytar instead of having to look down and do a tap dance all the time.

Taking that a step further, I could do something similar and make it drive ‘simulated’ switches for my loop pedal to make it step up and down through tracks as well as stop. This would make live playing over pre recorded tracks a lot easier as no need to look down to tap the correct switch (For complex songs I break them into multiple parts and prerecord the backing tracks into the loop pedal).

In fact, I could create a dedicated blue tooth receiver for my pedal board and then have that send signals to the Hackman and loop pedal. That would mean that I would not have to stand right next to my pedal board to work the loop pedal or BeatBuddy.

Mmmmm.Might be onto something here.

I love it when…

August 9, 2016

You sit down to write some code and find that you did it a couple of weeks ago. That change log in my code finally came in useful!

Oohhh… Pretty flashing Lights…

July 31, 2016

While I was working on the MIDI input code I decided to add a couple of ‘status lights’ to the display to indicate MIDI activity on the two inputs. It was as much about just seeing how well it would work as being anything useful since I know the hardware works already.

Anyway, here’s what I have so far:

StatusLights

Notice the cool vertical captions on the screen as well. Extra effort just to do that. Does it make any difference? Probably not but it was a bit of fun just doing it and who knows, it might come in useful sometime.

MIDI Shield – Works…

July 28, 2016

Whoo Hoo! Did a quick test, just reading MIDI notes in on either input and echoing them to the MIDI out and it worked just fine.

Now the serious coding begins!

MIDI Shield – No smoke is good…

July 24, 2016

This is the completed Arduino Due MIDI Shield:

Due_Midi_Shield_Wired

It doesn’t look pretty but it is a prototype after all.

It sits between the Arduino MPU board and the LCD Interface board so I inserted it into the Arduino stack in the appropriate place:

Arduino_Due_Midi_LCD_Stack

Then hooked the power to see if it still worked….

Arduino_Due_Midi_LCD_Stack_2

So far it look OK as in everything that used to work (the LCD, the touch screen and SD card) still works so at least I have not broken anything. Of course I’ve not tested the actual MIDI shield yet but I figure that’s enough for one day.

More progress – MIDI interface…

July 21, 2016

After a LOT of research and trial and error I finally found an Arduino Due prototype shield by nkcelectronics that has the Ardiono pins broken out AND a good mix of pin spots and strips that I can use to build up a prototype MIDI interface board. It’s actually for an Arduino MEGA but the pin placement is the same for the important pins like power etc and all the rest are just i/o anyway so it works just fine with the Due.

One problem is that MIDI typically runs at 5v while the Arduino Due runs at 3.3v so unlike my earlier Arduino (UNO) MIDI projects that could just hook up directly to the Arduino Uno, this one requires voltage level shifting circuits as well.

This is my circuit for the MIDI in and out:

Midi1

This is the prototype board with the sockets, connectors and the TXB0104 board (Adafruit) in place:

Due_Midi_Shield_1.JPG

I added a small piece of Veroboard to the prototype board so that I could solder some of the components to it as the prototype board just has a lot of those through hole connections and strips make it so much easier to hook things up, even if I do have to solder to the top of board.

Progress…

June 15, 2016

Not much but it is progress….

DUE_LCD_rev_Next

I got a couple of buttons to appear on the screen and when you touch them it correctly registers the button that’s been touched and, for now anyway, just displays the button name on the screen.

The bolts on the right end of the LCD board are just to help support it at that end as it only has a connector on the left end so if bends badly in the connector when pressed without some sort of support.

I’m already at 12% of the available programming memory (around half a megabyte)!

Next step, add code to read the SD card. The Next/Prev buttons will let me scroll through the files on the SD card. Well, that’s the idea anyway.

 

Bad news, good news…

June 14, 2016

The bad news is that the Arduino library code that I am using for my latest project takes up so much space for variables that there’s bugger all left for my own data when I use the Uno. The good news is that the LCD screen I got for the Due has a touch interface so I don’t need to build a button shield for it, I can just use virtual buttons on the LCD for now. Eventually I’ll need ‘real’ switches but that’s a long way off.

 

Another Arduino project – The hardware..

June 12, 2016

So I’ve been busy accumulating hardware for my latest Arduino based project. I am using two different platforms. I am using an Arduino Uno with an SD card shield and an 16×2 LCD display initially because I can hook up the midi parts to it directly as I have done so in the past. The problem with it is that it does not have a lot of program memory and is very limited on data memory so while it’s a good platform to start experimenting with, it remains to be seen how far  can get using it. On the plus side, it does have on chip EEPROM so it is possible to save settings across power ups.

Part two of the project (or it may become the only part, who knows) will use an Arduino Due. The Due has a LOT more program and data memory and runs over five times faster than the Uno (84Mhz vs 16 Mhz). The down side is a) no EEPROM so that’s something I’d have to add externally and b) it’s a 3.3 volt device so no hooking up the MIDI directly to the Due pins like I can with the Uno. That means I’ll have to build some sort of Midi shield for it to buffer the voltages both in and out. I cannot even use anything comercial as I need a custom number of MIDI ports for my little project.

 

This is the UNO hardware stack so far:

UnoStack

All the Hardware is from Adafruit. The LCD display itslf comes pre assembled except for header pins. The Shield it is mounted to is a kit. I added the sockets that the chip is in myself since I don’t like soldering directly to IC chips, too easy to kill them with the heat!

Programming it was pretty easy as all the information you need, as well as a handy dandy library for the LCD and buttons is available via the Adafruit web site.

And this is the DUE stack:

DueStack.JPG

Can’t recall where I got the DUE from but the LCD and shields that that is mounted to are from eBay (vendor is coldtears). Came from Hong Kong, took about a week to get here so not too bad shipping wise. The LCD software uses a library from some guy on the web but it works very well and includes a demo. I did have to change a setting in the demo code to match the LCD screen (device type info) but the biggest problem I had was the Arduino IDE. Initially, it would not upload to the DUE and I was getting some errors during the compiles as well. Eventually I found that some functionality of the IDE to support the DUE that used to be included now has to be added separately. In addition there was a syntax error in one of the config files that was causing the warnings during the compile. Also the thrid party library I was using for the LCD had a .github directory in the library structure that should not have been there.

Once I tidied everything up though, the LCD part worked great.

Both the shield the LDC sits on and the LCD card itself have an SD card slot. The one on the shield is disabled by default so I chose to use the one on the LCD. It’s not very accessible but that’s not too much of a problem right now. The hardest part was figuring out what pin on the DUE corresponded to the Chip Select pin for the SD card reader. After unplugging things and following circuit board traces and digging around on the internet, I figured out it was pin 53. I changed the example SD card  program in the Arduino IDE and tried it and it worked just fine.

 

So now I’ve got two hardware stack basically up and running, albeit without the MIDI part yet. Time to start programming (and researching the MIDI hardware for the DUE)!

 

 

Another Arduino project…

June 2, 2016

Starting up another music related Arduino project. Initially I’ll be using the good old Uno but I’ll be switching a Due later because a) I happen to have one and b) I need the extra memory it has and the extra processing power will not be wasted either.

I’ve seen virtual instruments that do what I am trying but nothing that does it in hardware as a stand alone unit that you could put on a pedal board for example. It may end up going nowhere (my projects often do) but we shall see. The basic design is done so I’m collecting parts now.

The Beat Buddy Tempo Buddy…

May 11, 2016

Based on an idea someone posted in the Beat Buddy forums. A two button switch to step the tempo up and down (in steps of 5 BPM).

Basically, pressing the foot switches increases or decreases the tempo on the Beat Buddy up or down by five beats per minute. You could do a lot more with it but I am already controlling the tempo from my Jamman so this was just a interesting exercise.

Wiring diagram:

TempoBuddyWiring

Code:

/*************************************************************************************************
*                                                                                                *
*  Beat Buddy Tempo Buddy.                                                                       *
*                                                                                                *
**************************************************************************************************
*    Copyright David E Ellis (aka The Big E and ltlfrari) 5/11/2016                              *
*                                                                                                *
*    License:                                                                                    *
*    You are free to use or modify this code as you wish.                                        *
*    Acknowledgement is appreciated but nor required for any derivative works.                   *
*    In using this code in any manner, you hold the author harmless from any damages arising     *
*    from the use of this code or any code derived from it either directly or indirectly.        *
*                                                                                                *
**************************************************************************************************
* Change log                                                                                     *
*                                                                                                *
* V1  05/11/2016 Initial version                                                                 *
*                                                                                                *
*                                                                                                *
**************************************************************************************************/
 
 
#include <Bounce2.h>           // switch debounce code

#define SWITCH1 4              // left switch 
#define SWITCH2 5              // right switch
#define LED 10                 // green led

Bounce s1 = Bounce();            // setup debounce for switch 1  
Bounce s2 = Bounce();            // setup debounce for switch 2

void setup() {  
  pinMode(SWITCH1,INPUT_PULLUP);            // Open switch is normally pulled high
  pinMode(SWITCH2,INPUT_PULLUP);            // Open switch is normally pulled high
  pinMode(LED,OUTPUT); 
  Serial.begin(31250);                      // Set MIDI baud rate
  s1.attach(SWITCH1);                       // connect to switch 1
  s1.interval(10);                          // 10ms debounce time
  s2.attach(SWITCH2);                       // connect to switch 2
  s2.interval(10);                          // 10ms debounce time  
digitalWrite(LED,HIGH);                     // led on, ready  
  
}


void loop() {

  s1.update();                 // check switch
  if (s1.fell()) {             // if switch pressed (hi to low transition)
    tempoDown();  
  }

  s2.update();                 // check switch
  if (s2.fell()) {             // if switch pressed (hi to low transition)
    tempoUp();  
  }    
    
}

void tempoUp() {
  for (int i = 0; i < 5; i++) {
    Serial.write(0xB0);                    // CC, channel 1
    Serial.write(96);                      // 96 - inc tempo
    Serial.write(1);                       // inc by 5
  }
}

void tempoDown() {
  for (int i = 0; i < 5; i++) {
    Serial.write(0xB0);                    // CC, channel 1
    Serial.write(97);                      // 97 - decrement tempo
    Serial.write(1);                       // dec by 5
  }    
}


 

 

 

 

Hackman – one more mod (part 3)…

May 1, 2016

Got my double tap detection working. The timer code I use was acting a bit ‘weird’ but I found that increasing the timer time to two seconds seems to have cured most of the issues with it. Not sure why it was behaving strangely. I guess that’s the problem with using other people’s library routines, you never quite know what they are really doing. That is unless you want to spend a load of time figuring them out in which case you may as well just write your own. I might still do that, the timer library code has some strange behaviors that I’ve had to code around, always hate that.

Hackman – one more mod…

April 20, 2016

One last thing I want to do (for now anyway LOL). If I double tap the stop button on the Jamman to force an immediate stop vs the fade out I usually use, the Hackman treats the second tap as a start and sets the playing flag (and LED) to on. This is one way the Hackman status can get out of sync with the Jamman and why I have the ‘reset’ switch on it now.

So it seems to me I should be able to detect a double tap and ignore the second stop command if it occurs quickly enough after the first one, say within half a second.

Let the experimenting begin!

You’re not a real product…

April 13, 2016

Until you have a sticker…

HackmanSticker

 

Hacking the Jamman – Version 2…

April 8, 2016

So the Version 2 box is done. The main difference is that there’s only one switch now that is connected to the Arduino to reset the ‘playing’ flag if things get out of sync between what the Hackman thinks the Jamman is doing and what the Jamman actually is doing. I’ve not done the reset software yet though so the switch does nothing.

Enough chatter, some pictures…

Midi in and out:

HackmanBoxV2_1

Power socket and programming connector:

HackmanBoxV2_2

The guts of the beast (I always think it’s a shame that you have to hide the most interesting bit):

HackmanBoxV2_3

I tested it with the version one software and it works fine so it’s on the pedal board. I’ve got a gig tomorrow morning so it’ll be a chance to try the new setup out. I’ll take the old Hackman along just to use it as a switch box for the Beat Buddy since the switches are not connected to anything internally. Also, if this one fails for any reason, the guts are still inside the old Hackman so I can just swap them over. Since I’ve got spare boxes and switches, I may just build a new switch box and leave the old Hackman as a spare.

 

 

 

Hacking the Jamman – More rethinking…

April 7, 2016

Turns out that I can turn off the feature in the Beat Buddy that causes it to set a new tempo every time I change songs so now, as I scroll through songs the tempo remains at whatever I last set it to.

This means I don’t need to resend the tempo from the Hackman so the Hackman does not need to control song scrolling either.

So what I am going to do now is continue to make the new Hackman but just have a single push switch on it to reset the play flag and gut the old one as before, just leaving the switches and socket in it so that I can use it as an off board switch (that is easier to reach) to scroll through the Beat Buddy songs.

At last I think I have a plan (maybe LOL!)

 

 

Hacking the Jamman – Rethinking mods….

April 7, 2016

Well it turns out I cannot easily make the Hackman step though the songs in the Beat Buddy because there’s no midi function in the BB to let me do that. I can select specific folders and songs within folders but not simple step forwards and backwards through them.

I cannot really use the specific folder/song method because there’s no way for the Hackman to ‘know’ what folder/song the Beat Buddy is set to. I could set them to match manually but if I manually change the folder/song on the Beat Buddy, they would be out of step but then as soon as I changed the folder/song via the Hackman, it’s just to whatever the next folder/song the Hackman was set to. Overall, not an ideal user interface.

However I could still send the last known tempo which is the whole point of this (to avoid me having to do a tap dance on the Jamman after I change Beat Buddy tracks) so it might be still be worth it.

So I think that what I am going to do is to continue building the new Hackman and even still install two switches in it but Hooked up to the Arduino, so that I can at least still reset the internal ‘playing’ flag and hope that at some point in the future they add the midi function I need to the Beat Buddy. I’ll then remove the Arduino from the old Hackman and just use that as an external ‘off pedal board’ switch box to select drum tracks just like I do now, but being off pedal board will make it easier to get to since right now being at he back of the board, it’s not easy to reach.

 

Mounting Arduino Uno, part 2…

April 6, 2016

Holes cut in box end, Arduino mounted inside the box:

ArduinoMount4

ArduinoMount5

 

Mounting Arduino Uno

April 5, 2016

For my various projects I am currently using an Arduino Uno. In order to mount this inside the Hammond 1590BB look alike project boxes that I use I use the following ‘el cheapo’ method (hey, it works!):

I cut two piece of 1/8 hardboard to just a bit bigger than the Arduino Uno circuit board. They do not need all the fancy cutouts that the circuit board has, they can just be regular rectangles.

Then I use an old Arduino Uno as a template to drill three 1/8 inch holes in ONE of the boards. I don’t use the mounting hole nearest to the USB connector because it’s too close to the terminal block to get a screw in there.

I then lay that board over the other one, line them up and drill the same holes in the other board.

I then take the second board and re-drill the holes with a 1/4 inch drill. These holes will take the nuts that the screws go into.

I use #4-40 3/8 inch screws and nuts. The nuts are ‘just’ too big to go into the 1/4 inch holes in the board but a gentle whack with a hammer lodges them in there. One nut in each hole.

I then use some 5 minute epoxy to glue the two boards together and put screws through the holes and into the nuts just to keep them aligned.

 

Top of the board:

ArduinoMount1

Bottom with nuts ‘inserted’ (ignore the hole in the middle, that was just me testing the nut fit):

ArduinoMount2

What it looks like when done (no screws yet):

ArduinoMount3

I then cut suitable holes (lots of measuring, drilling and and filing) in the side of the project box using the mounted Arduino as a template. Once I am happy with the fit in the box, I epoxy the mounting board into the project box with the old Arduino fastened in place so that I know everything lines up and it’s where I want it to be.

One thing I did find is that the power socket on this old Arduino Uno that I use as template is set slightly further back than the power sockets on the latest ones I have (different manufacturer probably). So I have to ensure that the hole for the power socket in the project box is large enough and the correct shape to take the socket. Other than that’s it’s all pretty simple.

 

 

 

Hacking all sorts of stuff…

February 14, 2016

So while I am in ‘midi’ mode I decided to revisit the Lucina midi problem. If case you missed it, the Lucina seems to be sending midi ‘note on’ messages for all but the first note, instead of ‘note off’ messages when I release a chord. This only happens periodically but leads to stuck notes and other strange behaviors.

So I decided I’d write a little Arduino program to fix the issue. I was in the middle of that when I decided to ‘just try the Lucina’ with my rack synth. Actually I just felt like messing around and playing a little music.

But strangely I was not seeing, or rather hearing, the problem at all. Now based on recent experience with the cheap usb midi interface I was using it could well be that that was causing me to see crappy data (using Midi OX to view the midi data) so who knows. Maybe there’s a problem, maybe not.

So I pulled out the old FCB 1010 midi controller foot pedal and hooded that up into the system so I have some sort of volume control.

However I noticed flashing leds all over the place. Seems the Lucina sends ‘Active Sensing’ midi message all the time and these screw up the FCB 1010 so I may well end up creating an Arduino based midi box to filter those messages out since nothing uses them anyway. But if  I am doing that I may as well add the code to ‘fix’ the apparent stuck note problem since the box would be in the midi circuit anyway.

 

Oh, and I’ve decided to go with a Beat Buddy drum foot pedal to augment the loop pedal drums, I still need to sort out the Jamman sync timing but the BB seems to be well supported by an active user forum and unlike units made by large companies, the creator of the BB is a smaller outfit and seems to be very responsive to user requests and issues.