Khadas 808 Drum Machine Controller

Which system do you use? Android, Ubuntu, OOWOW or others?

Ubuntu 22.04.3 LTS

Which version of system do you use? Khadas official images, self built images, or others?

Khadas Official

Please describe your issue below:

Programmable 3.3V || 5V GPIO pins query

Disclaimer: I am very new to SBCs (experience < one year).
Disclaimer: I promise this is Khadas VIM related.

Overview

1. Power Supply

I am trying to use my VIM4 to control a 808 Bass Drum synthesiser module.

The module requires power (obviously) and this is where I am asking for some insight, please!

To power my bass drum module, I need a +12V rail, a -12V, a +5V line and a ground.

So far, I know (think, at best) that I can use:

  • PIN 1 = 5V continuous (i don’t know the official term - ‘always on’?);
  • PIN [5, 9, 14, 17, 21, 24, 28, 34, 40] are GND.

I want to achieve:

  • A way to take two 12V rails from my Khadas VIM4 to use as power for the drum module.

2. CV Trigger (3.3V => 5V)

I have learned this morning that I can toggle PIN22 (PIN.Y17 or GPIO501) high and low using WiringPi (thanks to the official guide, where I adapted the demo source code).

  • However, this is problematic because the pin supplys 3.3V, which is inadequate to trigger the CV trigger input of the bass drum.

I have then learned that I might be able to use a ‘logic level shifter circuit’, using some NPN and p-MOSFETs. You can critique my simulation here.

I tried a slightly different approach too but I do not want to use relays due to mechanical noise.

  • The push-button switch emulates the python code, turning the pin high/ low.
  • When HIGH, the pin sends 3.3V to the NPN, allowing current through. This opens the MOSFET and allows the 5V rail to supply the output.
  • The MOSFET receives its 5V supply from Khadas PIN1.

I think that would work, at least to achieve the 5V CV trigger I require.

import wiringpi as GPIO
from time import sleep

INPUT = 0
OUTPUT = 1
BCM_PIN = 501 # PIN22 || PIN.Y17
OUTPUT_HIGH = 1
OUTPUT_LOW = 0
pinstatus_list = ['LOW', 'HIGH']

GPIO.wiringPiSetupGpio() # To use BCM GPIO numbers
GPIO.pinMode(BCM_PIN, OUTPUT) # Pretty sure this tells the computer that the chosen pin is an output pin, meaning it can output signals but not receive

try:
  while True:
    print("Setting the output pin to HIGH...") # UI messages, else i'll presume nothing's happening
    GPIO.digitalWrite(BCM_PIN, OUTPUT_HIGH) # HIGH = on, live (i.e. outputting 3.3V)
    result = GPIO.digitalRead(BCM_PIN) # Store the state of the output pin to print later
    print('{}{}'.format('Successfully set output pin to', pinstatus_list[result]))
    sleep(1) # One-second pause 

    print("Setting the output pin to LOW...")
    GPIO.digitalWrite(BCM_PIN, OUTPUT_LOW) # LOW = off (i.e. outputting ~0V)
    result = GPIO.digitalRead(BCM_PIN)
    print('{}{}'.format('Successfully set output pin to', pinstatus_list[result]))
    sleep(1)

except KeyboardInterrupt:
  # Unexport GPIO pin (set back to INPUT mode)
  GPIO.pinMode(BCM_PIN, GPIO.INPUT)

I want to achieve:

  • A way to boost the 3.3V to 5V
    OR
  • Learn about a programmable 5V pin (so I do not have to make a logic-level shifter circuit).

Summary

  1. Can anyone advise, suggest, etc., a means of acquiring positive and negative 12V rails directly from the Khadas. Or, should I build a standalone PSU that can supply power to the Khadas, as well as the 12V rails? I know I could probably buy something like this but I have been messing with toroidal transformers since 13, so I have some confidence…
  2. Does my solution to the CV trigger 3.3 - 5V seem reasonable and plausible? Is it a bad idea, are there other better ways.

Notes

  • This is for fun and learning purposes.
  • I hope this makes some degree of sense.
  • Please ask anything if I haven’t clarified, been to vague, etc!

Thanks so much for any input!!

Correct solution for this.

1 Like

Hello @byJBX

The I/Os of the VIM4 are either of 3.3v or 1.8v depending on their domain, you can check the schematic for this https://dl.khadas.com/products/vim4/schematic/vim4-sch-v13a.pdf

You will most likely need to use a logic level shifter for safe operation.

It’s recommended to supply voltage such as 12v independantly, as VIM4 is only capable to an extent of supplying power to external devices due to limitations of current.

Hope this information helps.

Regards

1 Like

Would this be appropriate? Thank you and apologies if I am not supposed to be sharing links to online stores!