While working on the firmware implementation I found a few small things that had to be modified.
Rotary encoder
The rotary encoder on the KORE unit has its common connection to 5V, while the Arduino libraries I found expect the rotary encoder common input to be connected to ground. Also as the itsybitsy board will be handling any menu system and configuration I wanted the rotary encoder to be connected directly to the itsybitsy board. As such rotary encoders are also fairly noisy, I wanted to add some hardware filtering.
I cut the three pins and bent them out so there were no connections to the PCB except for the side-pins holding the rotary encoder in place. I connected a screened cable cut from an USB cable and connected the other end to the USB connection prototyping PCB.
On this prototyping PCB I connected the common pin of the rotary encoder to ground and added simple RC filters to the rotary encoder A and B outputs for hardware de bouncing.
The internal pull-ups on the nRF52840 are in the 10-13K range, so it is important that the filter resistors are small enough to pull the input voltage close enough to ground, as they will act as a voltage divider together with the internal pull-ups. I used 1K resistors with 10n capacitors. This gives a good result and pulls the input voltage down to around 7-9% of VCC. From this filter I connected a cable to the itsybitsy pins 12 and 13.
Pedal Inputs
For the expression pedal inputs the Zener diode circuit limits the maximum voltage, and although I could scale and compensate for this in the ADC measurements, there is not really any need for this zener circuitry as expression pedals are passive and consist of a simple potentiometer. I also wanted to implement code to detect whether or not a pedal is connected, and to check if the ring connection is shorted to ground before outputting VCC to drive the pedal. Such short-circuit would happen if a mono-plug or a foot switch is connected instead of an expression pedal, and also for a short period when hot-plufgging an expression pedal.
To be able to detect this I needed to have both the ring and the tip connected to an ADC input. I therefore changed the connections to have the pedals connected to A0-A3, and the foot switches to be connected to the digital inputs.
I also connected pin 4 of the jack plugs to ground so that when there is no plug inserted the tip connection is grounded.
The following schematics shows how the pedal detection and enabling works.
With no pedal connected the internal pull-up pulls A0 to VCC, and A2 is connected to ground through the internal switch in the pedal input jack. With a pedal connected, the expression pedal pot and the internal pull-up forms a voltage divider. The level on A2 is dependent upon the pedal position.
The firmware first checks if the voltage of the ring connection (A0) is at max level. If so, there is no pedal connected. Otherwise if the voltage is lower than max, there is something connected, and the firmware checks if the voltage level is (close to) ground. If so there is a short and an error status is indicated. Otherwise if A0 is not shorted to ground, and not pulled up to VCC there is a pedal connected. A0 is changed to output driving VCC to the pedal potentiometer, and the pedal position is read from the voltage on A2.
The picture below shows pedal 1 not connected and pedal 2 at around mid position (85 of 127). It also shows footswitch 1 activated. Second picture shows the error message when any of the pedal ring-connections are shorted to ground.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
I used the Boss FS-6 with 2 each CZH-Labs D-1022B Ver 2.0 to try and get the same
encoder response as a Pot encoder with limited success. Has anyone used a 2 button
foot switch to get the 5vdc switch up and switch down as this youtube encoder example shows?
https://youtu.be/v4BbSzJ-hz4
Are you sure? yes | no