Help with circuit advice.  - Page 1
Forum section: electronics / beginners

author: Regenerate3d
author_rank: Contributor
timestamp: August 31, 2024, 12:54:37 pm
content: Hi all I've made a simple circuit for a 15ch mosfett output on easyeda would anyone be happy to have a look and give advice?Arduino Mega input to control 28V micro bulb. Will need to use arduino PWM outputs as the lamps may require dimming.Many thanks

author: tooki
author_rank: Super Contributor
timestamp: August 31, 2024, 01:19:16 pm
content: As drawn it cannot work, because those are p-channel MOSFETs. Your circuit would fundamentally work if you used n-channel MOSFETs instead.Also, one resistor is missing a connection.For future schematics, draw grounds towards the bottom and positive power on top. This is just customary and makes it easier to follow.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: August 31, 2024, 09:02:59 pm
content: I agree with all tooki wrote.In addition:Your PCB layout is quite bad. No GND plane at all, and if you had put the FET's in the same order as they are on the connector, You can easily make a perfect PCB layout on one layer.On the schematic, connect the pull down resistor to the same GND symbol as the FET. This makes it's intention more clear.This PCB looks like you have just let some autorouter mess it up. It's Yuch!On the input connector, there is no GND at all, and these (faulty P-channel?) Fets have a low gate voltage. That is a bad combination.Gates of Fets are sensitive to ESD. Where is that input cable coming from?This is how I would do it.1). First I create a main sheet.2). Then I create a hierarchical sheet for a FET. It would look like:"Thick" is a "net directive label". It's used to assign a netclass, and these FET's can do a few Amps, so thick tracks are nice.3). Then I go back to the main sheet and make a bunch of copies of the hierarchical sheet:4). With the schematic mostly done It's time for the PCB. The resistors are all connected to two pins of the Fet's, so we orient them so that everything fits. Altogether, the transistors are however much wider then the connector, so we stagger the transistors. Odd numbers on top, even numbers on the bottom. The result:Doing it this way has a bunch of advantages. For example, by using the hierarchical sheet, you only have to draw one transistor in the whole schematic. If you change that single transistor, they all change! It also has advantages for the PCB. To get all the texts to line up nicely, I just placed the text for one transistor and one resistor, and then I ran theReplicate Layoutplugin in KiCad. You can choose what you want to replicate. Text locations, or also footprints and tracks. This saves a lot of drawing time.And euhm, I made these screenshots in KiCadI did not want to spend too much time on finding a 1.mm pitch flex connector, so I just subtituted it for an available THT connector with a 1mm pitch.2024-08-31_fet_15x.zip(54.88 kB - downloaded 22 times.)

author: Doctorandus_P
author_rank: Super Contributor
timestamp: August 31, 2024, 09:09:09 pm
content: Another note:If you want to control 28V with your FET's, then FET's that can only handle 30 Volts is not enough. You need some headroom. I would use at least FET's that can handle over 50V, and I would add TVS protection diodes too.

author: Benta
author_rank: Super Contributor
timestamp: August 31, 2024, 09:35:55 pm
content: And just draw one channel, that's easier to read. We have no problems imagining the other 14.

author: shabaz
author_rank: Frequent Contributor
timestamp: August 31, 2024, 10:13:33 pm
content: If "micro bulbs" means grain-of-rice type lamps with a few tens of mA of current consumption, then you could just use BJTs. A lot easier for a beginner, since there's less chance of damaging them during soldering if you don't have at least a minimal ESD setup, and not using a USB or other non-grounded iron, etc. Nothing special required, something like a BC847 and a base resistor. Might be cheaper too. Of course, it's not as efficient, but it might not matter, if you're not powering from batteries.

author: tooki
author_rank: Super Contributor
timestamp: August 31, 2024, 10:28:08 pm
content: Quote from: Doctorandus_P on August 31, 2024, 09:02:59 pmThe original post says it's an Arduino Mega.Quote from: Doctorandus_P on August 31, 2024, 09:02:59 pmCould you edit your post to remove the "align=left" from the image tags? It's causing the images to... not do what you want. (See screenshot.)

author: Regenerate3d
author_rank: Contributor
timestamp: August 31, 2024, 10:35:47 pm
content: Doctorandus_P thank you for getting back to me with ideas. ive tried to open in easyeda but the pcb is all messed up etc. Would prefer a single sided board if i can help it but not sure how to convert your board design?

author: Regenerate3d
author_rank: Contributor
timestamp: August 31, 2024, 10:50:40 pm
content: yes they are grain of rice very low current but i would hope to use fets for the pwm control for potential dimming.

author: tooki
author_rank: Super Contributor
timestamp: August 31, 2024, 10:57:04 pm
content: Quote from: Regenerate3d on August 31, 2024, 10:35:47 pmEasyEDA Pro will import it fine. EasyEDA Standard seems to choke on it -- I think it doesn't support hierarchical schematics so it skips them.But I'm pretty sure his intent in providing the KiCad files to you is for you to open them in KiCad.

author: tooki
author_rank: Super Contributor
timestamp: August 31, 2024, 10:57:56 pm
content: Quote from: Regenerate3d on August 31, 2024, 10:50:40 pmYou can definitely use MOSFETs (and in fact that is my preference), but FYI you can also PWM with BJTs.

author: Regenerate3d
author_rank: Contributor
timestamp: August 31, 2024, 11:09:48 pm
content: now downloading

author: Benta
author_rank: Super Contributor
timestamp: August 31, 2024, 11:12:56 pm
content: I don't quite understand why two ULN2803 (or a ULN2803 plus a ULN2003) won't do the job in a much simpler and cheaper way.

author: Regenerate3d
author_rank: Contributor
timestamp: August 31, 2024, 11:20:16 pm
content: I've only investigated mosfetts. can you give more of an explanation and example of idea please? from my calculations i'm going to be pushing more than 500ma and will need relatively high switching rate for pwm.Many thanks

author: Benta
author_rank: Super Contributor
timestamp: August 31, 2024, 11:43:42 pm
content: Quote from: Regenerate3d on August 31, 2024, 11:20:16 pm500 mA? For rice-grain bulbs? I hope you mean in total.Yes, the ULNs will handle that easily.Why would you need high switching rates for bulbs?Edit: here you go. I'm too lazy to draw the remaining 13 inputs and lamps.

author: Regenerate3d
author_rank: Contributor
timestamp: September 01, 2024, 01:51:23 pm
content: Appreciate the input will look into your schematic, the bulbs are about 50ma as far as i remember from measurements.

author: Nominal Animal
author_rank: Super Contributor
timestamp: September 01, 2024, 04:41:44 pm
content: 50mA per channel is no biggie for ULN2003A. As a Darlington transistor array, it haseightseven equivalents of the following circuits in it:Stolen from theTI ULN2003A datasheet, click to embiggenYou connect the output pin to the low side of the load. That is, you need to connect each bulb to your positive lamp supply voltage, and to one of the ULN2003A output pins (instead of ground). You connect the E pin to your lamp supply ground, noting that the sum current will flow through this pin (400mA per chip). COM is only used with inductive loads like relays. For lamps, being resistive loads, you leave it unconnected.When the corresponding input pin ishighlow, the outer transistor does not conduct.When the corresponding input islowhigh, the outer transistor conducts. You can PWM the input pins at quite high frequencies, definitely high enough to dim micro bulbs.There will be a voltage drop between the output pin and the common E (ground) pin, that depends on the current and the voltage on the input pin, but it should be less than a volt for your case. (If your lamp supply is 28V, the lamps will see 27V. ULN2003A can handle up to 50V between an output pin and the E pin.)With alleightseven outputs enabled, 50mA current per pin (350mA through E), ULN2003A generates about 7×1V×0.050mA ≃ 350mW = 0.35W of heat, similar to a 2kOhm resistor in series with your 28V supply.

author: Regenerate3d
author_rank: Contributor
timestamp: September 01, 2024, 05:04:17 pm
content: And this is ok for PWM too?

author: Benta
author_rank: Super Contributor
timestamp: September 01, 2024, 05:17:40 pm
content: Quote from: Nominal Animal on September 01, 2024, 04:41:44 pmIt's the other way around. Input high = conducting output transistor. Just as the symbol in my schematic shows.

author: Benta
author_rank: Super Contributor
timestamp: September 01, 2024, 07:43:01 pm
content: Quote from: Regenerate3d on September 01, 2024, 05:04:17 pmYes.But you still haven't answered why "high rate" is necessary, or what that term even means.It's all very nebulous.

author: Regenerate3d
author_rank: Contributor
timestamp: September 01, 2024, 07:50:01 pm
content: Sorry i'm lost "high rate" where did i say that? i would have meant fast switching rate that's why i went for mosfetts.

author: Andy Chee
author_rank: Super Contributor
timestamp: September 01, 2024, 08:08:56 pm
content: Why do you need to switch rice-grain bulbs at fast switching rate? Are you creating a display of some sort? Please explain more detail!

author: Regenerate3d
author_rank: Contributor
timestamp: September 01, 2024, 08:26:30 pm
content: I'm converting aircraft panels for simulator project. Fast switching to prevent flickering when dimmed.

author: Andy Chee
author_rank: Super Contributor
timestamp: September 01, 2024, 08:33:09 pm
content: In your application, "flickering" is a human visual perception phenomenon. Switching speed of 1kHz is more than adequate.When you said fast switching, some might've thought 1MHz or more!

author: Benta
author_rank: Super Contributor
timestamp: September 01, 2024, 08:43:11 pm
content: Quote from: Regenerate3d on September 01, 2024, 07:50:01 pmWhat you said exactly was "relatively high switching rate", which is meaningless. 1 kHz? 100 kHz? 10 MHz?...For incandescent bulbs, even the small ones, everything over 200 Hz is fine.The ULN2x03 ICs will do it at several kHz, don't worry.

author: Regenerate3d
author_rank: Contributor
timestamp: September 01, 2024, 08:44:04 pm
content: Fair enough i shall get onto prototype and get PCB cut tomorrow.

author: Regenerate3d
author_rank: Contributor
timestamp: September 01, 2024, 08:54:37 pm
content: Benta fantastic thank you.

author: Benta
author_rank: Super Contributor
timestamp: September 01, 2024, 09:18:33 pm
content: I hope you got the point about ULN2003A and ULN2803A.One has 7, the other 8 drivers, giving you exactly 15 outputs. You could also standardise on the ULN2803A and use the spare output for something else.Cheers.

author: tooki
author_rank: Super Contributor
timestamp: September 01, 2024, 11:26:52 pm
content: Quote from: Andy Chee on September 01, 2024, 08:33:09 pmAn Arduino Mega can’t do more than 490Hz PWM on most of its PWM pins, which is terrible for LEDs, but more than adequate for incandescent bulbs. One could reconfigure the PWM to 245Hz and get 16-bit PWM instead, and still be above what’s needed for flicker-free incandescent.(Remember that mains light bulbs don’t flicker, even dimmed, and they’re pulsed at 100/120Hz effectively.)

author: ledtester
author_rank: Super Contributor
timestamp: September 01, 2024, 11:56:33 pm
content: Quote from: tooki on September 01, 2024, 11:26:52 pm490 Hz is only the default value using the Arduino libraries. Faster frequencies are possible -- see for instance:https://www.etechnophiles.com/how-to-change-pwm-frequency-of-arduino-mega/You can get F_CLK/256 for 8-bit PWM if you want, i.e. 62.5 KHz when using a 16 MHz system clock.

author: tooki
author_rank: Super Contributor
timestamp: September 02, 2024, 12:15:40 am
content: Quote from: ledtester on September 01, 2024, 11:56:33 pmThe problem is that one needs to be very careful when doing this, or else you can break all the other system timers, including the millis() and micros() functions. That’s why the Arduino libraries don’t expose any function to change the PWM frequencies. To change them, you have to go around the libraries and use bare C functions to set the timer configs.

author: Regenerate3d
author_rank: Contributor
timestamp: September 02, 2024, 01:16:47 pm
content: Indeed you are correct. I can use a mosfett to control dimming via arduino pwm and put that in series for the bulbs and used arrays to switch bulbs on and off?

author: tooki
author_rank: Super Contributor
timestamp: September 02, 2024, 02:37:11 pm
content: MOSFET not "mosfett". (It's short for Metal Oxide Semiconductor Field-Effect Transistor, that is, a FET made with MOS technology.)You can either use N-channel MOSFETs, or individual BJTs, or a BJT array like the ULN chips shown above.

author: Regenerate3d
author_rank: Contributor
timestamp: September 02, 2024, 03:42:24 pm
content: Excuses to spelling error. I'm currently using single sided copper pcb on cnc router but i cannot get free routing to only do single side auto routing! Any ideas?

author: Benta
author_rank: Super Contributor
timestamp: September 02, 2024, 05:08:43 pm
content: 0 ohm resistors. Or just a wire.