Thoughts on designing a new controller

I think it would be better to use the non-SPI Version if the SPI registers won’t be reachable. It looks like connecting ‘Mode’ to DDRV, and a ¿10k? or ¿50k? pull-up from DDRV to ‘nSleep’ would take care of the chip.
It would be nice to have a chip on the bench to check this out. Do you have access to one of the dev boards?

1 Like

@bar, this controller isn’t capable of replacing the controller in the existing maslow system, correct? Besides having to port over the current firmware to esp32, the encoders inputs are not compatible with the motor mounted encoders… correct?

1 Like

I think the hardware version wants to be strapped like this:

  • In order to set the 6.5A current limit on the hardware version, the nITRIP pin needs to be tied to DVDD.
  • To set the PWM mode on the hardware version, tie iMODE to DVDD.
  • nSLEEP needs a pull-up resistor to DVDD to activate the hardware version instead of sleep mode.
  • the iPROP signal is a PWM waveform in itself, with a pulse width proportional to current. That makes sense since it is following the current through the H-bridge, but means that the signal needs to be integrated to be readable as a voltage. Here’s a section of a TI reference design, showing the idea as ‘ISense8873’ (see page 8).
2 Likes

I played around with one of these:

But I found it to be pretty heavily set up for their demo software. By removing a couple resistors I was able to disconnect their micro and patch in my own to get it running, but it still wasn’t an ideal test situation.

My thought on what the next step for testing is was to have a small run of boards made by https://macrofab.com/ . I would like to at least explore working with them for a larger production run down the road so having them do the prototypes would be a good way to explore what works and what doesn’t. If I had a few made would you want one?

That is super interesting. I missed that entirely in the datasheet. Is there any reason we shouldn’t read the pulse width using the GPIO instead of filtering it? The signal might be pretty noisy so a filtered analog version might be better anyway.

1 Like

That is correct. My goal is to take all of the lessons we have learned and design an entirely new machine from scratch with what we know now. When we were designing the first one basically nothing was know about this type of CNC, but now that we have some experience I think it is a smart move to start from a clean slate and think about what we can do better.

3 Likes

Glad to hear you’ve got access to one of those. I’ve got the DRV8873H hardware version of that unit, and hooked various Maslow motors up with a 12V supply.

If you can, hook a scope to the iPROP signals on the board to see what they look like. Analog filtering would be affected by the PWM frequency.

To measure the pulse width with a GPIO would benefit from adding a buffer (74HC7014 for example), as the PWM trace amplitude jumps quite a bit. The ESP32 MPWM hardware input capture function might be useful for the measurement.

1 Like

Very much! :fire: I’m willing to hand populate a few bare boards if you like. Looks like you’re not using any cruelly-tiny SMD parts :grin:

1 Like

Reading further on the TI support forum, nSLEEP should be connected to an external 5V signal.

1 Like

Fantastic!

It will take me a couple days before I an make changes to the board an contact the fab house.

If anyone else would like a board too, let me know. I think I will probably have 5 made so there will be some extras if anyone wants to test.

I tried to avoid the BGA packages :stuck_out_tongue:

It seems like the analog filter they have specd might be simpler and keep the cost down more. We’re probably going to need to do some software filtering anyway because the current signal is pretty noisy (and the time frame we need to respond in is very slow compared to the PWM signal). I am leaning towards doing the hardware filter with the resistor and capacitor.

What do you think?

Might be true.

There’s much to explore in the current sensing section. Scaling for accuracy at the low end on the current range (z calibration) vs the high end (tension measurement) needs thought.

How are you at filter design? Myself, not so much…:neutral_face:

1 Like

Do you have the esp32 grbl firmware working with four motors?

I’m down to test. And can even help populate boards if need be when it gets to production stages. I’m a boss with a hot air/soldering station.

I can use my 2nd Maslow for testing and wouldn’t disrupt my primary one.

2 Likes

I haven’t played around with it, but I saw that the esp32 grbl added support for up to six axis a few weeks ago which is exciting.

Fantastic!

I will let you guys know as soon as I have boards to test, but it might be a little while.

1 Like

@blurfl I am finally having a chance to read through all of your VERY helpful pointers while reviewing the datasheets.

Especially good call on the nsleep needing 5v thing. That would have been a show stopper. I’m going to have to figure out how to route that 5v in which will take a bit of reworking.

The iprop signal is a little bit tricky. The data sheet is pretty adamant that it is an analog signal:

But the reference design you posted (Thank you!:tada:) clearly shows them using filtering on that output and you have looked at it on the scope so there’s no doubt there is a pulsed signal there. I think what is happening is that we are actually seeing the current through the motor, but the current through the motor is pulsed because of the PWM drive signal. If the motor had HUGE inductance we would get a smooth signal filtered by the motor, but our motors are pretty small so we’re seeing the pulses come through. That makes it really hard to guess what the right filter values are because factors are the PWM frequency from the driver, the inductance of the motor, the power supply characteristics…etc. Basically I think we need to just leave ourselves some 0805 pads and play with different R and C values until the signal looks good.

Does that seem like a reasonable approach?

Edit: What are your thoughts on the preferred mode? Strapping for PWM mode is easy to do. I played around with my driver in PH/EN mode only. There doesn’t seem to be too much difference in the truth tables.

I’ve got a new version with what I think is the proper strapping for the 8873s and filtering on the iprop signals. I pulled the values from the Automotive Power Seat example for the filters, but we can swap those parts out as needed.

https://easyeda.com/editor#id=|b0f142c571f64e3fb4d01ad7853b6744|bebd02b1dde34a9093b4e1d87d0ebcbf

@blurfl and others, does anyone see any more changes I should make before sending these out for a version one?

True, that… If accurate current monitoring is important to the design, I strongly urge you to hook up a scope and run a motor under varying loads before spending money on boards.

This will surely be the case :grin:.

Have you played with the slew rate (SR)? You might want to make room for a resistor on that pin, with option to pull up or down? If left floating, it defaults to 13V/uS. Not sure how it affects the iPROP signal.

The PH/EN mode sets both motor leads high when IN1 is low, and doesn’t offer a Hi-Z mode since we’re not implementing DISABLE. The PWM mode puts both motor leads in a Hi-Z state when both INx lines are low or both leads high when both INx lines are high. I would favor the PWM mode.

1 Like

Good points about PWM control. The current design is strapped for PWM, I just wanted to make sure I understood the reasons we were choosing that control mode.

I will throw a scope on there tomorrow and take a look. I don’t think we need accurate current measurements in real world units (amps or kg/cm or anything like that) but I would like to be able to detect the motor stall point and see changes in the current draw accurately.

1 Like

I’ve made some progress on this by scaling the current monitoring and changing the ADC attenuation, but much will depend on the motor being monitored and the PWM frequency. Do you have particular 24V motors and power supply in mind? The DRV8873 Dev board uses 20kHz for PWM, what value are you using?

I was thinking something very similar to the current motors, but run on 24 volts. I got a confirmation from Eton that the motors we are using now can be run on 24 volts, although they warned that the gears can’t handle the torque the motor produces at that voltage. For the power supply I am thinking something along these lines:

https://www.amazon.com/Superpower-Power-Adapter-Supply-Output/dp/B01CYIFOHE

Although that particular model is just for testing. Something with roughly similar specs.

I was testing with a 1kHz PWM, but only because that was the default value for the library I was using. 20kHz is probably much nicer sounding so let’s start there.

How does the current signal look? Is it pretty noisy, or reasonably clean? I bet at 2kHz it’s going to look better than at 1kHz.

After more looking into getting populated boards I decided that you were right that it’s just too expensive in small quantities. I figure I’ll probably learn something by assembling them and testing as I go also.

So I’ve got some unpopulated PCBs in the mail which I can distribute as soon as they arrive. I’ve also ordered a bunch extra of the JST XH series connectors which are surface mount which can be hard to find so I will send some of those with the unpopulated boards to anyone who would like some also. I’m working on getting the rest of the BOM all organized and written out nicely.

This is the current BOM that I am working with. Forgive me if I’ve forgotten anything…which I am sure I have.

I already see one mistake which is that I placed an 0805 pad for a 1206 resistor…I think the pads are oversize enough to get it down, but we’ll see :frowning_face:

1 Like