For many years now, people have been improving their tools, studying the forces of nature and bringing them under control, using the energy of the nature to operate their machines. Last century is noted for the creation of machines which can operate other machines. Nowadays the creation of devices that interact with the physical world is available to anyone.
Our course consists of a series of practical problems on making things that work independently: they make their own decisions, act, move, communicate with each other and people around, and control other devices. We will demonstrate how to assemble such devices and programme them using the Arduino platform as a basis.
After this course, you will be able to create devices that read the data about the external world with a variety of sensors, receive and forward this data to a PC, the Internet and mobile devices, and control indexing and the movement. The creation of such devices will involve design, the study of their components, the assemblage of circuit boards, coding and diagnostics. Along with the creation of the devices themselves, you will perform visualization on a PC, create a web page that will demonstrate one of your devices, and figure out how an FDM 3D-printer is configured and how it functions.
Besides those keen on robotics or looking to broaden their horizons and develop their skills, the course will also be useful to anyone facing the task of home and industrial automation, as well as to anyone engaged in industrial design, advertising and art.
The course does not require any special knowledge from the participants and is open even to students of upper secondary school. Programming skills and the level of English allowing to read technical documentation would be an advantage, but this is not obligatory.
The entire course is dedicated to practice, so the best way for you would be to get hold of some electronics, follow the illustrated examples and experiment on your own.
The kits can be purchased here: kits.cyberphysica.ru.
Taught by: Alexey Perepelkin, head of Robotics department in the Laboratory of innovative educational technologies at MIPT
Taught by: Dmitry Savitsky, researcher in the Laboratory of innovative educational technologies at MIPT

AC

Is an admired course. I can't wait to have my fingers wrapped around it. I am really excited to be on this program.

NC

Jul 16, 2017

Filled StarFilled StarFilled StarFilled StarFilled Star

enjoying failing many times and passing after studying and knowing much more during the tests.

De la lección

Week 2

It’s time to learn how to receive data with the help of sensors. During Week 2, we will teach you how to read off digital and analog signals, exchange data with a computer, create more complex algorithms, and use new output devices.

Impartido por:

Алексей Перепелкин

Руководитель направления развития цифрового творчества

Дмитрий Савицкий

Научный сотрудник

Transcripción

In our next experiment, we will be using another microchip, which is called an “output shift register” and which is labelled
as 74HC595. I suggest that its data sheet, where we have its description, is only
studied by the everlast. We will be regarding it as a black box by default, as it’s not the simplest microchip, but it’s a very useful one. Its main purpose is port extension. With its help, we can use only 3 Arduino pins and get 8 outputs. How does this happen? We sequentially pass on 8 bits of information through the first pin
to the microchip. There we have all the necessary combinations: 0, 0, 0, 1 1, 0, 1. One more pin is used to synchronize this information transmission. The third pin helps to communicate a command to simultaneously output these 8 bits of information at the 8 headers of the microchip. I am now going to show you the circuit which I assembled for this experiment. Please, try to study it in detail. As the basis for this circuit, I have chosen one of the iii experiments. I want to thanks the guys who created this complex diagram. I have removed the switch from it, as we won’t be needing it. Let’s see what we have left here: the shift register itself with a notch on the left, and the seven-segment display pictured in the same way as
it appears on the breadboard. Only now its headers are connected to the outputs through the shift register, and not directly to Arduino. Through the shift register, it will now be receiving commands to turn on this or that segment. The shift register itself receives commands and data through these
3 wires. This means that 8 bits of data is downloaded in it, being later sent to the outputs of the seven-segment display
in our case. Also, consider the fact that several headers of the microchip, apart from ground and the power source, can also be connected to ground or the power source, as this is how this microchip works. Now let’s look at this horrifying circuit and then at the sketch. This looks even more horrifying than its diagram, since on the diagram, several signal paths have been extended for better readability. For instance, the 6th output of the seven-segment display goes through
the resistor and goes here first, and then here, and only afterwards does it go to the shift register. I have made this part shorter by inserting the wire from the
resistor straight to the
microchip. Now let’s deal with the program. In the beginning, we need to determine Arduino pins. In our case, these are the pins controlling the shift register:
DATA_PIN is the 13th output, to which we communicate data, and LATCH_PIN, or the so-called
STROKE, is the output which will pass on the command to the register to forward the 8 bits of information. We also have the CLOCK_PIN, which we need to synchronize data transmission. Besides, we have determined 10 byte variables. Byte variables can store 1 byte of information, or 8 bit, and this will be especially convenient for us, because we will be able to store character encodings, aka the digits we will be outputting in bytes. What am I trying to say by this? In order to display a digit, we need to turn on certain segments of the display, and leave the other ones off. Since we only have 8 segments, together with the period, the digit can be
coded as 8 bits of information, or 8 ones and zeros. These 10 variables have been created specifically for this purpose. Each of them contains a combination of ones and zeros written in such
a way that at the outputs of the shift register, they will turn on those display segments that compose this digit. Thus, d0 transmits segments like these ones, which will compose 0, for example. d1 will turn on only 2 segments which will compose 1, etc. In order to write data as a sequence of bits, we use these two 0b symbols, and then the 8 bit which make up our byte. Let’s see what will happen next. I am going to set all the 3 outputs in the setup, which work with the microchip at its outputs, to which we will be
transmitting our data. Now let’s connect to the computer. We have already learnt how to transmit data to a computer earlier, and in this experiment, we are going to learn how to receive data from a
computer. That’s what we will be doing next. What happens when Arduino receives data from a computer? It is saved into a special buffer, which has the length of 64 symbols. Using the “available” method, which is defined in the standard Library and refers to the Serial
Object, we can check if we have any data in the buffer. Thus, we are performing a comparison. If the amount of data in the buffer, i.e. the number of bytes, exceeds 0, we have something there, and we start to work out what exactly we have there. We need to create a digit variable of the char type, which literally means “character”. Since we exchange symbols with the computer through Arduino’s serial
port, we shall save only 1 symbol. In order to read it from the buffer, we will be using the standard read method, which also refers to the Serial object. This means that if we have something in the buffer, and the data exceeds 0, we shall store it in the char variable. Afterwards we need to figure out what exactly we have there. Here we are only interested in 10 possible variants or 10 digits. [PAUSE] I am writing: if the digit variable, the one that we have just read from the buffer, equals 0, we shall begin working with the microchip. To begin writing data into it, we need to set LATCH_PIN to LOW value. After that, I am going to use Arduino’s standard function - shiftOut. It is designed for the serial output of information from some bits to a certain pin. I am telling it to which pin the information should be transmitted, as well as which pin is the pin used for synchronization. Then, this LSBFIRST parameter determines from which bit the output of the data should begin: the high or the low
order one. In our case, we are using this option. Then we have to communicate the data which needs to be transmitted. If we read 0 value in the buffer, we shall transmit it to d0, which stores the combination of ones and zeros, and turns on the segments
that make up 0. We finish working with the microchip by sending the HIGH command to LATCH_PIN. At this same moment, the microchip will transmit the signals it receives to its 8 outputs. We then come across another new thing concerning the use of the If-operator. Do you remember how we could use it only in its short version and perform actions only if the condition was true? If «something is true, this should be done». An alternative action was then added, which needed to be performed if the condition was false. For this purpose, we were using an operator, which was the “else” key
word. In fact, they can be combined in the form of an “else if” construction. How can we picture this? If the 1 condition is true, a certain set of actions needs to be performed. Otherwise, we would be testing some other condition. For example, condition number 2, which in our case would look as follows: did we receive a 1
symbol? If yes, then we will have to perform this fragment. In the opposite case, if it’s neither 1 or 0, we need to test the third condition and perform a third set of actions. Let me bring to your notice that they are all different in one
single segment, where we transmit data to the microchip. The following variables will be
different: d0, d1, d2. So we are just transmitting different sets of data. In reality, this could all be done in a more elegant way, but I won’t be overloading you with additional information for now. We shall just do this in a direct way, like this. [PAUSE] The same thing happens all the way through until we get a 9 value, in which case we shall be passing the content of the d9 variable to the
microchip. Now let’s download our new massive sketch into our new and not less massive board to see how this all works. I am starting the Port Monitor. Let me point out that I have chosen «9600» Bd here, just as I mentioned in our
sketch. Here I have written “New line”, because if we want to finish
the transmission of the data, we need to transmit the symbol of the new line. The line for sending the data to the serial port can be found right here, and now I will be transmitting various digits. Let’s send 1. The seven-segment display is showing 1. 5, 4, 0, 9 — this all works perfectly well. Let me pinpoint how exactly we compare the digit variables of the char type, which is a symbol, with digits. Digits are put in single quotes, which means that from the point
of view of the compiler, we are comparing digits not with 9, but with the code of the 9 digit and with the symbol table. If you never happened to come across letter or symbol coding, have a look in the Additional materials, as it’s quite an important detail. And… The thing is that the code of the 9 symbol is not the same in the symbol table - it’s actually some other digit. We may not even know it for now. We are just sending 9 from the
computer, it is then coded, and afterwards we compare it with the 9 symbol. We check if we’ve got the right code, which stands for the 9 digit. By this time, you have already received loads of new information: how to read off analog-to-digital signals at Arduino inputs, how to exchange data with a computer, send it and receive it. You have also learnt how to do more complex algorithm branching with
the help of the “else if” operator, tested new display devices, including the sound unit, and got acquainted with microchips, which very often act as helpful intermediaries on the path of the electric signal. You can now find their manuals and with their help figure out the function of each pin, and use them purposefully in your circuits. There is the main project waiting for us ahead, as well as some other
enjoyable little things.