In October last year, two events coincided: first, UPS brought me three Raspberry Pi from England and another PiFace, of which I intended to make an alarm in the country; secondly, I suddenly remembered my own school, and for some reason I wanted to distribute informal debts and go and teach the kids something. From this a logical decision was born: I put all the pieces of iron in the box and went to show them to the school principal ...
Before a detailed description of further events will tell a little background from the early nineties.
At that wonderful time, all the schools had a lot of fun, and most parents did not want to give their children there. From this, in some places, the practice was born, when the parents of a dozen future first-graders gathered together, found a room and organized classes there, often teaching themselves. I was lucky: then just turned 6 years old and my parents organized such a school. At first we were only seven people, and we were engaged in the premises of the children's club. Then our younger brothers and sisters grew up, organized another class and moved into the kindergarten's room, then they recruited another couple of classes. In total, up to a dozen of such institutions were created in Yekaterinburg at that time. Closer to the two thousand, they all either dissipated or turned into large commercial schools. This did not happen to my school, thanks to several enthusiasts, this is still 5 classes of ~ 10 people each, and no one earns money on it.
... At first, I was given four hours instead of computer science lessons for the tenth and eleventh grades. It so happened that in these two classes in the current academic year there were a total of 10 people - 3 boys and 7 girls, and I had to teach them.
I prepared thoroughly for classes, wrote two manuals:
To begin with, it was supposed to realize the simplest automatic switching on of light: a diode flashlight and an infrared motion sensor were connected to Disassemble with Pithace, then a script was run on a python that interrogated the sensor in a loop and switched on the flashlight (six lines) when triggered. Manage Disassemble - via SSH.
The day before the class, I asked to distribute the manuals to the students. The next day, I collected all the junk (Raspberry, Piface, motion sensors, diode flashlights, power supplies for 5 and 12 volts, wiring) and went to school.
How did this happen
I had only three sets, and 10 students, so we made desks with the letter “P”, in the middle we put another desk and laid out the pieces of iron on it with a bunch of wires (three more twisted pairs were added to the above to connect Disassemble to the network; photos, Unfortunately, no more). The children sat in twos for the computer, two pairs worked with one Disassemble.
First, I showed what a cool thing we are going to do - from the computer in the python interpreter, turned on and off the flashlight. It seems like it. Further, I generally explained what I did and how I did it, the boys began to connect the devices to the two remaining Understand, and the girls sat down on computers and began to reproduce my actions on manuals.
Since I wrote the manuals from my head, the jamb immediately appeared - the absence of asterisks when entering a password in Putty was perceived as a hang. But they figured it out and until the end of the first couple of lessons everyone managed to turn on the flashlight and read the data from the motion sensor.
On the next pair, we studied python, wrote simple scripts. Then I made a big mistake in preparation for classes - I didn’t test working with mc, which was supposed to do all this. It turned out that when working through Putty, the entire mc screen was filled with garbage. In addition, the python for some reason does not perceive the double tab in the mc editor as a double indent, I could not catch it for a long time and understand what was the matter. As a result, by the end of the class, everyone wrote simple scripts, interrogating sensors, and everyone seemed to like it.
')
Continuation
More than I was not allowed to attend computer science lessons and I suggested that the children engage in optional activities, four people volunteered. It was necessary to formulate a task for them. It was here that the school was non-profit, and the children didn’t have a consumer attitude to it: when I offered to make smart alarms for my school, they agreed.
I did not write the manual, I decided that we would formulate the tasks and solve them. For a start - let them study the python. I installed Linux Mint on two computers (it seems to me that the system most suitable for learning), in it is IDLE. He came to the lesson, the first thing that got into his head - let him solve the quadratic equation. And even if the equation is given as a string. Made.
It is too easy to make an ordinary alarm: in each room by the sensor, connect to Disassemble, disassemble the script in seven lines. Need more interesting task. For example, by triggering sensors, determine the number of people in the room - and the algorithm is more complicated, and the sensors need to be smarter. We need to think about how this will work. This is where we hacked in ... The bottom line is that the operation of conventional IR motion sensors, which are used in the alarms that we used, does not depend on the number of people in sight. Therefore, the only way to solve the problem is to process the sensor triggering sequence, that is, the movement of people, since people move more often one by one. The task was also complicated by the inertia of the sensors: with a single response, the sensor opens the contact for ~ 10 seconds. I suspect that in mathematics there is a special section for solving such problems, but we did not bother like that, we went with simple peasant logic, in the end, having spent a total of 10 hours brainstorming, we formulated some algorithm. In short, they decided stupidly to sort through all possible sequences of movement of people and determine at what minimum number of people these sequences are realized. Among other things, we came to the conclusion that with a typical simultaneous presence in the room of more than 50 people with ordinary IR sensors, we will not determine their number. And here begins the next milestone of our project.
I immediately decided that 4 people for classes is not enough, it is also necessary to attract the eighth grade. They need something simpler, let it be cars for boys and targeted RGB-garlands for girls. Made a corresponding order on ebay. Among other things, I came another 3 distance sensor. We with high school students decided to install them in the entrance door to accurately determine the number of people entered.
Actually this is what we have come to the present moment, to be continued ...