Saturday, 12 May 2018

Arduino Multiple USB MIDI IN MIDI DIN Out

This project began when in spirit when I started watching YouTube Videos on synthesizers. I have a Casio XW-G1 and was looking into that when I started to see some interesting music being made with the Korg Volca synths. Watching more videos, I was seeing some cool music being made by using their sync ports and then I noticed some people using the MIDI In.

The price point of these synths is great for getting further into the synth world and the various models is great for expanding functionality. Having seen different hardware such as MIDI Thru boxes and already having a audio/MIDI interface, I knew I could connect my USB MIDI keyboards to the PC and play all the Volcas at once. Granted, I had none at the time, but I started out by getting the Volca Keys. I was definitely intrigued.

 There were two problems that I had right away. The first, in my book was that a PC takes time to boot up, connect the audio/MIDI interface and any other accessories that I might want to use with my laptop. I suppose this is made worse by the fact that I have no permanent setup for making my music. The second problem is that I had no MIDI Thru box.

Once I started to investigate the process of making a MIDI device that would accept a USB MIDI keyboard and found ending up finding a very simple solution with the USB Host Shield, which I already had, I was a little disappointed that I did not build this sooner. It was one of the simpler projects to build on a breadboard and the code was already provided in the library for the USB Host Shield. Here is the schematic to the left. Save it and open it to get a better view.

Please do your own footwork to ensure any project you make will not burn out anything in your project. They way the MIDI protocol works with this particular setup is that current only flows when the Arduino pin used, D1 (TX) goes low. Wondering how that works with the MIDI protocol to produce a logic HIGH to the MIDI device? Sparkfun provides a good MIDI tutorial on the subject which I highly recommend you read, at least the first two pages, before you start the project. Another important point when building any stage of this project - prototyping on a breadboard or permanent, is to disconnect the Arduino TX pin from the 74HC14 IC before you upload the sketch. The Arduino still uses the TX pin for the uploading process.

In short (no pun intended), once I breadboarded it, I did some groundwork (no pun intended, again!) to make sure it would not burn anything out. Then I decided to build it. It took longer than I expected, mostly the cutting of holes in the dollar store jewellry box, and then recutting them to fit the new Arduino Uno instead of the Arduino Mega. The Uno's power jack was just a little higher than the Mega's. In the process, I mishandled the USB Host Shield with what was likely ESD and that had to be replaced. See below for the inside of the final version of this stage:

Materials needed:
Arduino Uno or Mega,
USB Host Shield,
powered USB hub,
MIDI DIN jacks,
74HC14 IC,
some resistors,
protoboard, jumper wires
and a box of some sort.

It has 5 MIDI DIN outs, at the moment is coded to accept 4 USB MIDI devices but can handle 7 with the current USB hub. I have not tested the capabilites using a MIDI keyboard such as the M-Audio Oxygen 49 which has some sliders and knobs to turn. I would like to have that working. One of the reasons I like this, aside from being able to play my Volcas with keyboards, is looks to be only a step away from making my own synth that I can play with a keyboard.
The basic code is found in the USB Host Shield Library 2.0 > USBH_MIDI > USB_MIDI_converter_multi sketch.

Simply copy the section that outputs the MIDI data, paste it, rename the new section so it differs from the old, add the prototyping up top and you have the code.

This project holds a lot of potential for the future. If you have already worked with microcontrollers, then you probably realize that once you can produce code to accept USB MIDI data and output it, you should be able to make that data do what you want. Making my own synth should be just one step away! Maybe two... three... wait a sec...

Feel free to comment below.

Let me know if you build it yourself and expand upon it. It is not like I made the code myself. Once you see the original code from the library you will see. I posted this project on Facebook and had a comment on HoodLoader so that is another possibility worth exploring.

Saturday, 17 March 2018

One More Step

Here is a post one of the Raspberry Pi User Group members put together on fixing their stairs. It goes to show what a little industriousness can do!

If you need to increase the size of the webpage you are reading:
Ctrl - + (as if talking out loud, that reads control, dash, plus and you press the control key and the plus key at the same time)
Ctrl + -
Revert to the default size:
Ctrl - 0
I decided it was time to redo my 100-year-old (literally) stairs. Replacing them was financially out of the picture. They had many coats of paint on them and removing the carpeting left lots of nail/staple holes, so stripping and refinishing was out. That left painting as the only viable option.

The balusters were finished with a very dark stain, including lots of runs and blobs. There were a lot of squeaks to be silenced, trim to be replaced, and a landing that had to be rebuilt. With the amount of work required, I decided it would be much easier to remove the balusters rather than work around them.

I didn't think to take a "before" picture, so this is a "during" picture, with the balusters and trim removed, handrail cleaned up, squeaks fixed, and some holes patched.

Further on, some painting done, more holes and dings patched.

Painting the balusters was still going to be a hassle, but I thought, "what if I could make something to turn them slowly while I just held the brush?" I decided to aim for 20 RPM, or one revolution in 3 seconds. The whole project had to consist of parts on hand and not be more work than it was worth for a one-off.

I didn't have any motors that I could easily make turn slowly enough. I did have a 24V cordless drill that still "drilled" fine, but its batteries wouldn't take a charge. Of course it would run *way* too fast at 24V. I wondered how it would run at a lower voltage and, if my experiment let the smoke out, it wouldn't really matter.

I only had one adjustable power supply with enough juice to drive the drill but it wouldn't adjust lower than 8 VDC. That was still too fast. Again, not wanting overkill for a one-off job, I played with available power resistors in the DC line until I found a combination that would drop enough voltage without burning up. That got me down to 30 RPM, or one revolution in 2 seconds. Close enough!

This is the end product, power supply not shown:

Of course balusters are all different lengths so the "head" of the unit slides on a piece of T-track to accommodate each baluster. Most of the baluster is painted in the jig, removed, situated to dry, and the top section painted.

Is it a slow lathe or a fast rotisserie? Who knows?

Balusters painted:

And finally:

Saturday, 17 February 2018

Pre-Meeting, February 17, 2018 - Arduino Shift Register Control of R-2R 8-bit DAC to Astable Multi-vibrator (1/2 556 Timer)

Hi Y'all!
We hope to see y'all tomorrow at the RPUG Meeting at the library. I have been working on getting a shift register to control the frequency played by an astable 555 timer. Two shift registers are connected to LEDs at this point so it is pretty close. I am building the astable multi-vibrator right now.
The idea is to test the breadboarded device with one shift register. That will give it 8 bits to work with: 5V / 255 = 19.6 mV per bit.
Once I get that running, I will expand the DAC to more than 8 bits, giving more resolution to the frequency. Blah, blah, blah, until you realize that with more bits, you get greater control over the tones you can play. One of the interesting possibilities of using shift registers to control R-2R DACs is that you control the bit resolution. You can pick and choose how many bits are used to control each device. A web search on R-2R DACs will give you the idea that I am talking about. I can take 4 bits from one shift register to add to the first shift register and then use the remaining 4 bits to control something else.
An Arduino Nano is the brains at the moment but it should work with any other Arduino, even a 3V one, such as an Arduino Due. A 3V signal still registers with 5V logic ICs as a high signal so all that stuff will work. Watch out trying to go the other way, sending 5V signals to a 3V device. Many 3V devices will be damaged by 5V signals.
See you tomorrow!

Look for the next post with schematics and equations for all that technical stuff.

Wednesday, 20 December 2017

Raspberry Pi User Group Meeting - November 19, 2017

We have a few core people who show to our meetings at the New Glasgow Library. This meeting was no different that way.

What was new was the free Stepped Tone Generator / APC kit we have to offer. The Stepped Tone Generator is actually a circuit taken from "Engineer's Mini Notebook, Vol.1 - Timer, Op Amp & Optoelectronic Circuits & Projects," by Forrest Mims III. APC or Atari Punk Console is the name that was given to the circuit by some electronics designer who made it their own. The circuit's sound is pretty lo-fi so imagine something that might come from an old 80's video game, thus the APC name. The circuit's central component is the 555 timer. I am writing another post with this circuit so you can also reference that post as well.

We built one of the kits that I had to make sure all the components worked and they did. I also had another circuit of the same that I had made before and had taken to the meeting. We tried to get it to work but found it did not. Well, ... time to troubleshoot.

Stepped Tone Generator / APC Schematic:


Anytime something does not work in your electronics projects is an opportunity to learn and to practice. Now, it had been sometime since I had to troubleshoot anything past something like a misplaced power supply lead to one of my circuits. It took a little time to figure out what was wrong. Even then, it was only after we had fixed the circuit had I realized what must have been wrong.

We started out checking all the wires to see if any were missing or misplaced. Then we started using the DMM (digital multi-meter). We swapped speakers and even IC's. While using the DMM it was seen that the voltage level on the middle lead one of the pots was not as it should be.

We are using the square blue trimpots for the kits because they are 1) more convenient to use in solderless breadboards and 2) they cost a lot less per item. To use a metal potentiometer would require at least leads soldered on to the lugs and then, if it were not mounted on something, it would hang free, useable but subject to disconnecting easily. Below are some examples of trimpots. Note that one is on its side and how that relates to the problem I found as described below.

The point is that little blue trimpots can look like they are correctly inserted into a solderless breadboard when they are not. Without really realizing what was wrong with the pot, it was removed, reinserted into an unused portion of the solderless breadboard and leads inserted into appropriate holes to allow DMM leads to take measurements. The pot was fine. It was reinserted into the circuit and presto, the circuit worked.

After the meeting, I realized that yes, the problem was with the potentiometer. It must have been inserted sideways so that two of the leads were connected and the third lead connected to the rest of the circuit to follow. However, the lead that was supposed to be connected to the power rail was not. So no power was supplied to the variable voltage divider found on the left side of the schematic.

Wednesday, 13 December 2017

A Beginner's Journey into DIY Synthesis

Hi. If you have found this blog, surprise! You have stumbled upon a pretty new blog on DIY synthesis, for music, not for another field of electronics such as Ham Radio.

My name is Bruce and I have been building occasional projects in electronics for a number of years. Lately, I would like to have a general focus on music. Music is another hobby of mine. I play guitars and have a Casio XW-G1 synthesizer. Patchblocks are another type of synthesizer that I have recently started exploring. The room to move with this platform is so great and not a bad way to learn about how synthesis modules are put together. Patchblocks software is free to try out. Just stick with learning the tutorials found in the IDE and you will make some interesting sounds. There are also a number of ready-to-go patches before you even learn how to program. Really cool stuff.

One thing I have found over the years is that after playing a musical instrument, I began appreciating other genres of music. Originally, I like rock, classic rock and alternative. Learning how to play harmonica (my first choice in musical instruments) and then guitar, really opened up my horizons. I started to listen to more country and folk music. I appreciate some electronic music, some bluegrass, a little more metal, more classical and some that I find hard to pin down.

To bring this rambling back to DIY synthesis, I will purport that one type or area of electronic synthesis is superior over another, at least not yet. I know that some synthesizers sound better than others and there are many that are classics. What is comes down to some of the time is that you buy, use, and make what you can afford. Budget it whatever way you like so if you really want to stick with only exploring analog circuits, save for a bit and buy what you need. I like to explore a lot of different areas of electronics so I have Arduino's, PIC IC's, Basic Stamp II's, LM324's, 555 and 556 Timer IC's, as well as a number of other components.

Books tend to be a great resource for me. I have some electronic engineering technician textbooks, some hobby electronics books that cover a wide range of topics and lots of other books. Programming languages are also great. I have experimented with C, Arduino C, C++, BASIC, and Python. Processing is another environment that I have dabbled in and think has great potential for me. Just look at the Processing Exhibition page and you see lots of different project ranging from physical interaction to data collection and representation.

In the blog entries to come, do not be surprised to see one area covered such as oscillators made from analog circuits and then others made from digital IC's. I hope to have some interested readers so drop a line if you like. Let me know what you think.

Sunday, 22 October 2017

Raspberry Pi User Group Meeting (RPUG) - October 15, 2017

Our last meeting at the New Glasgow Library was pretty low key. We are looking at putting together some workshops on basic and some not-so-basic topics.

I really want to make a simple project - a Four Op Amp Function Generator. Forrest Mims provides a schematic in his first Engineer's notebook. You can find all kinds of examples of schematics online. One of the nice things is that it can fit on a single solderless breadboard. There are even IC's that come in packages containing 4 op amps although any op amp should work. I plan on using an LM324. They are on order.

I have some other IC's of op amps, actually some NTE947's for which I used the pinout to redraw the schematic. One of the nice things of drawing schematics using IC's is that you can often just use the old schematic and change the pin numbers specified by the new IC. If you have ever tried to draw a schematic using the pinout of an IC, you will quickly realize that there is an art to the whole thing.

Look for a workshop coming soon.

... by the way, I am also taking a ham radio course with the local amateur radio club, Pictou County Amateur Radio Club.

Here is their link:
Pictou County Amateur Radio Club,

Saturday, 21 October 2017

ESP8266 / nodeMCU and DHT11

October 21, 2017

This will be a short post. This will have a date on it, I am sure. But, I am posting material that will likely become dated soon, so I want that in the text of the post as well.

The ESP8266 IC is a great boon to the electronics hobbyist. I have been using a nodeMCU version lately and have had some good amount of success although there has been a lot of digging to get things to work correctly.

While using information found on the Web is usually free, I still like books. So, I bought a book: "Internet of Things with ESP8266," by Marco Schwartz - in PDF.

After spending several hours on the small project of getting a DHT11 sensor to work with my nodeMCU, I finally figured out that my DHT libaries were out-of-date. The simple solution was to install Adafruit's DHT library and their Adafruit_Sensor library.

Here is the link to using a DHTXX sensor on Adafruit:

My setup is seen below:

The thing to realize, when you use an ESP8266 module of some sort. is that you need to know what pins are being used in the Arduino code. Here is a typical image of a nodeMCU layout:
A little hint: when you go to write your code in the Arduino IDE, make sure you use the correct pin. Looking at the layout above, D1 is GPIO5. In a typical DHT11 example program you will see digital pin 2 used to get data from the sensor. I changed that to 5, as was in the code in the book. The point is that nodeMCU pins will often not work with with Arduino board code and changes will be needed. Then you also have to make sure you are getting the correct numbers for whatever ESP8266 module you are using.

I will not bother posting the code as you can find it online in different places. Hopefully, it will be enough assistance to those with similar problems in keeping their libraries up-to-date. I guess that is my own lesson as well. If I come across more problems that I are worth posting, I will.