NearZero support

I would like to use simpleFOC as firmware for a NearZero motor controller and 2 RoboWheels from https://skysedge.us/robotics/nz+2rw/index.html

NearZero uses the same half bridge driver IC as simpleFOC shield and adds a current measurement IC and onboard ATMEGA2560. It breaks out headers for PWM/Radio Control, I2C, USB, interface selection, ICSP, encoder or hall.

I’ve begun work on that today, but I’m not very good, so would appreciate any input.

1 Like

This is really cool information, and a cool board!
Honestly I think that the simplefoc library should work for this board almost out of the box.

What kind of problems are you having?
I am not sure if the library supports properly the Atmega2560 chip, I have not really tested it deeply. Any info would be really appreciated. :smiley:

No problems yet. I’ve only discovered simpleFOC today and figuring which pins numbers to use where.

Keep us in the loop, I’ll be happy to see the results!

First speed bump is the enable pins. NearZero uses all 6 (2 driver chips, 3 pins per chip) but the library only supports 1 enable pin per motor. I started writing a new constructor, but enable_pin is used several other places so I thought you might have a preferred way to handle it.

I could set enable_pin to an unconnected or virtual pin, poll it periodically in loop() and write the actual enable pins if it is HIGH. But that introduces lag which may foul things in unpredictable ways.

Hardware modification is possible, but undesirable for more than a one off situation.

You can call the constructor without enable pins and enable them manually in the setup() function.
They are enabled only once.

You can also change the library source if you wish, the result will be more elegant. :smiley:

The NearZero does a neat startup calibration routine that uses the current sensor to discover the equation for predicting delivered phase current from duty cycle. I’d like to keep that, and it uses the enable pins. This is going to be a fun code mashup where I write almost nothing new but copy paste 2 libraries into 1. What could possibly go wrong?

2 Likes