Programming with MicroPython

Author: Nicholas H. Tollervey
Publisher: O'Reilly
Pages:206
ISBN: 978-1491972731
Print: 1491972734
Kindle:B075X49VVH
Audience: Python developers
Rating: 2
Reviewer: Harry Fairhead

Micropython seems to be eating the microcontroller world and learning it seems like a good idea.

The most important thing to know about this book is that it doesn't teach you Python and it doesn't really teach you MicroPython either. This isn't a huge problem as long as you know Python reasonably well and are prepared to treat MicroPython as a sort of cut-down version with some additional libraries. You also need to know that the book covers PyBoard, BBC micro:bit, Adafruit Playground Express and ESP266/ESP32. Notice that the Raspberry Pi is missing from this list, despite the fact that MicroPython is popular on the Pi.

Banner

The first chapter is a history and general introduction to MicroPython. It is a bit of a self-indulgent homage to MicroPython, but you have agree it is a remarkable achievement.

Chapter 2 is the first of four that explain how to set up the different development boards for MicroPython. It doesn't provide much more than following the instructions you can find on the website. The chapter on the ESP is particularly bad as this is a complex device to set up - I really wish it wasn't. The description of how to do it assumes that you know about USB serial adaptors and what the serial control lines are. A diagram would be nice. There is also the problem of which type of ESP device you have because programming is slightly different for each type. The ESP32 wasn't actually supported at the time the book was written, so it's a bit speculative. Every book has to have chapters that get things setup, but these don't seem to add much to the solution.

Chapter 6 is where the programming part of the book starts, or should start, but "Thinking Embedded" is an indulgent ramble through philosophy and literature in an attempt to justify something or other about embedded software development. The book would be better with this chapter removed. 

 

The actual coding starts in Chapter 7 with a look at how to drive LEDs and other output devices. You might expect a circuit diagram and some discussion of current-limiting resistors, but what you get is something on PWM and then a very general discussion of switching lights on and off using a loop. Then on to using NeoPixls with the Circuit Playground. Finally, we have a look at the micro:bit's LED display and the PyBoard color LCD. I'm not sure what generality the reader is supposed to take from this explanation. It seems to be a list of recipes for particular output devices. The problem is that nothing is explained in much detail and any idea of the electronics involved is completely ignored.

Chapter 8 does the same thing for input device. We have a look at buttons and capacitive touch sensors, but without any mention of the most fundamental of techniques, debouncing. Next we move on to accelerometers, gestures and compasses which the micro:bit, PyBoard and Playground have built-in. Finally, we have light and temperature sensing. Again you might expect some sort of diagram but no - just code.

Chapter 9 introduces the idea of the GPIO. This focuses on the micro:bit because it does have an easy-to-use GPIO. No mention of what the pins can drive or any safety precautions. Then, before we have really got to grips with the general GPIO pin, we move on to the UART, SPI and I2C I/O. Thre's not enough to actually do anything and it's much too vague. Could you connect an I2C or SPI device after reading this? I don't think so.

Chapter 10 is about networking which dives into infrared communications - not what most of us would think of first in connection with networking. Next we take a look at the micro:bit radio and this is just a project to create a radio broadcast. Finally we look at ESP WiFi - just generally how to use it.

Chapter 11 is about making sounds and it really doesn't explain what is going on.It goes from square waves to shaped waves using a DAC and on to using the speech synthesis.

Chapter 12 sounds exciting as it is called "Robots". Unfortunately the instructions come down to buy some off-the-shelf parts and put them together like the photo. There is no help in buying the parts and the beginner probably needs such help - for example continuous rotation servos come in many forms and there is a standard hack to convert a standard servo into a continuous rotation servo. The chapter ends with a look at some robots you can buy.

The book ends with a chapter on idiomatic Python and where to go next. 

Conclusion

This book will be a disappointment if you want to find out about techniques that you can apply to your own projects and designs. It is mostly a cookbook of small projects - add an LED, use a switch, make a noise and so on. There are no useful general discussions of ideas such as PWM and how this can be use to modulate the power supplied to an output device. There is also nothing about the problems of timing for input devices and indeed timing in general is ignored. I was also shocked that there was virtually nothing about electronics.

While it is true that the book is about MicroPython, and not hardware, you aren't going to get very far without a little more understanding of electronics. It also raises the question of why bother to cover SPI and I2C buses if no use is going to be made of them?

The book also suffers from trying to cover too many development boards. It would be much easier to follow if it had focused on the micro:bit say and put some articles on the web about the other boards. Covering four boards just makes it difficult to follow what is going on.

The best you can say of this book is that it oozes enthusiasm for the whole idea of MicroPython and embedded programming. As such it might inspire, but it isn't likely to educate beyond some simple, and sometimes confusing, examples. 

 

 

Banner


Python All-in-One, 2nd Ed (For Dummies)

Authors: John Shovic and Alan Simpson
Publisher: For Dummies
Date: April 2021
Pages: 720
ISBN: 978-1119787600
Print: 1119787602
Kindle: B091DGDLK8
Audience: People wanting to learn Python
Rating: 2
Reviewer: Mike James
All-in-one refers to the fact that this is seven books put together - why?



Driving Value With Sprint Goals

Author: Maarten Dalmijn
Publisher: Addison-Wesley
Pages: 256
ISBN: 9780137381920
Print: 0137381921
Kindle:B0C7ZJR7N2
Audience: Scrum developers
Rating: 5
Reviewer: Kay Ewbank

Over the years I've read a lot of books about agile development and Scrum, and most concentrate on the methodology rather tha [ ... ]


More Reviews

 

 

 

Last Updated ( Saturday, 06 January 2018 )