Help with Eagle schematic and layout

Hi @BDub and @kennethlimcp,

I’m building a notification center based on the Core/Photon. So far it works well on my breadboard and I’m getting ready to move to a PCB.

Below is my first ever schematic and I was wondering if after you finish laughing about my terrible design, if you could give me some feedback on it. :smile:

In a nutshell, the system is:

  • Powered by a micro-USB 5V 2Amp power supply.
  • Has a TFT display and micro-SD controlled through SPI.
  • Has several sensors, all with a power input from 3 to 5 V.
  • Has a connector header that must supply 1.5 V
  • And has a 1 meter 5V Adafruit Neopixel LED strip connected to it.

I’m not an electrical engineer (as if it wasn’t obvious from the images below), so I would really appreciate all the feedback you can give me.

Thanks so much!
Sergio

Doesn’t look like a complicated circuitry and not too bad for the first time :smile:

  • Consider adding decoupling capacitors near the VCC line for each component like microSD for example. 0.1uF should be sufficient
  • What’s the 22k for in the power supply connector?
  • Is that a speaker or a piezo buzzer? I’m not sure if a speaker can simply be connected to a GPO pin
  • Consider shifting LED3.3 to D2 or other pins since D0 and D1 gives you I2C
1 Like

Thanks for the feedback @kennethlimcp!

Great point. I added decoupling 100nf 16V capacitors to the Photon, SD Card, TFT LCD, and the power output.


It is to do a DC to DC conversion from 5 Volts to 1.5 Volts. I’m trying to replicate the power supply of a 1.5V AA battery. Is there a better way to do this?

It is a 0.5W speaker. http://www.puiaudio.com/pdf/SMS-1508MS-2-R.pdf. That is below the 0.66W max consumption per GPIO pin if I’m not mistaken.

Hi @sazp96

A resistor does not do a DC to DC voltage conversion. Is there some other component there that I am missing? Maybe if you explain why you need the 1.5V we have help you figure it out. A zener diode or voltage regulator or DC-DC converter IC is needed.

The speaker you referenced is a typical 8 ohm speaker that will not work well (if at all) on a digital output from a microcontroller. You need an amplifier to drive a speaker, even if it is just a one transistor amplifier. I have not checked but I don’t think the Photon can output 200mA per GPIO pin–I suspect that it can output 20mA max from any single pin. In any event, your 8 ohm speak has the potential draw around 400mA at 3.3V. That is not going to work and will likely burn out that pin on your Photon.

You mentioned that you have breadboarded this–are you sure it is working?

1 Like

@sazp96, as usual @bko is dead on. The purpose of decoupling capacitors is to remove transient (power) noise AT the device power pins. This means putting capacitors near the Vcc pins of every chip consuming power on the board. A value of 0.1uf or 100nF is good to temper higher frequency transients (aka ripple). What you are missing is a capacitor to catch lower frequency transients. The best approach is to have larger capacitors on each of your active power rails (5V and 3.3V if applicable). Ideally, these are polarized (eg. electrolytic) with a value above 10uF, depending on the amount of current used by your circuit. I tend to use 47uF or more capacitors placed near the power entry on the board (ie as near the “source” as possible). @bko probably has great advice to give here.

As for the 1.5V supply, again @bko is correct. What are the current requirements for the 1.5V supply?

3 Likes

Hello guys, thanks for the help. Let me provide more context:

I want to power a small motor that currently utilizes a AA battery. I’m trying to provide a smooth power stream to it. I believe that it consumes ~17mW. So at 1.5 Volts that should be ~11mA.

Yes, 100% sure. I’m using a PWM pin. I trigger the speaker with tone().

tone(pinSpeaker, 1908, 1000);

Could you tell me which type of transistor would be a good amplifier to use here?

Smaller capacitors near the chips for high frequency noise, and bigger capacitors near the power source for lower frequency noise. Got it!

I only have 1 power rail (everything including the Photon get’s powered by 5V), so I added one Radial DIP CAP Aluminum 100uF 16V right at the source.

The device that consumes the most power in the circuit is the Adafruit Neopixel LED. At max power it consumes 2 Amps at 5V. Will the 100uF be enough? Is there a formula or rule of thumb to calculate this?

Hello @peekay123, @bko, and @kennethlimcp,

Below is the layout where I added the big polar capacitor near the source and the smaller ones near the IC/SD/TFT as recommended. Please let me know if I’m missing something else here.

Thanks again!

Hi @sazp96

I think you are really close with this but I have a few suggestions:

  • You have some fat and some skinny power rails. In particular the display connector JP1 seems to be served by a skinny set of +5/GND lines. Similarly over on the speaker. I would try to be more consistent with wider traces.
  • I would layout the C3 and Core/Photon power without the jogs and with wider traces. You can t-off the connect the cap C3.
  • You could add a ground plane beneath the antenna section of the Core/Photon as the grayed out box suggests. It should be a copper pore in gray area on both sides with a few vias to tie them together and then to GND. This is optional but it will improve your radio performance.
  • J3 seems tight up against J4–you might find that moving it left and down a few 0.100" would it easier to use. Similarly J4 is tight to J1 and could use more room.
  • You don’t seem to have any mounting holes. I would put in at least 4 and 6 might be better with one near the middle of each of the long sides if you can squeeze them in.
  • You are not using a bunch of the digital IO side with D1,D4,D5,D6 open. I would bring these out to pad between the Photon and the speaker in I need them. Similarly TX and RX on the left side could be brought out to pads just in case.
  • Make sure your hole size for the screw terminal connectors is large enough. This is a mistake I have made before.

Good luck!

1 Like

I think that is incorrect. I believe you will want to have a keepout area here, with no traces or groundplane (which is what the text in the box says, I think.)

Adding traces/copper here will change the impedance and radiation pattern of the antenna, which you don’t want to do.

2 Likes

Thanks for the correction–I read it wrong.

Thanks for the feedback @bko and @AndyW.

  • I applied a copper pour on both layers of the PCB but left a cutout section beneath the antenna section (on both layers).
  • Added mounting holes (with a bigger diameter than the vias, thks @bko :wink:
  • Added several pads/test-probes for several IO pins and for 3V and 5V power.
  • Increased the space between J1, J3 and J4.
  • Re-calculated the width of the power traces depending on the amount of current that they will be carrying. I left some power rails wider than other as the amount off current they are expected to carry varies. I used this: http://www.4pcb.com/trace-width-calculator.html calculator assuming a 2 oz/ft2 of copper.

Below are the updated layouts:

@bko, you mention that my current direct GPIO to 0.5W Speaker could burn out the GPIO.

How can I use a simple transistor to avoid that?

Thanks!

Hi @sazp96

If you breadboard has not blown out the pin yet, something must be off in your data. Maybe the speaker is not really 8ohm but 120ohm which is a common cell phone speaker value.

I googled for “NPN transistor amplifier” and picked out decent link that can explain it here:

http://www.electronics-tutorials.ws/transistor/tran_2.html

You can start with a single NPN transistor with resistor on the base (say 1k) and the speaker between Vcc and the collector of the transistor. This is a simple digital on-off switch that can handle more current than the core pin. This will work great if you are using PWM to generate tones. RL is your speaker.

At the bottom of the page is a Single Stage Common Emitter Amplifier which puts the transistor in a linear region, so not just on or off, but can deliver a variable amount of power to the load. This would be good if you have a real analog source like a headphone signal.

Hi @bko,

I think that the reason why I haven’t blown my pin (…yet) is because the core is only sending to the speaker ~180 mV. The core is not sending a continuous HIGH voltage but a PWM.

The code that is generating an annoying sound right now (…but I have another one that make a nice melody) is:

int speakerPin = D0;
int i = 0;

void setup() {

}

void loop() {
  i = i + 50;
  tone(speakerPin, 500, 1000);
  delay(1000);
}

Here is a pic of the setup:

So, could my circuit survive for several years or I’m testing my luck?

If it is an 8 ohm speaker (probably inductive), I would want to have a couple spare processors on hand.
If you don’t want to add an amplifier, maybe a resistor in series would help protect the processor.
If you don’t need quality sound, you may want to look again at the piezo buzzer.

1 Like

Sweet. Thanks for your answer Jack.

Two questions:

  1. For the resistor that goes in between the speaker and the Pin, how many ohms should it be?
  2. I’m very new to electrical engineering in general, so please excuse the basic question. Is a level-shifter the same thing than an amplifier? If so, could I use this one: http://www.digikey.com/product-search/en?keywords=296-4708-1-ND

@sazp96.

  1. I would try it with a 1k resistor. If the volume is enough, then great, use the 1k.
  2. I am not well versed on a level shifter, but I would think that part would not work for you.

Did the link that @bko suggested, http://www.electronics-tutorials.ws/transistor/tran_2.html2, help?

Basic questions are fine.

If you are using tone() then you just need a switching amplifier.

A youtube video about using NPN transistors for switching may be interesting

https://www.youtube.com/watch?v=kNVaIqmKUoI

Yes it did. Very helpful, thanks.

Right now my debate is the following. I have two devices that need some type of adjustment to the signal between the Photon Pin and itself:

  1. Adafruit Neopixel strip. It needs the logic to be at 5V. So, I’m using [this level shifter] (http://www.digikey.com/product-search/en?keywords=296-4708-1-ND).
  2. The 8 ohmn speaker. Which needs a switching amplifier (i’m using tone). Right now I’m planning to follow your and @bko’s advice and use a NPN transistor for this.

My question is, do I need to use two different things (a transistor and a level shifter) or can I use two transistors or two level shifters? I would prefer to reduce the number of unique parts in the PCB.

@BDub could share some light on the best way to address this issue?

Thanks guys!

The neopixel data input requires more of a correct voltage, and less current… so your proposed level shifter is perfect for that.

The speaker really needs more current and doesn’t really require more voltage, so the level shifter won’t necessary be a good fit. The NPN transistor is more ideal.

I have seen an NPN transistor used as a level shifter for neopixels. I haven’t tried this myself, but you might be able to make this work and use two NPN transistors in your design. Honestly I kind of question this because by using the NPN transistor you are inverting the signal as well, which changes the pulse HIGH times to the neopixels, but it’s written up here as a tutorial so give it a try: https://punchthrough.com/bean/examples/mood-light/

My advice would be to stick with the NPN for the speaker and level shifter for the neopixels. You can also create an optional stuffing arrangement and include both NPN drive and level shifter drive for the neopixels on one board, then just stuff whichever is going to work out the best for you.

3 Likes

Awesome! Thanks @BDub. I will follow your advice.

For a 0.5W speaker, triggered by a Photon, and in a circuit powered by 5V, what voltage and current rating should the NPN transistor have?

In my opinion, the input voltage for most 5 volt circuits, are “OFF below 2 volts, and ON above 3 volts”. Since the Photon will put out more than 3 volts, you may not even need a level shifter. If you have both item on hand, you can test that before assuming that a level shifter is needed. I may be wrong, so correct me if you think so.

For the NPN transistor, there are many, but one classic is the 2N2222.