Comment on Current limiting
boojumliussnark@lemmy.world 1 week agoThat sounds very cool - and way beyond my own understanding :-)
Is this something you could actually help with sketching out for me?
I found the datasheet for the L298 and I can see that for my use (I am using just out 1 and out 2) it should be pin 1 (Sense A) that should be relevant, right?
This looks like it is connected to gnd on the driver board (I can easily cut this connection).
Unfortunately I don’t understand what a current shunt is? :-)
It has me slightly worried that it says that pin 1 can go to -1v which I think would break the ADC input?
As far as I can tell the ADC input on the PICO accepts from 0 - 3.3v right?
Thanks a bunch for looking at this!
cmnybo@discuss.tchncs.de 1 week ago
A current shunt is a resistor that can handle the full current of the motor. You would probably want a 0.1Ω resistor rated for at least 1 watt.
You measure the voltage drop across it to determine the current. The voltage will be quite low. With a 0.1Ω resistor and a 2A load, it will be 0.2V. You want to amplify that up closer to the full scale input of the ADC to get a decent resolution. An op amp with a gain of 10 would work well for that. Use a rail to rail op amp that can run from the 3.3V power supply.
Here is a schematic:
Schematic
R4, D1 & D2 protect the op amp input from any spikes the motor produces.
boojumliussnark@lemmy.world 1 week ago
Sorry I forgot to ask: I should cut the SENSE-A connection to ground right?
boojumliussnark@lemmy.world 1 week ago
Oh, wow!
Very nice! Thank you so much for doing this!
Is it correctly understood that the “Sense” line can be hooked up directly to the ADC input on the Pico?
Now, just because I am quite ignorant when it comes to all this, I will venture to ask: This is better because it is closer/faster/more exact than using the Hall current sensor, or? With my complete lack of understanding, I had the impression, that I could more or less “just” connect the sensor to the “right spots” and directly to the ADC input on the Pico, and my work in the Pico would be similar to this setup?
Don’t get me wrong - I can see this is much more elegant - and won’t be bothered by whatever else might use power on the same rail. But since it might be simpler for me to use a more “out of the box” component like the sensor, instead of my bad soldering of several discrete components… Also however ridiculous it might seem it is much easier for me to source 5 modules - than 5 of each of these components (I would have to buy many of each, and waste most).
So I have to ask. :-)
cmnybo@discuss.tchncs.de 1 week ago
The sense output from the op amp connects directly to an ADC input. The output is 1 volt per amp. If sense_a is already connected to ground, you will have to disconnect it.
The hall effect current sensor will work fine too. They do tend to have an offset, but you can calibrate that out in software. Just take a reading when the motor is off and subtract it from the reading when the motor is on. If you do use the hall effect sensor, you could connect it between sense_a and ground so it will only measure the motor current.
boojumliussnark@lemmy.world 1 week ago
Thanks again!
Does this look OK, to your trained eye then? Image