Go Down

Topic: Reading PWM from Ramps compatible boards (Read 108 times) previous topic - next topic

LucidWolf

Aug 09, 2019, 07:55 am Last Edit: Aug 09, 2019, 07:57 am by LucidWolf
Greetings,

I am just too new at this and the circuits i try to make to do this seem to fail me.

I first realized I had a problem when i connected the A2 nano pin directly to the ramps board and saw the red LED signaling the controller was on.  (I was thinking it would just be ground when the STP55NF06L was on)

I realized that with the pull-up resistor holding the pin to 5V there was a 7V difference because of the LED2 so 4ma of current (1.8K resistor) was flowing backwards into the Nano.  I don't think i hurt my Nano because the current draw was so low...  (Did I?)

I tried an LED, but just like the digital pin 13 on the nanos that has the LED i think its messing up my internal pullup and logic.  What would be a good solution for this problem.  

I have some 2N7000 and 2N3906 transistors on hand if they could be used as a gate between my nano and ground with an LED to act as the diode for reverse flow protection.

I feel i have confused myself reading datasheets and online tutorials...
What ever I learn here might help me to use pin 13 in the future.

Thanks for any help,
Lucid




LucidWolf

I think i am just overthinking this issue.

A 1N400X diode is all i need, the Vf is 0.8.
Either i burned up something or I have failure in my code reading the PWM, because this should work.

I am under the impression that Pin A2 on a nano can work as a digital pin and therefore has a pullup resistor built in.


Robin2

I can't understand how there could be a PWM signal in a RAMPS board unless it is put there by the Arduino. In that case there would be no need to read it since the Arduino would know what it was.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

LucidWolf

Yes RAMPS is a Arduino MEGA based shield for 3D printers/CnC applications.
The PWM signal is from the MEGA's D8 pin in this schematic that is driving a STP55NF06L.

I am attempting to read that PWM signal from a separate Arduino Nano that is controlling spindle speed.
I have the controller working manually, but cant seem for the life of me to read the spindle PWM.

I know i need a pull up resistor on my nano pin, then when the STP55NF06L is driven it should allow the Nano pin A2 to drop to GND.  Learned i need a diode there because of that sneaky LED...

Also the Nano and the Mega share the same GND connection from the 12V power supply. 

I did not see any noticeable voltage difference between +5V rails on the Mega or Nano... 
Don't really want to isolate them from each other because of board space with thru hole components.

I now think running a current backwards through the Arduino broke something.  Even though the Arduino seems to run fine.  Maybe I burned up just that pin.   ¯\_(ツ)_/¯

Robin2

Yes RAMPS is a Arduino MEGA based shield for 3D printers/CnC applications.
The PWM signal is from the MEGA's D8 pin in this schematic that is driving a STP55NF06L.

I am attempting to read that PWM signal from a separate Arduino Nano that is controlling spindle speed.
The Mega runs at 5v, just like the nano. If the nano GND is connected to the Mega GND I can't envisage any problem connecting the Mega OUTPUT pin to the nano INPUT pin. I suspect it would not even be necessary to use INPUT_PULLUP, but it probably would not cause any problem.

On the other hand, connecting the nano to the output of the MOSFET seems very silly, and unnecessary.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

LucidWolf

#5
Aug 09, 2019, 06:40 pm Last Edit: Aug 09, 2019, 06:42 pm by LucidWolf Reason: Img Linking
Ah yes would agree with you on connecting to the D8 pin directly over the MOSFET, but a lot of these RAMPS compatible boards now have the Mega built into the board with no attachment location to the Mega directly.  Also most firmware have the RAMPS standard as part of the pin-out so I think I am stuck with that MOSFET middleman.

I am measuring either a Fan connection or a heater/heat bed connector that is normally sinking amps of current not just being measured.

I originally was going to try and charge a cap with the PWM/12V signal then measure it with a voltage divider and that got ugly quick.  My original ordered PCB has been mauled quite heavily with all the learning about how to really make circuits.

Thanks for the help.

If anyone is interested here is my latest scematic and PCB layout.
Printed parts for the spindle controller are at:
Spindle Control and Power Box


Go Up