In essence, this is a commentary
on the presentation of the book , but it turned out to be quite a lot of letters, so I had to select it in a separate article.
The book is quite interesting and can be recommended to anyone who, so to speak, "continues" to work with Arduino. It is quite useless for quite beginners, but it’s quite suitable for expanding the idea of how to handle all this farming. But the target audience is not so versed in the subject to critically perceive some of the author’s statements and decipher the numerous mistakes of the translator in collusion with the editors. And the author misses a mistake for the author, since he is clearly a programmer, not an electronics engineer, and cannot understand the subject thoroughly. But the editors were obliged to comment on such places.
Everything written further has no purpose to somehow hurt the author and the publisher who did a good job. I am writing this with the hope of making life easier for the reader, who is fortunate enough to stumble upon these my invented thoughts. The book, I repeat, is useful and informative, and individual mistakes do not change this attitude of mine.
In the listing below, the pages are indicated by the official electronic version.
')
Oh good
First, as is customary, about the good.
1. “
Using variables of type int to store contact numbers leads to wasted memory ” (p. 63) - more than a timely note. Further in the book several times it is recalled that contact numbers should actually be entered by 8-bit constants. The only pity is that this thought is not very consistently carried out, because the widespread desire to designate output numbers as int variables is a clinic that is not justified by any readability of the text (and why is there something readable?).
2. “
But in reality, the temperature in the form of a real number is needed only when you want to display it on the screen. Other operations with temperature, such as comparing or averaging with several attempts at reading, can be done with an unconverted value of type int, and at the same time they will be performed much faster ”(p. 91). No comments.
3. “Fast I / O” (p. 94) is a very correct section, it deals with overcoming the main drawback of the Arduino platform: multi-toned layers of piled-up libraries.
4. Mention that in order to reduce consumption, you need to remove the power LED (p. 110). For some reason, when talking about reducing energy consumption, they forget to mention absolutely everything.
5. Very informative and useful for fans of Chapter 13 "Digital signal processing."
About bad
Now about the annoying mistakes. I divided them into gross blunders (author or translators / editors) and minor quibbles on my part.
Rude bloopers:
1. “The
contacts in the next group are signed with Analog In (analog inputs) with numbers from 0 to 5. ... Although they are designated as analog inputs, they can also be used as digital inputs or outputs. But by default they act as analog inputs ”(p. 24).
No not like this. All pins of AVR ports
by default work as digital inputs without a pull-up resistor connected. And the analog outputs A1-A5 is no exception - why would? These are the usual outputs of ordinary ports (Arduino numbers 14-19), which, among other things, can work as inputs to the ADC. And they acquire this quality only when you refer to analogRead, not earlier.
2. Table 5.1. “The electricity consumption of the Arduino boards” (p. 105) put me in a real stupor:
Sorry, is there something in the Mini that should consume an extra 20 mA from an external source? It is useful to look in the
office. scheme : like nothing. The MIC5205 stabilizer, judging by
its description, consumes something 150 µA. I was not too lazy to check it alive: I turned on the Mini Pro to the source of 5 V (directly) and at 12 V (via RAW). As one would expect, absolutely identical consumption: about 20 mA. So, so far, I cannot understand where the author originated this data — did he invent it from his head?
3. "Reducing the operating frequency" (p. 108). The misconception that reducing the operating frequency supposedly reduces energy consumption is widespread even in a professional environment. In fact, it reduces only the current consumption, and the energy consumption per clock noticeably increases (as the graph in Fig. 5.3 is not straight, but curved, and, according to Monk, the awkward LED on power was turned off here):

In a nutshell: let the supply voltage = 3 V. The procedure of 16 cycles at 16 MHz takes 1 µs, that is, the energy consumed by this (current 8 mA, table 5.2) 3x8x10-3x10-6 = 24 nJ. At 1 MHz, the same procedure will take 16 μs, and the energy will be consumed (current 2.6 mA, Table 5.2) 3x2.6x10-3x16x10-6 = 124.8 nJ. And if, in the intervals between these procedures, you enter the AVR in a state of energy saving, you will lose five times the energy. Therefore, there will be a gain only if using a reduction in the clock frequency as a separate technique, without doing anything else. And when the controller is idle for most of the time, the use of sleep will give a much greater effect, and in this case the frequency should be done as high as possible.
4. “
Read / write operations with EEPROM memory are very slow — about 3 ms ” (p. 142).
A typical sign of misunderstanding how an EEPROM works. Writing to it really takes 3.3 ms. But there is no reading at all: 1 clock cycle for the first byte, plus 4 clock cycles of delay before reading each subsequent one, if read in succession. That is, a maximum of 5 cycles - 0.3125 microseconds in the case of the Arduino 16 MHz, 10,000 times faster than Monk claims. But about what the standard section “Preventing EEPROM Corruption” is devoted to in each AVR datasheet, for some reason, not a word in the chapter on EEPROM.
Small nagging
Page 50 . “
And saving it to the Libraries folder, located in the Arduino folder (in the Documents folder) ” - are you able to understand from this phrase which folder is located in? Me not.
Further there: “
In order for the Arduino IDE development environment to detect the newly installed library, it must be restarted ” - who will it be? The library?
Page 54 . “A similar directory with the description of commands in Russian can be found at
arduino.ru/Reference . - Note. per. Thank you, daragoy, but at the same time it is necessary to mention that arduino.ru/Reference was not updated from what time, and the translation there in places was done with gross errors. Otherwise, your inexperienced reader will be confused, for example, by not finding the constant INPUT_PULLUP mentioned in the book at the specified address.
Page 57 . “
... programs can be uploaded to the memory chips on the Arduino board, and then transferred to their own boards ” - yes? And where are these “memory chips” on the Arduino board?
Page 59 . "
... and three types of serial interfaces supported by the microcontroller: USART, PPI and DPI ". Wanted without comment, but could not resist. Characteristically, Chapter 7 is called “I2C Interface” and it is about TWI, and Chapter 9 is called “Interaction with SPI Devices”. So neither, sorry for the expression, PPI, or PDI you will not find in the book again and you can guess over the decoding of these abbreviations until the end of the century. On the other hand, the UART and the UCCA are being exploited in full in Chapter 10, "Programming the Serial Interface." Well, yes, and the volcano, which will destroy the United States, will wake up on the territory of the Zheltokaminnogo National Park.
Page 78 “
Try pushing the button more vigorously, this should help to get a clear transition between states without a chatter effect ” - a completely unforgivable recommendation for a book claiming a certain “professional” approach. And also a very common misconception for those who do rarely turn on buttons with their own hands. The only kind of buttons that is less subject to bounce is from conductive rubber (telephone keys, for example). All other buttons, switches, switches, etc. chatter absolutely no matter how they are pressed, and require special measures of protection against bounce.
Page 84 Thanks for the tip to the TimerOne library, but from the text and the example it is impossible to understand how to work with it. And, by the way, an interesting question, more precisely, immediately a bunch of questions: why are the pictures for different pins in fig. 3.3 shifted to the eighth of the period? Is this how it works? Due to what, and how can this be controlled? etc.
Page 103 “
The next sketch increases the ADC frequency from 128 kHz to 1 MHz. ”
Our esteemed Monk forgot to mention something. Namely, in all datasheets of all AVR there is the following paragraph:
By default, it will be necessary to get maximum resolution. It can be higher than 200kHz to get a higher sample rate.
In fact, in the ADC, the sources of error and bounce are enough to increase them artificially. And the tasks that require fast ADC conversion for 8-bit controllers simply do not arise (in fact, they do not process the sound on them). If you need accurate / fast ADC conversion, then it is simpler to install an external module and not to suffer foolishness.
Page 142 “The
flash memory in Arduino guarantees data integrity for only 100,000 write cycles ” -
in fact, up to 10,000.
Page 196 . Fig. 10.4. - does not correspond to the text and sketches, because one of the Uno depicted uses the regular Serial, and not its programmatic imitation, which is discussed in this section.
It seems everything. Maybe I missed something, I don't know.