Beginner schematic review: Hall effect keyboard

Hi! I'm trying to make a small MIDI keyboard, using a Teensy 4.1 to read 48 Hall effect sensors via 3 multiplexers. I attached a PDF image of my schematic (the full KiCad project is at https://github.com/DumpsterDoofus/keyboard_accordion). Could someone point out mistakes they see in the PDF? I am totally new to designing schematics. Some starting questions:
  1. Are the Teensy pins connected to power correctly? At the bottom, I connected one GND and one +3.3V pin, but there's several other pins labelled "GND", "3V3", or "5V" that I didn't know if/how I should connect.
  2. With this design, will all components be powered by the Teensy USB connection?
  3. Someday I want to increase the number of keys from 48 to 192. Does this seem possible? I'd need 192/16 = 12 multiplexers connected to the Teensy 4.1, and the PJRC website says 4.1 has 18 analog inputs which seems like enough.
I saw this MIDI synth post which is very similar, but their schematic only shows the multiplexers, not the Teensy.
 

Attachments

  • KiCad Schematic.pdf
    156.9 KB · Views: 43
Consider adding 0.1uF power supply decoupling capacitors. At the very least, use 3 of these, each located close to a 74HC4067 chip.
 
Which sensors are you thinking of? Don't forget to account for their power usage as you have a lot of them, and consider extra decoupling every few sensors too (100nF ceramic SMT capacitors are cheap).
 
@PaulStoffregen I added 11 0.1uF decoupling capacitors: 1 for each of the 74HC4067 chips, and 1 for every 6 sensors (which will be laid out in columns of 6 on the PCB). Does the new schematic look ok? I read online that "the USB standard requires that devices present no more than 10µF total during connection" but this adds 1.1uF so I think inrush current shouldn't be a problem?

@MarkT The sensors are OH49E-S Hall effect sensors, which according to documentation draw 4.2mA at 5V (I'm using 3.3V so will be less). 48 sensors is up to 200mA, and if I expand to 192 sensors it's up to 800mA. The USB 3 standard says it supports up to 900mA, so 48 sensors should be fine, but 192 sensors might be close to the limit?
 

Attachments

  • KiCad Schematic.pdf
    166.2 KB · Views: 19
@PaulStoffregen I added 11 0.1uF decoupling capacitors: 1 for each of the 74HC4067 chips, and 1 for every 6 sensors (which will be laid out in columns of 6 on the PCB). Does the new schematic look ok? I read online that "the USB standard requires that devices present no more than 10µF total during connection" but this adds 1.1uF so I think inrush current shouldn't be a problem?

@MarkT The sensors are OH49E-S Hall effect sensors, which according to documentation draw 4.2mA at 5V (I'm using 3.3V so will be less). 48 sensors is up to 200mA, and if I expand to 192 sensors it's up to 800mA. The USB 3 standard says it supports up to 900mA, so 48 sensors should be fine, but 192 sensors might be close to the limit?
Little note, if you see 4.2mA at 5V you should see about 6.36mA at 3.3V. Or somewhere in that region. Voltage goes down, amps go up and vice versa. So in your case, you will have more amps then what you calculated. Bare that in mind dear community member. :)
 
Voltage goes down, amps go up and vice versa.
@Dogbone06 Thanks, I hadn't considered that lowering voltage might actually increase current draw! Is that still true for a Hall sensor? According to this SS49E datasheet (which looks similar to the OH49E-S) page 4 graph "Supply Current vs Temperature", the current draw at 25 Celsius is:

* 5.5mA at 3V
* 8mA at 5V
* 10.5mA at 6.5V

Anyways I'll measure the current draw when I test it.
 
Last edited:
@Dogbone06 Thanks, I hadn't considered that lowering voltage might actually increase current draw! Is that still true for a Hall sensor? According to this SS49E datasheet (which looks similar to the OH49E-S) page 4 graph "Supply Current vs Temperature", the current draw at 25 Celsius is:

* 5.5mA at 3V
* 8mA at 5V
* 10.5mA at 6.5V

Anyways I'll measure the current draw when I test it.
When talking current consumption (draw) of Z component then yes. But if something else that’s specific to hall sensors then I am unsure as I’ve never used them myself.

Measuring draw is a great idea.
 
The USB 3 standard says it supports up to 900mA, so 48 sensors should be fine, but 192 sensors might be close to the limit?

Up to. Assuming USB3. Don't assume every port can deliver that much power.

Anyway your 3.3V isn't coming from the USB. It's coming from the 5V to 3.3V regulator on the teensy.

The teensy has a linear regulator that in theory supports currents up to 1 A. However that is assuming sufficient heatsinking, at maximum current it would be dropping 1.7W within the regulator, the part would probably overheat and hopefully go into thermal shutdown to protect itself.

So even if the USB can supply sufficient power I wouldn't recommend trying to pull more than a few 100mA from the Teensy 3.3V pins. The exact limit may well ending up depending on mechanical design and how much air flow there is.

And to answer one of your initial questions - Yes, connect all the 3.3V pins and ground pins. This is a module rather than an IC so it's not critical but is a good habit. Generally you want the ground connections as good as possible to minimise noise. That is more a layout issue but skipping half the pins isn't a good start. It's not like connecting extra grounds takes any more effort, they can connect directly into the ground plane.
 
So even if the USB can supply sufficient power I wouldn't recommend trying to pull more than a few 100mA from the Teensy 3.3V pins.
I updated the schematic so that only the Teensy is powered by USB. The other components are now powered by a 5V DC wall adapter dropped to 3.3V with an AMS1117-3.3 LDO regulator. The datasheet says it provides up to 1A, hope that's enough?
Yes, connect all the 3.3V pins and ground pins.
I updated all the Teensy ground pins to be connected. I didn't connect the Teensy 3.3V pins because (if I understand right) the board no longer uses them for power.

Attached is the updated schematic, does it look better?
 

Attachments

  • KiCad Schematic.pdf
    172.8 KB · Views: 19
I updated the schematic so that only the Teensy is powered by USB. The other components are now powered by a 5V DC wall adapter dropped to 3.3V with an AMS1117-3.3 LDO regulator. The datasheet says it provides up to 1A, hope that's enough?

I updated all the Teensy ground pins to be connected. I didn't connect the Teensy 3.3V pins because (if I understand right) the board no longer uses them for power.

Attached is the updated schematic, does it look better?
For the regulator look at the thermal resistance part of that datasheet, that will give you a rough idea of how much the regulator will heat up for a given power draw (In this case power = voltage drop * current = 1.7* current). This will depend on the packet used. The data sheet will be assuming a certain amount of copper area. If this is a keyboard then you have lots of space so make sure you give it a big copper area to spread the heat over.

Adding a second power supply introduces a different problem - what do you do if one is connected and the other isn't?
If your external supply is connected but not the USB you will be driving signals into the Teensy IO pins when it doesn't have power, that isn't good for the processor. Similarly the other way around, if the teensy is powered but the other supply not connected, the other parts will try powering themselves off the IO pins.
Connect the 5V from your barrel jack into the Teensy Vin, this will ensure the teensy is always powered when the other parts are powered. Then connect the external 3v3 to an IO pin (via a series resistor (anything from 100 to 1k) just to be paranoid). If that pin is low then set all the teensy outputs to low so that you don't try driving signals into chips with no power.

If you have space I'd add footprints for a capacitor next to each sensor, it may help with noise levels. It's probably not needed but it's the sort of thing that if you do find you need it then it's a pain to add later. You can always not fit them if they aren't needed.
 
To complete @AndyA suggestion (assuming Teensy powered via USB and other circuitry is powered via external power supply), you'll need to cut the bottom track linking Vin with VUSB and add diode OR'ing. Here's how that's done (illustrated with a different Teensy, otherwise it all applies).
Teensy Vin-VBUS diode ORing
This supports powering Teensy from USB while powering other circuitry with an external power supply. This way, it doesn't matter which power supply comes up first. The down-side is, the external power supply needs additional output current capability to power Teensy while Teensy is disconnected from USB power source.
 
Last edited:
Good point, I'd forgotten that the teensy doesn't have a diode combining the power input options.
In the image here the lower left pin is the Teensy Vin.

If you were to cut the trace between the two rectangular pads then that disconnects the teensy from the USB power.
Do that and feed 5V in to the power input pin and the teensy will only ever be powered from the external power which would solve the problem.

If you want the teensy to be powered by either source then that extra un-named hole by the top pad is the USB power in.
You could use two diodes (or a single 2-diode package like a BAT54C) to combine the USB power in and the external 5V and feed the end result in on the teensy Vin pin.
1737979573182.png
 
Connect the 5V from your barrel jack into the Teensy Vin
I connected the "+5V" to the Teensy "VIN" (pin 48 in the schematic). Should I also connect it to the Teensy "5V" in the "USB Host" section (pin 55)? I assume no because I'm going to cut the trace for the USB power, so that pin will be useless.

Then connect the external 3v3 to an IO pin (via a series resistor (anything from 100 to 1k) just to be paranoid).
I connected the A17 analog input pin via a 1k resistor to the 3.3V output from the linear regulator.

If that pin is low then set all the teensy outputs to low so that you don't try driving signals into chips with no power.
Will that be done by the software I write later?

add footprints for a capacitor next to each sensor, it may help with noise levels.
Done. I also reduced the number of sensors from 48 to 3, so that review is easier, prototyping is faster, and failure is less costly. Look any better?
 

Attachments

  • KiCad Schematic.pdf
    77.7 KB · Views: 25
Adding a second power supply introduces a different problem - what do you do if one is connected and the other isn't?
If your external supply is connected but not the USB you will be driving signals into the Teensy IO pins when it doesn't have power, that isn't good for the processor. Similarly the other way around, if the teensy is powered but the other supply not connected, the other parts will try powering themselves off the IO pins.
What do you think of this simpler solution to the problem? I attached a schematic. The Teensy is powered by USB, and all other components are powered by an external 3.3V DC adapter. The Teensy's internal 3.3V is connected to the enable PIN of the multiplexer. The external 3.3V is connected to a Teensy IO pin; my Teensy software will only drive the multiplexer controls when it's high. As a result:

* If the external 3.3V is on but the Teensy is off, then the multiplexer will not drive AM1 into the Teensy because the multiplexer enable pin is low.
* If the external 3.3V is off but the Teensy is on, then the Teensy will not drive CONTROL0/1/2/3 into the multiplexer because the external 3.3V will be low.

If this works, it'd remove the need to add an additional voltage regulator, handle the heat dissipation of an LDO or the RF noise of a switching regulator, or cut up my Teensy with a razor to disconnect the USB power trace.
 

Attachments

  • schematic_no_voltage_regulator.pdf
    54.8 KB · Views: 10
The safer way for Teensy to detect if external power supply is connected is to use the DC1 switch contact. At J2 pin20, connect DC1 pin3 and change the voltage feeding R1 to Teensy 3.3, J2 pin3. And remove the connection between DC1 pin 2 to DC1 pin3. This way, you're not feeding an external voltage into an unpowered Teensy.
 
Back
Top