Maslow Home Maslow Community Garden Newsletter

Need help with pins on alternate BTS7690 Motor Driver

Greetings!

In my journey to build a Maslow of my own, I had trouble sourcing the PC board for the 5206 drivers. I then came across these

Double BTS7960 43A H-bridge High-power Motor Drivers. The amp specs looked very good. I think I even read a reference to them in the forum. (Marcina Barbarzynca) has a Diagram of them being used, but I’m not clear.

https://easyeda.com/polaski/maslow-cnc-shield-v2

So now I have 3 of them and would really appreciate help in wiring them up. Figuring out which pin goes where.

Datasheet (https://www.handsontec.com/dataspecs/module/BTS7960%20Motor%20Driver.pdf)

So, The side with the screw terminals go to the motor and 24v psu. check.

There are 8 other pins. 5v and ground (I can do that). check

Then they list:

Control Input Pin Function:
1 RPWM Forward Levelor PWM signal, Active High
2 LPWM Reverse Levelor PWM signal, Active High
3 R_EN Forward Drive Enable Input, Active High/ Low Disable
4 L_EN Reverse Drive Enable Input, Active High/Low Disable
5 R_IS Forward Drive, Side current alarm output
6 L_IS Reverse Drive, Side current alarm output

I’ve read 2 of the pins are not required.

So, I could really use some direction which of these 6 pins (or 4 pins) to the Pins on the Mega? (obviously for all 3 motors.)

Thanks

Max

bts 3

So, What I have been able to deduce from that diagram:

Just need help to getting which pin over to the Driver boards.

ARDUINO PIN

LEFT

44 In5 (To Motor controller?)
43 In6
43 EnC

35 5A (Encoder)
34 6B (Encoder)

+5v
GRND

Z

41 In3 (To Motor controller?)
40 In4
39 EnB

31 5A (Encoder)
30 6B (Encoder)

+5v
GRND

RIGHT

38 In1 (To Motor controller?)
37 In2
36 EnA

29 5A (Encoder)
28 6B (Encoder)

+5v
GRND

I was just digging in the firmware for a different problem I’m having and was looking at what you are after in the System.cpp file.

There are 6 versions of shields out there (at least in my firmware - once I get the 5th shield working, it will be submitted as a pull request), each with a different pinout for encoders and control pwm output. What matters is that the outputs that require pwm are kept on pins that the clock can be set. This is a copy of version 1.1. your encoders don’t have to match exactly, but the (in)123456 pins need to be used for motor chip control input pwm where the pwm frequency divider can be changed to get the right clock speed for the pwm the motor control chip can handle. I’m messing with that right now, so I’m pasting this from that file with some edits

//PCB v1.7 Detected    --- yours would be 1.7
 //MP1 - Right Motor
    encoder1A = 20; // INPUT  --- from encoder movement
    encoder1B = 21; // INPUT  -- used with A to determine direction
    in1 = 6;        // OUTPUT  ---out from mega to motor control speed /direction input
    in2 = 4;        // OUTPUT  ---- same as in1
    enA = 5;        // PWM    ---- this is for feedback to the mega for errors most chips don't use it, but may need it for acceleration control when that becomes a thing  

   //MP2 - Z-axis
    encoder2A = 19; // INPUT
    encoder2B = 18; // INPUT
    in3 = 9;        // OUTPUT
    in4 = 7;        // OUTPUT
    enB = 8;        // PWM

    //MP3 - Left Motor
    encoder3A = 2;   // INPUT
    encoder3B = 3;   // INPUT
    in5 = 10;        // OUTPUT
    in6 = 11;        // OUTPUT
    enC = 12;        // PWM

    //AUX pins  ---- used for spindle power / speed, touch, laser, etc.
    aux1 = 17;
    aux2 = 16;
    aux3 = 15;
    aux4 = 14;
    aux5 = A7;
    aux6 = A6;
1 Like

Thank you, I just printed this out as a reference. I’m pretty familiar with stepper drivers, less with these DC motor drivers. I understand the drivers are getting PWM signals to drive the motors.

I was going to perfboard the 5206s, but after figuring out the extra cost for resistors, caps, connectors, heatsinks. These BTS7960 only cost $3-4 each on Aliexpress. I’m going to add some heat sinks to the chip tops. They have huge heat sinks underneath the board.

Yes!, I will have the first 1.7 Maslow Shield!!:slight_smile:

PS:

This was also very helpful. I Though the enA was the ENABLE pin. So it is feedback from the driver. If applicable. So, the enable pins on the motor controller would just be set HIGH.

" * *enA = 5; // PWM ---- this is for feedback to the mega for errors most chips don't use it, but may need it for acceleration control when that becomes a thing * *"

1 Like

use pins 22-26 to have the firmware autodetect your 1.7 shield so it will play nice with all the other ones and you don’t have to have custom firmware, just an updated version everyone can use.

1 Like

Will do!

Thanks

Just so I understand, pins 22-26 are only 5 pins? Would these be pins to drive the motor drivers?

you make a binary number with those pins to tell the mega what the board number is, so it loads the correct pin profile. Search all files for getPCBVersion() in system.cpp and it details the pins it looks at to determine the board version. Once the board version is detected (it announces it in the webcontrol/groundcontrol console) then it will load the correct motor movement pins based on that number coded by which of those pins are pulled to ground.

EDIT: after looking at the getPCBVersion, you will want to have it report as 1.8. TLE9201 is 1.7. 1.5 is easbay (1.5b) TB6643. 1.4 is TLE5206, 1.1-1.3 are L298’s

" * *enA = 5; // PWM ---- this is for feedback to the mega for errors most chips don't use it, but may need it for acceleration control when that becomes a thing * * "

I misled you on this one. For the L298, the enA was the pwm output as well. It needed 3 control pins. The only board that used those as a feedback was the one with the TLE9201 and it is very rare, but it was the one I was working with, so was true for that one. In most cases, the enA,B,C pins are pwm outputs.

Thank you very much! You have been very helpful.

Max

1 Like

Orob!

Just circling around. Am I looking at the wrong version of the firmware?

You mention I should look in system getPCBVersion my BTS7690 should report as 1.8?

I use the webcontrolcnc firmware repository for my pull requests.

Based on the file you quote, it appears that 1.8 would be the next board, but I know of one other individual working on a board and he is using 1.8, so if you can do 1.9, that might be ideal. What do you think @jonatpridesleap? @bar?

@Orob,
Thanks for the heads up, please pardon my frustration.

ALL,
Is there anyway to lay claim to a hardware version number? This would be the second time I’ve had to change my design in order to reflect a version number change. The problem I am running into is that there is no real way of knowing what version numbes are available and it seems to be a race to get one claimed and merged into a branch. Making this change would make for the fourth batch of prototype boards I’ll have to order from China and build in order to test. With the requisite components this is becoming a bit expensive and time consuming. I’m at the stage where I have fianlized the Eagle designs, tested a prototype in Alpha (currently on the Beta), and am almost ready to build my Community Garden page and release the design.

I’m ok with changing the design again but If I do I think I should lay claim to v20, or some number not next in the que, just in case there is another project out there.

EDIT:

EVERYONE, please pardon my frustration. This is a situation of no ones doing. It just happened this way. If there is anyway I can keep using v1.8, I would greatly appreciate it.

@jonatpridesleap I was trying to say you had claimed 1.8 and the author of the previous note might go for 1.9. But it is good to get this numbering out in the open so we all know.

@Orob, that’s how I took it so no worries. Ultimately, I’ll do whatever needs to happen. I didn’t want my words to be construed as a rant against you or anyone else for that matter. I’m really not that upset. I was just hoping to make a case to not have to change my design and go through another builld/test iteration again.

Sorry, I guess I’m misunderstanding things here. I started this thread. I wanted to use these BTS7890s I had. Just wanted some help in making sure I am wiring them up okay. And they work with the firmware.

Back in April, my understanding the @Orob offered to add the BTS7890 to the firmware, and all I had to do was configure some pins on the Mega to let the Firmware know I was v1.8. And that would make the pins work with the BTS7890s.

This has been a long term project, so I was in no rush.So I came back to see if the BTS7890, had been added. I went to the repository to check the firmware and didn’t see any updates in system.cpp. Maybe it was in a different branch.

My Arduino skills are limited. Mainly setting up 3D printers and Marlin. I can edit and compile in Platform.io.

Now I understand that the inclusion of my BTS7890s would not be found in the firmware itself, but in WebControl repository?

So, my question, is there currently a way to configure WebControl, etc to work with the BTS7890s?

I’m not that concerned about automatic pin configuration. I’m more than happy to wire these to what ever Mega pins will work.

Thanks

Max

Max,

The firmware, not webcontrol identifies the motor shield attached to the mega controller. Webcontrol identifies the firmware version and sends the gcode commands to the mega. The firmware running on the mega must identify the shield version so it knows how to configure the control pins to run the motors as it interprets the gcode sent from webcontrol.

I think that once you get a pull request in putting the number into the firmware it’s yours. It’s nice to be aware of who else out there might be wanting a number down the road, but putting it in the actual firmware seems to me like the way to make it official. Let’s get you 1.8 locked down so you don’t need to change again.

Got it. I’ll submit the pull request to @bar to confirm my changes to the master and lock in v1.8

@Orob, do I need to submit a pull request for the WebControl changes as well or will the changes for my board be included with the changes you are currently making?

1 Like

To add to the firmware, you can choose the webcontrol or maslow firmware. They are “related” but to get one to update from the other, you have to PR from one to the other. The firmware included with webcontrol are held in the webcontrolcnc/firmware repository that is a branch of the maslowcnc/firmware repository. The webcontrolcnc/firmware repository has more features in it currently than the maslowcnc firmware save the eastbay update. There was no movement on the maslowcnc/firmware for such a long time that the webcontrolcnc/firmware repository was getting all the updates. it has radius support now and it has z axis limits and it will have spindle speed control. I would suggest forking from webcontrolcnc/firmware repository and then branching. make your changes, then PR back to the master branch. Once you do that, there are several who will get an email message to review it and check over your updates.

1 Like