Ralph S Bacon

MicroControllers, Electronics and IOT

A new programming language (for me)

If you’ve been following my YouTube channel or this blog you’ll know by now about my Workshop Automation project that I have on the go. It will incorporate many elements of the Arduino journey so far, but requires something a bit more sophisticated to tie it all together. Hence the Raspberry Pi 3B+ sitting on my desk. Who would have thought it?

I’ve followed a script or two in Python, my new, interpreted language and it is straightforward to use – except I keep putting semicolons at the end of every statement, and want a “reformat” button. The lack of curly braces, and using indentation to scope the code is also very odd to me (it just feels wrong to a C++ programmer) but despite all this, and proving you can teach an old dog new tricks, I’m finding Python a nice language to use.

btyHowever, I’ve discovered whilst reading my new Exploring Raspberry Pi book, by Derek Molloy that you can easily write C++ code that is then compiled into a shared object and can be consumed by the Python. So when the need arises I can go back to a proper programming language (just kidding, don’t flame me).

Many of you have also commented on my latest couple of YouTube videos about what I should be running, both on the Pi and on the Sonoff 4-channel unit. MQTT is a deffo (and I have now up and running) and Node-RED to orchestrate the aforesaid MQTT. Additionally, many of you are advocating replacing the default firmware in the Sonoff and using Tasmota, a version of which has been specially prepared for the Sonoff 4-channel unit. The advantage of doing this, it appears, is that you have better control and options of the Sonoff itself, it still ties into Amazon’s Echo (Alexa) for the four channels and there is no 3rd party cloud connectivity required – it’s all under our own control, huzzah!

The last time I had any dealings with Linux was probably back in the year 2000. “This will be the new desktop,” I said to my work colleagues who looked at me as though I had taken leave of my senses. They were all too busy upgrading from Windows 95 to Windows 2000 to even think about Red Hat. Well, I got my head around the Linux command line, learned to use an editor, modified a distro or two and… nothing. My interest petered out as it became apparent that Windows had won the desktop battle if not the OS war.

LinuxInEasySteps

Linux in Easy Steps – Mike McGrath

Who would have thought that, nearly 20 years later, Linux was the defacto standard for that Raspberry Pi sitting on my desk? I can’t remember much at all about Linux commands, as I didn’t do it long enough for it to go to long-term memory. But now I have another “quick” guide, Linux in Easy Steps, that I’m hoping will make it easier to understand what is going on “under the hood” of my Pi. First glance makes me excited to read on, with full-colour images and screenshots, none of which I can show you due to copyright laws. Perfect for a noob like me. Oh well, we shall see how I progress over the next few weeks.

As if this cornucopia of reading material were not enough, Amazon has asked me to review the latest Raspberry Pi for Dummies, which is about my level currently; funny how Amazon knew that. What have guys been saying about me 🙂

Raspberry Pi For Dummies

As it happens, I’ve long been a fan of the Dummies series, and the first glance at this one makes me think that we will get along, although the lack of colour pictures and screenshots (all greyscale) makes it less attractive (than the Linux in Easy Steps) to shallow people like me! I mean, where’s the bling?

Needless to say, I was under the misapprehension that I was doing some bleeding edge technical forays into this Home Automation area, only to discover that many have trod this path before me, found all the bugs and selected the best-fit software – all of which allows me to stand on the shoulders of giants and present to the world my findings, projects and experiences. It’s a great way to share knowledge though, and encourage others to follow.

For which I must give a resounding Thank You to all of you who are supporting my YouTube channel and this blog – your presence is highly valued.

Categories:Uncategorized

8 replies

  1. Also started with python a little while ago. Not very hard and within a few days I could easily read sensors and mqtt those to my openhab. I miss a concise o review of python so I mostly have been learning by doing and looking at other people’s programs aoni am sure some of the things I do could be done better, faster or easier, but at least it allowed me to usey raspberry for much more than just an openhab/mqtt server.

    Like

  2. I’ve dipped my toe in various Linux distros previously but not the Raspberry Pi so I following this with some interest.

    I think you may find it may be OK to reproduce extracts from copyrighted material under the “fair use” clause. Since I’m unsure what your relationship is with Youtube that may or may not not be the case.

    One interesting clause on HMG’s web site on copyright states: –

    “Several exceptions allow copyright works to be used for educational purposes, such as:

    the copying of works in any medium as long as the use is solely to illustrate a point, it is not done for commercial purposes, it is accompanied by a sufficient acknowledgement, and the use is fair dealing. This means minor uses, such as displaying a few lines of poetry on an interactive whiteboard, are permitted, but uses which would undermine sales of teaching materials are not.”

    I think that would have been enough to stop you needing to appear in front of the beak since any reproduction by yourself would, if anything, increase sales.

    Like

    • I would like to think that was the case, Brian, and thanks for the official HMG quote.

      That said, I got a copyright infringement claim against me at the beginning of 2018 for music on an old 2016 video; music that was specifically allowed for YouTube use. The music seems to have been recognised by a bot and flagged up. I appealed and quoted all the relevant material from Purple Music’s own website; the appeal was never contested and YouTube reinstated my video.

      But after that little incident, I’m more than a little wary about doing anything that might be construed as copyright infringement, as you might imagine. It’s one thing to flag up a video that was nearly two years old (and therefore unlikely to get a huge number of views going forward anyway) but another entirely if copyright infringement was flagged on a newly launched video; it would kill any ad revenue my video might receive from the initial surge in viewings, tiny though that ad revenue is. How would I finance my Far Eastern component buying then?

      I suppose I should / could drop a line to the publisher and ask whether I can show stuff but that would mean permissions would be on a book-by-book basis, from different publishers who may not reply in a timely fashion (it’s no good giving me permission 3 months after I needed it for a blog or video!)

      As a Real World example, I once watched one of Julian’s videos, where he had a copy of an electronics magazine from years ago in which he had had an article published (clever clogs that he is). He was not allowed to even open the magazine to show his own article. And, as we know, Julian has a huge presence on YouTube so if he could not [get permission to] do it I don’t think I would chance it either.

      Sigh. In this way, creativity and knowledge sharing is stifled – and potential sales missed. But thanks for the support and the information, Brian, great to hear from you. And I’ll find other ways to share any information I glean from those books, don’t worry.

      Liked by 1 person

      • There does need to be some “Control”, but as with life in general there is no Black & White criteria. The whole world is getting very litigious. Now, because of the volume of transactions on the internet they are turning to BOTS to this scrutiny. God help us.
        Keep up your good work.

        Liked by 1 person

  3. My leap was to the ESP8266 then ESP32. I hope you don’t forget about us in your future plans.

    Like

    • Not at all, William. And the ESP8266 / ESP32 are different beasts entirely when compared against the SoC Raspberry Pi. Horses for courses, and all that. I’m biding my time a little with the ESP32 as I didn’t find it at all easy to hook it up to any of the programming IDEs. That’s not to say I didn’t get it working (eventually) but it was a bit of an uphill struggle. Once that process has matured a bit (2018 could be the year) then it will be ready for mainstream (think: beginner) adoption. So no fears, William, the ESP32 is still very much on my radar. Thanks for posting, have a great evening.

      Liked by 1 person

      • If you have any tips or videos on development environments, I’d be very interested – I’ve been using the Arduino IDE for Arduino and Wemos (based on ESP8266) devices, as the library manager makes life very easy (if slow, and not very helpful with debugging).

        I’ve recently stumbled across PlatformIO under VS Code, which looks nice, but has a whole new familiarisation learning curve – and I only considered this because the Lolin32 (based on ESP32) I wanted to program wasn’t obviously supported under the Arduino IDE. Programming them is one thing, but library integration is critical!

        Like

        • As an experienced VS person, Robin, you should consider two flavours of Eclipse. There’s Sloeber v4, which some guy in The Netherlands has put together and works well, although you get a $5 per month nag every so often. Then there is the official Eclipse Oxygen 3, with Arduino add-on (NOT the Sloeber add-on version) and that works very well too, but I haven’t used it hardly at all for the ESP8266). Either of these gets you that library integration along with Intellisense and a host of other features.

          Here’s the YouTube link for the latter (official) version, slighly outdated now due to the newer release of Eclipse but still good:

          Here’s the Dutch Sloeber V4 version which does boast of support for 400 boards:
          http://eclipse.baeyens.it/

          Have fun!

          Liked by 1 person

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.