So here you can see. I have my setup. I have arduino uno the can shield and the connection of the can to solu uno and the motor here. So, as you can see here, the wiring of arduino to sword is pretty simple. There is only three wires and two of them are for the can line. Chan high and can low and one is the ground so its pretty simple. All the commands are coming digitally from arduino to solo. Then they are processed here and then they are applied to the motor. So you can see the motor now is following the profile ive made in arduino. These are the wirings of the motor. This is the wiring of the hal sensor of the brushless dc motor and, in this, video were gon na command from arduino uno through cambus. Using can open software layer to solo uno to control the speed of a brushed dc motor in a profile type of shape, so the speed will increase, decrease and bunch of commands that im going to show you later on in the code, and then we have also Here provided a brake system, so we can increase the torque on the shaft of the motor, so hopefully we can show you a better demonstration. The only thing you need to make sure about before running the code is solo actually is enclosable. You can achieve that by putting pin number five down, as you can see here, on the piano switch and the other things like if you are staying digital mode, they actually dont matter, but here im putting pin number four down to tell to solo if, in cases In analog mode goes into a speed mode that im going to operate in and then pin number one and two to be selected in a way that im selecting the normal brushes or pair of micro synchronous, motor, pressing key number one down and two on.

So this is the only thing that you need to make sure to have a proper piano switch setup. So now im going to show you how actually things are working and how actually we are sending commands from arduino through can bus and, as you know, arduino doesnt have a native canvas. You have to put a shield on top of it and the shield actually works with spi communication that is converted to can through a chip from microchip mcp family and the sheet that you see here is actually doing that. So the spr line of the arduino is sending the characters to the chip and the chip is converting them to the can to be sent to the canvas of solo. So the code is actually done through our extensive library for arduino. That includes uart and can open, and if you go to our github, you can find it here. You see the code that we have provided, includes the communication through uart and can open through the chips that ive just mentioned, and you can find also many examples for both of these communications for can open and you are – and you can see here, im kind of Including the the library of can open and beside everything, you need to make sure that the tuning and the calibration of your heart, sensors and the motor is done like written here. So the goal of the code that im going to show you later on is controlling the speed of the bldc here in some sort of programmed way.

So you see the code starts by defining an object, defining some critical parameters for solo, like the switching frequency of the the board, the number of poles of the motor, the current limit, the tuning of the speed controller gains kp and ki, and then it will start By initializing, the the serial port that is used for monitoring only in arduino and later on, it will go through actually initializing the can communication through the spi. So here you can see we have a chip select pin. That is the pin of the arduino that selects the uh actually chip select of the spi line of the the can shield, and we have the initialization of the can open with the address of the device address of solo there right now. The address of solo is set at zero or one if you set it at zero. Solo, considers it at one because it can open the address of zero is reserved for the host. So and then the code goes on by establishing the communication, putting all the parameters that are necessary on solo, as mentioned the pwm frequency on the switching frequency. The current limit, the number of poles of the motor defining for solo, that what modes of operation it will be in now we are going to control everything digitally, so we need to just put the command mode into digital mode. We are selecting the motor type. We are selecting the feedback control mode that is actually the motor that is operating with hull sensors, setting up the speed, control against and finally putting the whole system in a speed controlling mode.

Then there is a part of the code here that you can actually do the motor identification. Motor identification is not necessary to be done every single time that youre running the code, its something that should be done only one time ever as long as you dont change. Your motor, so here ive, commented it, but if you want to run it, you can do it. Then the loop starts. The loop is pretty simple: its just doing: defining a directional rotation setting up a fixed speed of 1500 rpm for the motor to stay for two seconds, and then it changes the direction. But this time within this loop that you see here, we are kind of increasing the speed of the motor all the way from 600 rpm to 1500 rpm and increasing it actually one rpm per millisecond that you can see here. The delay of the loop is one millisecond, which is a very impressive delay for the communication using arduino and then the speed after reaching to the lets say through a slope to the 1500. Rpm will be changed to 1000 rpm after a delay of two seconds and then the cycle repeats itself. So if i run the code youll see through the serial monitoring that i can read the speed and the torque of the motor online and you can see there will be different values here rapidly changing so its a bit hard to see whats happening here to understand It better we will be going to motion terminal because we want to see the plots with lets say high resolution, so i go to motion terminal.

I get connected to my solo unit. After that, you see solo reads all the parameters you can set all the parameters that you already set in the code, also in motion terminal. Most of the parameters like the motor type, the switching frequency or any other parameter that you saw there. You can also set them here, but this is not what im going to do im just going to tell you that the canopy baud rate actually can be set through motion terminal through this parameter. You can see here right now. We are operating at 1 megabit per second, but you can change it. The only thing im gon na do is im gon na go to the monitoring section of the motion terminal and im gon na look at the the two parameters that im interested in. Firstly, the speed, so this is actually the profile that we are generating in the code that is working like this. It starts the motor starts with the speed like 1000 rpm. Then it goes one of the 1500 rpm in the same direction. Then the direction will change and we go to a speed like around 7 800 rpm, and then it will accelerate down to 1 500 rpm and then again the the loop starts over and over again, you can have a look also on the iq parameter. That is the torque consumed on the motor, and you see the torque is actually having a value near one amp, because here you see im putting the the brake into the loop.

So the brake is consuming around 150 milliamps, which will result in 0.1 newton meter on the shaft of the motor. I can increase or decrease this value, but for now the interesting thing for me is looking at to the plot and see how the behavioral system is changing. So im monitoring the system by usb and arduino is sending through can open all the commands that you see here that are happening. Please remember that we have an extensive article, which is called arduino library, hello, world there. You can find all the materials that you need to work with arduino, ide, uart and, of course, also can open, and you can find out the wirings there. You can find out about the tips how to run the code and all those things you might need during your process. So please visit our website. Please subscribe to.