MrAlvin / RAMPS-1.4.4

An Arduino Shield for 3D printers
GNU General Public License v3.0
17 stars 4 forks source link

[Moved discussion from Marlin] #2

Closed GMagician closed 4 years ago

GMagician commented 4 years ago

Sorry to move it here, but since you manage this repo I think none will regret.

I had possibility to talk to a guy that develop HW by job. I have some info that have to be considered about resistor size, current and capacitor.

Low ESR capacitor: this is important on pololu between Vmot and gndmot (it's used like a power bank for rapid current absorption). Important is ripple current to properly chose them.

Also diode current on pwm connections should be enough to handle full current (40W at 12V = 3,5A, bed over 11A)

Resistors: each resistor size has a Watt limit. When used for pull-up/down or do light leds, they have to be used for half wattage. Generally pull up/down have no problem but if you turn on led on finale mosfet stage (like it's usually done in industrial devices to give real out info) then you have to take care of this.

Not always other choise has to be considered, note ramps-fd version 1, ramp in its whole project (mosfet, power connectors, fuses, no endstop filters), so I prefer to analyze if a choice is good or not. Even Ruramps4d (that I consider a good board) has issues with bed mosfet (burned using a bed that should work).

AGCM4 note: pins used by ramps for min max endstops, if used both max and min, prevent interrupt use (due to how interrupt are handled by samd)

GMagician commented 4 years ago

About iterations, you are at 3rd...I think that developping a board is expensive...I think about €100 each lot + components...gulp

MrAlvin commented 4 years ago

Sorry to move it here, but since you manage this repo I think none will regret.

This is indeed fine.

(discussion start: https://github.com/MarlinFirmware/Marlin/issues/15222)

MrAlvin commented 4 years ago

About iterations, you are at 3rd...I think that developping a board is expensive...I think about €100 each lot + components...gulp

Well, it does not have to be quite that expensive for one lot/iteration.

Seeedstudio makes 5-10 prototype boards for less than US $5 + shipping. JLCPCB makes 5 prototypes for only US $2 + shipping.

Where I live, I need to keep international online bought items to less than ~US $11 (~€11) + shipping, or fees and taxes move in. And with the fee being about €22, it makes sense to try keep the item cost under the tax and fee limit.

3-5 day DHL shipping is about US$/€ 23-26 from either Seeedstudio or JLCPCB

So each iteration of testing does not need to be quite as expensive as €100

MrAlvin commented 4 years ago

I had possibility to talk to a guy that develop HW by job.

Always good to be able to get advice from an expert.

I have some info that have to be considered about resistor size, current and capacitor.

Low ESR capacitor: this is important on pololu between Vmot and gndmot (it's used like a power bank for rapid current absorption). Important is ripple current to properly chose them.

Yes, there have been reported issues about these capacitors getting quite hot. So low ESR for these capacitors is a very good choice. And they have to be placed as physically close as possible, to Vmot and Mot GND pins.

Also diode current on pwm connections should be enough to handle full current (40W at 12V = 3,5A, bed over 11A)

Yes, if a diode is placed in the direct path of the current, it must be able to handle the full current.

On RAMPS 1.4.4 there is however only two diodes being used in the direct current path. One is to protect the DC-DC converter. The other is to protect the Vin Arduino pin.

Two other diodes are being used in a way where they try to blow the fuses, if + and minus for the main power has been reversed.
Rather big diodes are needed if they are to be placed in the direct current path of the heated bed, They would typically need to be 20A diodes in TO-220 houses, mounted to a substantial heat sink. As it would typically burn about 1W per Amp.

So the next best thing is to blow the fuse. This is not a foolproof method, but it will stop current from flowing.

A better solution would be to place another mosfet, as an ideal diode. But I have not looked into how to implement such a solution.

So, for now, it is important to avoid reversing the main power polarity.

All other diodes are flyback diodes, protecting the mosfet against over voltage spikes, from inductive responses, when the mosfet is turned Off. So there is no constant DC current passing through these diodes. They only need to be able to handle the short spike of current.

I have not yet tested the sizes of these spikes with an oscilloscope. So far I have just tested the temperature of the flyback diodes, as a rough estimate of how well they are doing. But one day it could be interesting to do a deeper analysis.

Resistors: each resistor size has a Watt limit. When used for pull-up/down or do light leds, they have to be used for half wattage. Generally pull up/down have no problem but if you turn on led on finale mosfet stage (like it's usually done in industrial devices to give real out info) then you have to take care of this.

Again, agreed.

It is however possible to add cooling to an SMD resistor by making the PCB pads a little large. And by making the PCB paths to and from the current limiting resistor as wide as possible.

Most modern LEDs will also give plenty of light at less than 20mA. So I try to calculate for 3-8 mA, And then in the physical implementation I will adjust, to a suitable light level.

By using these methods, I have never had any problems using 0805 size resistors as current limiters for LEDs.

But I will make sure to include some temperature measurements of the current limiting resistors in my testing of the actual PCBs. As I do like the electronics to stay cool.

Not always other choice has to be considered, note ramps-fd version 1, ramp in its whole project (mosfet, power connectors, fuses, no endstop filters), so I prefer to analyze if a choice is good or not. Even Ruramps4d (that I consider a good board) has issues with bed mosfet (burned using a bed that should work).

I do not know if the RuRAMPS design uses flyback diodes, as I have not been able to easily find a schematics for this board. But without the flyback diodes, reverse over voltage spikes is most likely what seriously degraded the mosfet, and then it became vulnerable to burn out under what should otherwise be normal loads.

The mosfet used on the original RAMPS shields, had several types of protection built into the chip it self. And I suppose this is one of the reasons it was chosen, despite the high internal resistance, and the consequent over heating issues.

So when using other mosfets, without built-in protection from over voltage spikes, one must add this protection to the shield design.

AGCM4 note: pins used by ramps for min max endstops, if used both max and min, prevent interrupt use (due to how interrupt are handled by SAMD51)

Good to know. Thank you for this information.

I have not yet studied the advantages (and limitations) of the advanced programming options for each pin on the MCU used on the AGCM4 board.

And I suppose that the benefit of saving CPU cycles, by making end-stop pins interruptable, is not as important with the higher clock sppeds 32 bit MCUs, as it is with the "slow" 16MHz AVR MCUs.

Also, my thinking about end-stops and saving CPU cycles, has always been to move the end-stop pins to an external I/O-expander chip, so only one MCU pin would be needed in order to make all end-stops monitored by an interrupt service.

But this is for another topic discussion.

For now, it is nice to know that there are some limits as to how interrupt is possible (or not possible), on a per pin basis, for the AGCM4 MPU.

GMagician commented 4 years ago

And I suppose that the benefit of saving CPU cycles, by making end-stop pins interruptable, is not as important with the higher clock sppeds 32 bit MCUs, as it is with the "slow" 16MHz AVR MCUs.

That's no completely true. Interrupt routine is executed as soon as input changes. Endstop in polling are checked every 1ms (temperature isr). A lot of people use latter, only "big" difference is speed you can use to home.,Faster speed gives you 1ms (converted in space) home repeatability precision.

If you need it I may send you an xmls file with full AGCM4 pin map. You will see there interrupt vs pin. Only 16 interrupts are available and these are scattered in all chip pins.

MrAlvin commented 4 years ago

Endstop in polling are checked every 1ms (temperature isr).

Ah, okay.

Last time I looked into this issue, was years ago, and back then, the firmware checked the state of end-stop before every single 'step' puls to a stepper.

I suppose that is a little bit over-kill, if one is just making sure to not exceed the boundaries of the print surface.

A lot of people use latter, only "big" difference is speed you can use to home.,Faster speed gives you 1ms (converted in space) home repeatability precision.

But for homing, it would be nice to be able to do this as precise as possible.

If you need it I may send you an xmls file with full AGCM4 pin map. You will see there interrupt vs pin. Only 16 interrupts are available and these are scattered in all chip pins.

Thank you, that would be great.
I use several email adresses, but MrAlvinDude@gmail.com will be good for RAMPS issues.

GMagician commented 4 years ago

Last time I looked into this issue, was years ago, and back then, the firmware checked the state of end-stop before every single 'step' puls to a stepper.

This have been changed, I some months ago (more than 6 I think)

Thank you, that would be great.

I'll send it this evening. You will find arduino pin mapping, connected samd51 port, interrupt available on pin, on ain pins, adc nr a index connected to pin, timer (and timer channel)... Some pins have more mapping (eg mosi) you will find them in a nn/nn notation. All this have been done to develop board integration and to check "on the wild" shield compatibility (only RuRamps and Ramps-FD)

GMagician commented 4 years ago

oh, I forgot, thanks for this "exchange of views"

GMagician commented 4 years ago

@MrAlvin about a possible security issue...on reversed main power supply.

I've talked with expert guy for my design...I admit I'm copying some solution from different boards...let's say: you have 2 fuses on main power. If you connect reversed power on connector one fuses will burn, the other no. Now you have 24V on GND, and GND on 24V. This last gnd will pass through diode to the mosfet. Result: Bed always powered! This may considered not to dangerous since fuse may only ber used to protect electronic and since "someone" should notice that something is not working, then it will turn off immetiately power... But I think it's correct you know...

GMagician commented 4 years ago

Another doubt, about thermistor temp. reading. Won't 20K resitor change tension seen on the pin? If this occurs all Marlin tables have to be changed and that's not good

MrAlvin commented 4 years ago

It is always good to evaluate worst case scenario.

Well, I mainly use fuses to protect wires and connectors. These items are typically close to plastics, and plastics will burn, if over-heated.
My limited tests and limited experience about protecting the electronics, using fuses, have not been optimistic.

And reverse voltage is simply a bad situation, and one that gets "expensive" to protect against, when higher currents are involved.
"Expensive" as in: heat, components and/or PCB real-estate.

I think this is one of the reasons that the mosfet being used in the RAMPS 1.4 design, was the one it was. Because it probably has built-in reverse voltage protection. [EDIT] hmmm.... reading the datasheet of the STP55NF06L (used in the original RAMPS 1.4) I can not find any mention about any 'buil-in' extra protection elements, that some select mosfets are known to include. For examples, see: https://reprap.org/wiki/Protected_Mosfet [/EDIT]

So what to do about reverse voltage protection?

The simple methods will primarily protect against prolonged expose to the reverse voltage situation.

So for the reverse diode protection method (that is meant to blow the fuse), it is most likely that reverse voltage WILL blow something else in the design as well - even before the fuses are blown, by the reverse didode placed to blow the fuse.

With the power supplies typically being used for 3D printers, it is almost guaranteed that the little fuse (5A) can be blown. It typically takes a burst of about 50-75% 'over amps' (more than the fuse current rating) to quickly blow a fuse.

So it becomes difficult to ensure that the bigger (12-15A fuse) can even get blown by the power supply.
A 15A fuse will for instance typically need a 23-27 amp burst. So unless a 30A power supply is being used, it is more likely that the power supply over amp protection will simply limit the power supply output. Hopefully it will shut down the power supply, and not go into an low power - high power fluctuation cycle mode.

I did do some limited tests to see if the reverse diode over the fuse, was able to blow the fuse. As I recall, I tested on three or four different types of fuses, all 5A fuses. And they were all blown.

But you have sparked my interest to repeat the tests, and this time do more repetitions.

About you specific scenario, where one fuse survives, and the heated bed is powered up for an extended period of time.

It seems to me that the weakest link in that chain is the flyback diode. So that diode is likely to blow, and thus alert the user that something has been done wrong.


So generally speaking, it is simply a bad idea to connect the main power the wrong way around.

And trying to fully protect the user against the reverse voltage scenario, is just not simple or easy, when dealing with high amp systems.

MrAlvin commented 4 years ago

Another doubt, about thermistor temp. reading. Won't 20K resitor change tension seen on the pin? If this occurs all Marlin tables have to be changed and that's not good

I had this concern as well. But we are measuring voltage. And in theory, no current is flowing through the 20K resistor, and thus there is no voltage drop across the resistor, so it does not influence the voltage reading.

The test I have done so far, indicates that with a 10-bit resolution, this is how it is in practice as well.