On my out the door but had to respond .....I agree ..... I have a second IBT-2 to play with ....... when you design your meter let me know and I will build one and play along .....
It's not one I designed. It's one I found ready to go. http://www.ndholmes.com/pmwiki.php/Electronics/DCCMeter I'm just waiting for the slow boat from China.
Hi, I'm planning to add a 8 channel relay to the motor shield sitting on top of a Mega, should I use a 5V 8 channels module or should I use a 12V 8 channels assuming I've cut the VCC in on the Mega and supplying 12v power directly to the motor shield?
Hi Norm quick question ..have you ever run into a situation where a rotary encoder increases both from clockwise rotation and CCW rotation ... wiring has been checked and rechecked and it's the same sketch that works correctly in all my other throttles. Any hints? Steve F
Turns out it was a bad NodeMCU module not a problem with the rotary encoder. Thanks to those who responded. Steve F
Just to clear this up. I put a 270pF capacitor across the optoisolator input pins and the problem went away - a wee bit of noise on the signal did a lot of damage. Now I just need to get Extended Accessory Protocol working...
Last night i spent significant time on this current measurement code. To me it seems, that the formula: current=analogRead(pin)*CURRENT_SAMPLE_SMOOTHING+current*(1.0-CURRENT_SAMPLE_SMOOTHING); does only smoothing (https://en.wikipedia.org/wiki/Exponential_smoothing) I found actual AMP measurement has to be done like this: current=2.96*analogRead(pin) then current would contain the actual milliampers. This of course is onyl true for the Motor shield from arduino, since by specification it will output 3.3V on the current sensing pin when 2A are reached. From here, one can see that the analogread should return 675 when 2A arereached, thus it means 2.96mA per number (2 devided by 675 gives this number =0,002962963 A~2.96mA) For Pololu MC33926, specs say: Current sense voltage output proportional to motor current (approx. 525 mV/A; only active while H-bridge is driving) which means that if we have 3A, then the voltage on current sensing pin should be 3*525=1575mV=1.575V Then the analog pin should return us 1024*(1.575/5)~322 as number I did stall motor tests and it shows that above is correct - for arduion MD correct way of measuring current is multiplying the analogread number with 2.96 to have current in miliamps. For pololou obviously, the number should be 9.32mA (3 devided by 322).
Maybe check this post of mine: http://www.trainboard.com/highball/...tion-and-interface.84800/page-84#post-1018413 Might be helpful for your case?
Thank you! Though the math does nto account of the fact that the motor shield caps at 3.3V when 2A is drawn, thus maximum read from analog input is 675 as number.
As per specification - https://store.arduino.cc/arduino-motor-shield-rev3 On documentation tab: " On each channel will be a voltage proportional to the measured current, which can be read as a normal analog input, through the function analogRead() on the analog input A0 and A1. For your convenience it is calibrated to be 3.3V when the channel is delivering its maximum possible current, that is 2A. " and since max current for this MD is 2A, it means that maximum voltage would be 3.3V output. Analog read gives 1023 when votlage is 5v and 0 when it is 0, thus 3.3V max, means analogread max gives 675.
I think you understand this incorrectly: the voltage on the current sense is not "capped" at 3.3V but calibrated at 3.3V for an output current of 2A. This means that if the current goes higher than 2A, the current sense voltage also increases above 3.3V
For this MD, it cannot go over 2A, 3.3V respectively. (except short circuit, which would make it straight 5V).
Right. But if you use other motordrives capable of higher currents it is useful to know the current to current-detection-voltage conversion formula.
This agrees with the post I made http://www.trainboard.com/highball/...tion-and-interface.84800/page-86#post-1041300 Jim
So right now I'm running a basic motor shield but i would like to upgrade before i start building my full layout. I wanna stick with DCC++ or use ESP version but i am curious if this particular H Bridge will work. It is one of the only high powered ones i have seen with current sense https://www.amazon.com/Dikley-Dual-...48DM3FZ6BH5&psc=1&refRID=NB8KPM73948DM3FZ6BH5 There are other ones similar with lesser amperage. but they all have the CT pin which i thought was important for being able to program.
Deek Robot folks, any better luck with them? Or just don't short them? And I had read that the short detection in the Pololu kicked in before the current sense in the sketch on the Uno/Mega so everything has to be powered down and brought back up again after a short to get things to sync up. Did anyone create a workaround for that?
Dex look for "My Experiments with DCC ++" or "A High Power DCC Booster". Locoduno also have an other option (3Amp) including the 2 standard motor shields. In one of the recent posts on this forum there is an explanation why most of the motor shields have a problem working with DCC++ Flightrisk have a look at Locoduno's 3 page of his DCC++ His Pololu setup is the last one on the page.
I'm about to wire my first simple DCC++ setup using IBT-2 module, as per http://trainelectronics.com/DCC_Arduino/DCC++/. Looking at IBT-2 connections, it appears its pins 3 and 4 control INHIBIT signals of BTN7970s. So pins 3 and 4 are both tied to VCC which means that the bridge is enabled at all times. I would rather have pins 3 and 4 both controlled by Arduino's pin 3 (SIGNAL_ENABLE_PIN_MAIN), so that track power is properly controlled with <0> and <1> commands. Has anybody tried this?