Circuit design check and pull-down resistor question

I have an LN298 I'm using to drive a NEMA 17 stepper motor which is powered by a 12V/29A supply. I'm planning to use the LN298 5V output to power a NANO that will also provide the control input to the LN298. The stepper motor is being used for a syringe pump and will be used in occasional short movements, so there will be very little power consumption. I also have a protoboard with a 5V power rail and a ground rail between the LN298 and the NANO. The protoboard will have input for two buttons to manually move the syringe pump backwards and forward, and will have two reed sensors acting as limit switches. I'm using 1Kohm pull-down resistors for the switches. Finally, I'll be triggering the syringe pump with a high signal coming from a MEGA that probably won't have a common ground and be powered by a USB. Here's an schematic of my planned set-up:

Beyond a general check from anyone who'd like to share input on my design, I have a few questions:

  1. Will a 1Kohm resistors be fine here or should I use a larger resistance? Also, what's the smallest wattage resistor I can use in this situation? How do you figure these things?

  2. Do I need diodes on my ground between the protoboard and the 12V supply and LN298?

  3. I will have four of these (schematic) setup as individual modules with their own 12V power supplies. My question here is will the MEGA need to share a ground with all of the modules or be fine not sharing a ground.

  4. Bonus question: I left this out because I thought it would make the above too complicated but each individual module circuit will also have three BTS7960 motor drivers controlled by three respective NANOs. The NANOs will be powered by a 12V to 5V DC buck converter in this case. My question here is will my ground be ok between all these devises? Do I need diodes anywhere there's a motor driver and a shared ground? If so how do I figure out what kind of diodes to use? Finally the MEGA that isn't sharing a ground and powered by a USB will be signalling all of these guys with a HIGH signal. Will the MEGA not sharing a ground be ok?

-RG

If the Mega is talking to the Nano you need a common GND.

1k is fine for a pull down resistor, so is 10k.

Why not have the the switches going to GND then use the internal pullup resistors turned on. ?

5v ÷ 1k = 5mA

Wattage (power) = 5v * 5mA = 25mW resistor (V * V / R = 25 / 1k = 25mW) See ohms law ;).

Diodes where ?

12V goes to the buck converter therefore the 3 Nanos will share a common GND.

Why would you use switches to +5 rail and pull-downs?

Its MUCH safer and better practice to connect your switches to ground 0V and use pull-ups.

Safer because your ground rail should be distributed and common anyway, which your Vcc should not. Also less susceptible to interference, especially if you add a small capacitor to debounce.

Also simpler as you can use "INPUT_PULLUP" and dont need any external resistors.

If you REALLY HATE the inverted logic just use normally closed switches.

FOr a fuller explanation see my page here

  1. Will a 1Kohm resistors be fine here or should I use a larger resistance?

It depends on the electrical fields in the area. If you MUST use that configuration I'd advise adding protection resistors or diodes in the Vcc rail

Also, what's the smallest wattage resistor I can use in this situation? How do you figure these things?

5V 1k = 5mA 5V * 5mA = 25mW. (or W = V^2/R)

  1. Do I need diodes on my ground between the protoboard and the 12V supply and LN298?

NO you create major problems if your ground is not common

  1. I will have four of these (schematic) setup as individual modules with their own 12V power supplies. My question here is will the MEGA need to share a ground with all of the modules or be fine not sharing a ground.

YES you MUST have a common ground unless you use some sort of isolated signal (gets complicated).

Hi,
What are the specs of your stepper, NEMA 17 tells us its shape, not power rating?
Get a fuse on each of your 298 before a short to the 29A supply destroys your project.
Rate the fuse according to your stepper power requirements.
Are you controlling current limit on your 298?

Are you using a LN298 IC or a module?
If a module can you post a picture of it and/or a link to its specs.

Tom.... :slight_smile:

Thank you for the quick replies.

@larryd & @johnerrington, whatever logic that works neatly is fine. I wanted to avoid using the internal pull-up resistor to minimize power consumption, but I suppose that's silly in this case since I'm not running off a battery and power consumption is extremely small from the internal pull-up resistor.

@TomGeorge The stepper motor is power rated at 1.5A 12V 45Ncm. I'm using a module, this omnipresent devise:


I suppose the one I got off Amazon is the same as the one on this spec sheet. I'm still going through the process of learning how to fully use it. Can I limit the amps to this thing from the arduino? Also, I'm using a Mean Well LRS-350-12 power supply.

I don't completely understand what's happening in a ground beyond a simple circuit with one voltage source. What protects the NANO from the 12V supply when it's sharing a ground with a 12V supply? From the point of view of the electromagnetic field that's generated, how come the 12V field running through the wires doesn't mix with 5V field? This is why I was uncertain about the wattage being simply derived from ohm's law for the pull-down resistor when there's multiple voltages associated with the common ground.

Anyhow, do I need to be worried about back current from a 12V device like a motor? Does the internal circuitry of the LN298 and BTS7960 keep the rest of the circuit protected from the motors they control dishing out any kind of back propagating transience? When does literally driving a copper rod into the floor for a ground need to be used (I used to do with CNC machines in a past life)?

Hi,
Thanks for the info.

That module has no current limit, so a 2.5A fuse will be needed.
Modules schematic.


Tom... :slight_smile:

ryangrg:
I wanted to avoid using the internal pull-up resistor to minimize power consumption, but I suppose that's silly in this case since I'm not running off a battery and power consumption is extremely small from the internal pull-up resistor.

It is completely silly in every situation as choosing pull-ups or pull-downs would make no difference whatsoever. :roll_eyes:

But if you were concerned about current consumption for battery operation, the internal pullup is an important part of your design given that you put the microprocessor to sleep because the internal pullup can be turned off until the moment when you actually wish to read the switch and then off again after reading it.

You can of course do the same by dedicating an output pin to which to connect all the external pull-ups.

Hi,
Can you tell us what the overall application is?
Why do you need a NANO for each motor controller?

Can you please tell us your electronics, programming, arduino, hardware experience?

Thanks.. Tom... :slight_smile:

I don't completely understand what's happening in a ground beyond a simple circuit with one voltage source. What protects the NANO from the 12V supply when it's sharing a ground with a 12V supply?

The +12V rail is not connected to the Nano; look at the schematic, the 12V rail goes to a 5V regulator, which provides 5V to the nano.

Read what Perry says about common grounds here

From the point of view of the electromagnetic field that's generated, how come the 12V field running through the wires doesn't mix with 5V field?

The magnetic field generated by small dc currents running in wires is tiny. (eg Maxwell 1831)
Also a STATIC magnetic field doesnt cause inductive coupling. Transformers dont work on DC.

Lets not get complicated, and just say unless youre dealing with RF you dont need to consider electromagnetic fields. (OK its "lies to children" - but mostly true)

The overall application is a rodent behavior maze that is 2m x 2m square, with the midpoints of the outer track connected by a cross track in the middle. It has 16 barriers that are moved up and down with linear actuators. These are controlled by the BTS7960 modules. It also has 4 syringe pumps to deliver reward, these are controlled by the LN298. The syringe pumps are at the corners of the maze and groups of 3 actuators are at the midpoints of the outer track segments, with a group of 4 actuator in the middle of the cross. Each group of actuators will have its own power supply in a control box with the necessary microcontrollers and drivers in it to run that module. The syringe pumps will share a power supply with the module of 3 actuators as mentioned above. Here's a picture without control boxes and syringe pumps.

I have all the NANOs for two reasons. One there isn't enough output from a MEGA to control all this stuff. Two, I want the MEGA to be focused on receiving serial data from a computer and subsequently telling the NANOs what to do based on what serial input it receives. The computer is running motion tracking software that follows a rat on the maze, how the maze is configured -up and down state of the barriers and when reward is delivered - is determined by where the rat is on the maze and what choices it's made at intersections on the maze.

I'm an experienced programmer but new to Arduino. I also have experience with C, C++, python, matlab, whatever I need to use for the situation. I've read through Simon Monks, Programming Arduino as a simple start. I've programmed the control for the linear actuators and they work nicely. There's a post some of you helped out with on that process, thank you! Write now I'm working on the syringe pumps, then I want to move on to the serial input. I plan to avoid serial output to the NANOs from the MEGA. Maybe I will for serial output to the syringe pumps but not sure yet. The actuators just need a go up or go down signal, but syringe pump could benefit from a string(char array whatever) that tells it how much volume reward to dispense, I could also just fix it to one volume and send it multiple go signals to have it deliver the volume I want.

Also, I'm now trying to figure out how to make a ground rail that connects all this stuff.

@Johnerrington Yes the 5v goes to the NANO but it also shares a ground with the 12v. Why doesn't the 12v loop mix with the 5v loop? I was referring to electric field mostly, yes the magnetic field is tiny. Thank you for the Perry reference, I think I read that before but it's time to revisit it!

What does “mix with” mean ?

@larryd Hah! What do I mean? I guess I mean the currents.

There are probably some electrons that fly around between the two.


You are looking for something that is not a problem.


Worry more about inductive spikes.

I was referring to electric field mostly

Our old house had 130kV AC cables almost directly over it. No issues.

Dont think 5V will be a problem

Use to worked near 500kV lines, now only glow in the dark slightly.

@larryd Where are the sources of an inductive spikes that I should worry about and should I do to protect against them? I was thinking that I didn't have to worry about anything from my actuators because the dual h-bridge module I'm using has diodes in it. Also, I thought my driver for the servo motor is protecting the rest of my circuit too. Is the main source of a potential inductive spike the power supply failing?

The H bridge will have appropriate diodes designed in. D1-8

Keep external wiring short and motor wires physically away from digital wires.

Does physically just mean not touching? That shouldn't be a problem with the actuators but will take a little more care with syringe pump. The power wires to my actuators would be about a foot long, is that too long? Should I have some kind of diode at the motor?

The one place I can't avoid having longer wires is from the MEGA to all the NANOs for the signalling inputs, longest would be about two meters maybe four. Would using shielded wiring work fine in this situation?

So, I'll have five 12V/30A power supplies (I mentioned that already right). These need to all share a common ground? This would end up being a lot of wire as they will about a meter apart. They'll be set up on the nodes of the plus, one in the center and the other four at the ends of the cross portion of the maze. Do I have worry about ground loops in a DC circuit? What about the usb power the namo and send signal info from the computer?

Is there a book that covers this kind of stuff with arduinos?

-RG

The higher current carrying and motor wires should be kept (routed) away from signal wires.

Look at using star point grounding for ground connections i.e. avoid daisy chaining grounds.

‘If’ and ‘when’ you experience problems with inputs, you may need to add input conditioning.