Order nearing completion… these pictures still from the Fab, unfortunately. But I should have them in my hands end of next week.
Received my board today.
The MagneticSensorSC60228 sensor class seems to work right out of the box! Received reasonable angle values that could be affected by a magnet
Haven’t had time to test the close loop performance just yet.
That’s fantastic! I guess integrating directly on the PCB and avoiding any bad manual test connections really makes a difference. The gamble paid off!
What is the bigger motor/module the board is for if not a secret?
The board is designed to actuate the pitch system of a lightweight wind turbine we are currently developing https://www.kickstarter.com/projects/kitex/wind-catcher-portable-power-generating-wind-turbine
The system needs to be low cost, low response time, little wear, energy efficient and closed loop.
Nice sailing wish you all the best.
My boards finally arrived Thursday. That’s a full 8 days after yours did, @Valentine .
I’ve today got round to testing them.
First thing to note is that I had an error regarding the bit-order in the code, which I have fixed and pushed to the dev branch of the drivers repo. The sensor now outputs very reasonable looking values, and seems to be working well.
Further good news: it seems to work quite nicely with a small gimbal motor, which is spinning nicely on my desk (velocity mode).
Thanks.
There were indeed some bit issues. Now I have velocity control working as well. However it seems that the sensor is slower than the AS5147. (Unless something else that I don’t get is going on).
Roughly speaking I was able to achieve 25 rad/s with standard settings using the AS5147.
50 pole stepper. With the SC60228DC only 12 rad/s.
A quick fix is however to advance the electric angle artificially. I think I have seen it mentioned before somewhere, but couldn’t find it? Like so:
I wonder it would make sense to make that a setting? Perhaps even a “time-delay” constant could be added to the sensor.
With the increased advance I’m able to reach the 25 rad/s without too much tweaking yet.
I think @Antun has to comment on that, but personally I don’t like this solution, since it seems a bit heuristic, and much prefer your suggestion of handling it in the sensor, since it is the sensor latency that we are assuming causes this.
It’s interesting that it is slower than the AS5047 - which requires reading 32 bits for a current angle value as opposed to 16 bits of the SC60228… that really indicates that the lag is in the sensor IC itself.
For getting even more speed, have you tried using the ABI mode of the AS5047? this should eliminate the latency of the SPI requests completely, leaving only the sensor’s own latency… There’s a driver for the STM32 hardware encoder in the drivers repo, which uses the encoder peripheral of the STM32s and doesn’t need interrupts.
25rad/sec is only 238rpm. I know that AS5047 is rated at 28000 rpm, so there is something going on with your setup to max it out at more than 100 times lower RPM. Chinese lie a lot but not that much.
Didn’t work in my case. Not sure what’s the problem, don’t have time to debug, later. It’s definitely the sensor because it works flawlessly with the AS5047P, then when I swap the sensor, it bumps and grinds and makes funny noises, then doesn’t move. This is how I call it if it helps. I’m posting only the relevant portions. Perhaps I’m making a mistake somewhere.
#include <SimpleFOCDrivers.h>
#include "encoders/sc60228/MagneticSensorSC60228.h"
// SENSOR SPI SC60228
// SPI2 PINS
#define CSN2 PB12
#define CLK2 PB13
#define MISO2 PB14
#define MOSI2 PB15
MagneticSensorSC60228 sensorSC60228(CSN2);
SPIClass SPISensor(MOSI2, MISO2, CLK2);
// Inside setup {
sensorSC60228.init(&SPISensor);
// }
I tried velocity and angle.
This exact same code works fine with the generic sensor code and AS5047P (except the constructor of course).
As I said, perhaps I’m making a stupid mistake somewhere, but don’t have time to debug now. If you see something strange with my code, like last time with the wrong PWM pin, please let me know.
Cheers,
Valentine
Edit: Also, I can read the angle if I run the debug branch code standalone, so the sensor alone works, but when I integrate with the closed loop, that’s where it breaks.
Looks great, I would like to see an encoder with a hollow shaft with the possibility of cable passage, slip ring etc. Do you have any tips or has anyone created something similar? I am interested in buying for my project.
I made a bit of progress with my setup. The comparatively poor performance I was seeing with the SC60228DC was most likely related to a poor electric angle offset calibration that had moved since I installed the stepper motors in their housing. I made second sample of my board and are now at 4/4 working perfectly fine. I will do a small secondary post/thread about the system performance.
hmmm… in my case the PID tunings were significantly different for this sensor than an AS5048A. I tested with a SAMD21 based board, it has about 3.3kHz loop iteration speed with motion downsample of 4 in velocity mode - all these things affect the tuning - I had to lower the output_ramp to 200.0 and increase the velocity Tf to 0.05. After a bit of playing around the motor was rotating quite smoothly.
Entirely possible, because I kept everything else and only swapped the sensor. The angle is clearly being read correctly, I don’t believe the sensor code is having a problem, but the setup is too expensive to use it to fine tune the PID for a $2 sensor. When I get the time I’ll test on a cheap motor. Thank you for the advise.
I’ve got an SC60228 that seems to be set to 2048 PPR, not 4096. I’m guessing I got the wrong model (although the markings are clearly 60228), or if there’s some register I need to set to get the full resolution.
To my knowledge this sensor doesn’t allow register access.
In that case, what gives? Maybe there’s a bug in the decoding, or something’s slightly off about the SPI config. I could solder leads on for my logic probes and do some pulseview digging, but I really have other things I’d rather do
I’ve submitted a PR that adds a cpr parameter to the sc60228 driver so my apparently 11 bit secret variant will work. Added CPR configuration option to SC60228 Encoder by josephduchesne · Pull Request #15 · simplefoc/Arduino-FOC-drivers · GitHub
I am from MagnTek. You can consult me directly for samples and technical questions. may email address is: weijun.mao@magntek.com.cn.
6835 is the latest magnet encoder we released, which can meet the needs for serve motor and step motor. We have some application notes to help yout to get a decent accuracy.
Hi @Roger_Mao , we are honored to have you here on SimpleFOC!
Several of our users (including myself) have been working with your sensors, and we have written some drivers for Arduino for them too:
https://github.com/simplefoc/Arduino-FOC-drivers/tree/master/src/encoders/mt6701
https://github.com/simplefoc/Arduino-FOC-drivers/tree/master/src/encoders/mt6816
I look forward to trying your MT6835 sensor, although the calibration procedure looks a bit scary
One question that has been raised for the MT6801, and is not clear from the Datasheet: does the ABZ interface need pull-up resistors?
Thank you and best regards!
Mr. Mao Weijun:
Thank you very much for reaching out to us. We are interested in your sensors. It will be very educational and productive if we know more about them. We will contact you directly about details.
Respectfully,
Valentine