This is going to be a wonderful lecture now, because you won’t have to do anything, just listen attentively and contemplate. We are going to talk about the diagnostics of your devices by taking our mobile robot as an example. Moreover, let’s imagine that you are taking part in a contest. By the way, I highly recommend that you take part in all sorts of contests that you can find, and if you can’t find any, you can organize your own contest with a couple of friends and simply type “Poligon” in your search engine. Contests are good for you, because you have to demonstrate what you have achieved not only to your mom or friends, but also to the jury. And you’d like the jury to pronounce your robot the winner, of course. It’s natural that you will be having cold feet in these alien surroundings, therefore you need to be prepared for it. For this purpose, you need to have a basic idea about how to carry out the diagnostics consistently and sustainably. Let me outline a possible plan for this. Most importantly, try not to forget anything. You will need a laptop with a development environment already
installed in it and the latest program version. It’s wise to always save the best variant of the program separately, and all the further experiments need to be renamed and saved in
a different folder. Apart from the laptop, you will need some tools. You might want to prepare the screwdrivers. Also, the multimeter might come in useful. Don’t forget your additional power sources, be that batteries, accumulators or other charging devices. Well, here you are at a contest and you find out that something doesn’t work in your device. In a best-case scenario, you will realize it quick and will fix it. If worst comes to worst, you’ll be running around and yelling frantically that nothing is working. You will need to figure out how to tackle this problem. For starters, you’d better check if you have provided enough power to your device. Check if the batteries are charged and the wiring is not faulty. If you are powering your controller and your motor driver separately, you need to check all power supply
circuits. You will need the multimeter for this. Measure the voltage at the battery compartment first, and then measure it at the board input. If you are using a voltage converter, then you should have the same voltage at the input and the output. If you are using a motor driver, then you need to check voltage at the input. If the power is supplied correctly and the controller is flashing its LEDs as expected, you need to start the diagnostics of your components. The main diagram will come in useful here. You can see that you have motors in the left section of your diagram. This is the section where we marked all our devices. Are your motors connected to terminal blocks? If they are, and you are trying to turn them, are you sure that they are getting
enough power? Well, and so on and so forth. Also, don’t forget to check if you’ve connected all the sensors in the way
you had planned to connect them. Are they actually connected to the pins which are mentioned in the code? Next you need to make sure that there is no disconnection on the signal path. If you are using some agents, such as a motor driver, you can check the voltage level on all the pins with the help of a
multimeter. After that, you can deal with the code. Firstly, make sure that you have uploaded the last definite sketch that you are certain about and that functioned well when you were preparing it. If this is the case but something is still wrong, I really hope that you will have time to conduct isolated tests of each device. In other words, you need to create a separate sketch, where you turn
all the motors in all modes: forward and backward; when two motors turn simultaneously in one direction, when they turn in different directions, and at different speeds too. If everything works alright, check all the sensors. For this, you will need to read off their values in the Port Monitor. If you have a display, output these values on it. Make sure that you are getting the values from the right range. If all the components work correctly, you will need to look at the code once again. Most importantly, make sure that there is nothing in the code
that shouldn’t be there. Let me remind you that it takes some time to output the values in the serial port, and it could be disastrous for some processes. In this case, you will need to delete the command of the
output in the serial port. Let me give you one useful tip here. You need to make sure that you haven’t added comments to some essential sections. It might be so that you are looking at the program and it fails to work correctly, although it did work before. I recommend that you use an indicator, like an LED or a piezo buzzer to check each and every line and find out where exactly the error occurs
in the program. Thus, you can use audible indication every time the values have been read off your sensors. With the help of this, you will be able to hear that the robot hasn’t started reading off values yet, regardless of where your robot is now. You can then set the audible indication in any section of your program to ensure that the program runs until this particular point. Finally, if we are certain that we have uploaded the right program, which, in addition, has been written correctly, we need to check for the validity of all the parameters in it. For instance, if you were using a regulator, which worked with some coefficients, you need to check that you chose the right coefficients there. Moreover, if you haven’t chosen your coefficients yet for such conditions, you need to do it immediately. By the way, it could be a good idea to leave comments for the chosen coefficients to always remember which value was more or less suitable. All in all, I just hope that you resolve all these problems like a
pro, should they come up, be it during your contest (which, I am positive, you are going to win), or your lab project, which you are most likely going to slay.