Showing posts with label juno6pm input board. Show all posts
Showing posts with label juno6pm input board. Show all posts

Thursday, November 28, 2013

ADC error and Switch debouncing

Now that I have the IO hardware working, I have noticed a couple of issues in the potentiometers and switches inputs to the AVR:

  1. Potentiometers readings in the ADCs are not stable and seem to fluctuate
  2. Switch readings are bouncing on button press.
I found this great site: Newbie Hack where both topics are covered and clearly described. For the ADC stability issue, you can find this way of measuring the error. No info is giving on how to remove this problem, but I suppose a low pass filter should do. As for a way to do switch debouncing, you have it here

Still need to implement this solutions and try.

Update (12/03/2013):
Fixed the switch debouncing by only reporting switch changes after a certain number of unchanged reads, similarly as explained in the links above.
For the Potentiometers, I added some histeresys, I only report potentiometer changes when the read value exceeds the previously sent value by a certain amount, which gets rid of all bouncing issues, althought the cost is high as the potentiometer changes are not as smooth as they could be. still need to work on that.


Thursday, July 25, 2013

Did I say SW UART?? No... no... HW UART

After investigating the possibility of using SW UART for MIDI out, I decided to give up... I had lots of issues getting reliable serial baudrate conversion and did not have enough spare time to investigate further, as can be seen based on my lack of posts in the last few months. So I am now using HW UART, 31250 in, 31250 out... no conversions... and that seems to be working fine. Took me some time to actually get it right, I thought I was also loosing bits there, until I found out about the running status in Midi... dammed it.. should have read the midi specs!!!

On the Raspi side, I plan to do as explained here to get the serial port to work at 31250.

Monday, April 8, 2013

SW UART

My plan is to have my AVR board handle midi Input and send that to the Raspberry PI (as well as the potentiometer and switches status) through 38400bps serial port of the Raspberry Pi. To do so, the AVR will be receiving MIDI through the HW UART and will be sending serial data by bit banging.
I tried using the SW UART implementation of AVR lib, but it seems to be failing every now and then (actually very often). I was expecting it to "just work" and let me work on other stuff, but it seems like I am going to have to spend some time debugging the code from AVR lib or looking for other alternatives... I am not big expert on AVR coding, so I expect a few nights of intensive work.
Meanwhile, I am almost done modifying rtMidi to allow Midi comming through serial port.

Thursday, March 21, 2013

USBtinyISP

Yesterday I got my USBtinyISP from HobbyKing, but had no time to test it yet. I already wrote the code for the AVR so I can't wait to try that. I still need to work on the midi reception in the Raspi, to change rtMidi to use serial midi (at a non standard baud rate) instead of ALSA midi. One possibility is to use ttymidi (which converts serial to ALSA midi messages), but my plan is to extend rtMidi instead and not use ALSA midi at all.

Friday, March 1, 2013

Juno6pm Input Board: Bad News

My AVR programmer stopped working today. That means my progress on the input board will be delayed until I can get a new one. I did a quick search and I think I will go with the USBtinyISP programmer sold by hobby king. One of the reasons to choose the USBtinyISP is the buffered IOs. The lack of those buffers is probably what killed my programmer.
In the mean time I guess I will continue working on improving the synth part and maybe prepare a video of both synth and drum machine.

Thursday, February 28, 2013

Juno6pm Input Board: The Software

While looking for examples of bit banging serial, I came across this AVR library called AVR lib. It is a great library for lazy people like myself, not only for serial bit banging, but for anything else you might want to do with the AVR peripherals: ADC, UART, I2C, timers... should be able to finish the code quickly with this cool library.

Wednesday, February 27, 2013

Juno6pm Input Board: The hardware

The Juno6pm input board is the board that will handle MIDI input (to solve the CPU hogging issue caused by Raspberry Pi USB MIDI), the knobs and the switches. It will be connected to the Raspberry Pi through serial. The board I am planning on using is the AVR synth that I bought a while ago from elby-designs:

Since this whole project is a virtual analog synth, I decided that I will not be using my AVR Synth anymore and I better give it a better use (also I have little time do design a new board, build the pcb, solder components, etcetera).
The idea is to keep the 8 potentiometers, replace the 16 switches with momentary pushbuttons and remove the dac completely.
As for the software that will run in the AVR, it will receive MIDI from standard 5 Pin MIDI connector using the hardware UART and send it to the Raspberry Pi, toghether with potentiomer and switches values, by bit banging serial.
Once I am done with the whole project I might think of making a new board just for this project, but till then this will be my juno6pm input board.