Some time ago (11 years ago, in fact – all the way back in 2012), I wrote a blog post about how to control GPIO on a Raspberry Pi using sysfs and the /sys/class/gpio construct it provided.
Well since then, time has passed, and in the way of all things, so has the “GPIO Sysfs Interface for Userspace” (as it’s formally known) – which has been deprecated. In fact it’s been depreciated since 2015 – but I (like a lot of other people, I suspect) didn’t notice.
This is just a quick post to share something that I learnt only very recently, whilst chatting with a wise Sensei, about how the continuity mode of most multimeters actually works.
Continuity mode is perhaps one of the most used modes on a multimeter for many people. Simple, it lets you test for electrical continuity between any two points. It’s super useful, in trying to reverse engineer a circuit board you don’t have the schematics for; or for testing if joints like connectors or solder-joins are making a good connection… If there’s a complete circuit between the two points being probed, then a buzzer or beeper sounds; and if there isn’t then there’s silence.
A tranquil lakeside It’s mental health awareness week – and I wanted to write something on that topic. This is kind of difficult for me, as it’s not a topic I often speak openly about – but I live with chronic anxiety & depression.
I was first diagnosed some years ago in 2012 – and making that first trip to the doctor’s was one of the hardest things that I’ve ever done.
Like so many other people, over the last few weeks of lockdown, I’ve been trying to use the extra time that I’m not spending commuting to work to learn some new skills that I’ve always meant to get around to learning. In particular, I been teaching myself ARM Assembly Language programming.
I’ve always been more interested in the low-level side of computer programming – than I have been in applications. I’ve always (even as a child) wanted to know how the magic box that is the computer actually works.
I’ve not actually written anything here for quite some time (it turns out that doing a part-time PhD really eats into your electronics project time… Who’d’ve thought!); so I thought I’d take advantage of the current isolation and a few days off over the Bank Holiday, to catch-up with some blogging…
The venerable NE555 timer IC was introduced in 1972; and due to its versatility is without doubt one of the most common integrated circuits ever made.
In this final part of the series I’m going to look at one further way we can use Boost.Python to help when using a C++ class within Python.
In the previous part we built a wrapper for a C++ class, exposing a number of class methods to Python.
However, in Python, it’s quite typical for a class to use properties as well as methods.
So to begin – let’s take a moment to look at properties within the context of classes in Python.
Last time we looked at how to use Boost.Python to wrap a very simple piece of C++ code. This time we’re going to take that one step further along, and do the same thing for a more complex C++ example – which includes a C++ Class.
For the purposes of this example – let us assume that we have a “legacy” C++ class (i.e. one that we’re not going to change): which looks something like this:
In a previous post, I described how you could use the ctypes Python library to import a C++ class to make it usable from within Python. There is however, another way to do this; and that’s by using Boost.Python (which as the name suggests is a part of the Boost C++ library suite).
Whilst this method makes our code on the C++ side slightly more complicated; it significantly simplifies the Python code – and it let’s us use some more powerful features.
Tristate multiplexing (or Charlieplexing) is a simple to use technique to expand the number of LEDs that you can light from a simple microcontroller. This post explores the concept, and looks at some interesting calculations we can do when thinking about them.
I’ve been meaning to get around to writing something of a tutorial on the basics of assembly programming using a PIC microcontroller for a while: and this post stared off as the first part of that… But then, in the best traditions of geekery, I got distracted by the interesting mathematics behind the scenes, and instead this post was born.
I recently found myself needing to call a C++ class from within Python. I didn’t want to call a separate process (as I had previously when using Thrift – see Using Apache Thrift for Python & C++); but rather to call a C++ library directly.
Before I go on I should say that there are a lot of different ways to do this is Python – and I’ve picked one that worked for me.
Last time we looked at how to write a server application in C++, and call it from Python. This time, we’ll do things the other way around: implementing a service in Python, and calling from C++.
Python server Unlike our C++ server example, Thrift doesn’t help us out so much — we don’t get a helpfully pre-written skeleton, and we have to do all of the work ourselves. That said, it’s still pretty straightforward.
Apache Thrift is a software framework for cross-language: providing what is essentially a remote-procedure call interface to enable a client application to access services from a service — which can be written in the-same, or another language. Thrift supports all of the major languages that you’d expect to use: including Python, C++, Java, JavaScript / Node.js, and Ruby.
Unfortunately, whilst there are quite a few tutorials on how to use Thrift: some of them concentrate on explaining how Thrift is working behind the scenes (which is important, of course): rather than on how to use it.
XKCD #1313 Inspired by the famous XKCD cartoon that started it and by Google’s Peter Norvig over on O’Reilly.com, I decided to play some RegEx Golf myself this Easter…
If you’re not familiar with the game - the idea is to write the shortest regular expression possible that will select every element of a list, without selecting any elements from a second list. But what are regular expressions, you ask?
The Microchip MCP9808 is a high precision temperature sensor with an I2C interface – making it easy to interface with microcontroller or embedded Linux electronics. The chip has a very small form-factor: available as either an 8-pin DFN package – or an 8-pin MSOP package. For hobbiest purposes DFN is almost impossible to use due to the complexity of having to reflow solder under the contacts; and MSOP is quite challenging (though it can be done with care).
Xbee modules provide a very simple way to add a wireless capability to communications on Arduino. Essentially they let you work in exactly the same way as a direct serial connection between two boards – albeit wirelessly.
The easiest way to connect an Xbee to your Arduino, is to use the Arduino Wireless Shield.
It’s possible to connect Xbee’s without a shield – but given the fact that they don’t have the (standard) breadboard 0.
In my last post on using sysfs for GPIO on Raspberry Pi, I showed you how you can use the sysfs file system to manipulate the state of the GPIO pins.
This time, we’re going to explore how to do the same thing programmatically. I’m going to walk you through developing a C library to control the GPIO – but exactly the same principles could be used in any other language.
EDIT (August 2023) – The technique outlined here will still work, but it’s been deprecated for some time now – so I’ve written a new post about how to use the new methods…
The Raspberry Pi (in case you’ve been living under a rock for the last six-months) is a cheap ($25) ARM Linux computer, primarily designed to be used to help teach kids to learn programming & computer science.
In my previous posts in this series I looked at a couple of ways to use an Arduino to generate analogue waveforms.
In this third part I look at a much simpler, IC-based digital to analog (DAC) circuit to provide the waveforms, and look at ways of changing the frequency of the output.
Let’s start with the new circuit.
In part two of this series, I used an R-2R ladder resistor network built from discrete components.
… The MintyBoost is an open-source, small form-factor, USB charger which runs on AA batteries – and lets you charge your mobile phone, tablet or other USB device, without the need for mains power or a computer. It was designed by one of the leading proponents of the open-source hardware movement, LadyAda – aka MIT Engineering graduate: Limor Fried
All the details of the circuit can be found on the project’s web-site.
I’ve just picked up a BeagleBone…
BeagleBone is a small, low(ish) cost, open-source Linux computer on a board – using an ARM Cortex-A8 processor running at 720 MHz, with 256 MB of RAM. Unlike an Arduino – this is a fully-fledged computer. This makes it extremely powerful – and makes it a nice device to play with, to learn about embedded Linux.
This added power and sophistication does come at a cost though: this is not (or at least not currently) a tool for complete beginners in the way that an Arduino can be.
In my last few posts I’ve been writing about using an Arduino to generate waveforms. Part 3 of that series is still in the works (I’ve not forgotten, honestly!) – but this time I want to write about an alternative way to make a simple waveform: using good old analogue electronics, without the need for a microcontroller.
To do this we’ll use the ubiquitous NE555 timer chip (or just a 555 for short).
I’ve seen the future, and there are no mice in it.
Apple certainly have a history of setting the trends in popular computing. From the mass-market appeal of the Apple II, through to the revolution in mobile computing brought about with the iPhone & iPad; not forgetting, of course, the introduction of the mouse with the Macintosh in 1984…
Since then, the graphical user-interface (GUI) has become truly ubiquitous. Whether you favour Windows, Mac, Linux or a mobile device the GUI is the way we interface with our computers today.
Last time, we looked at some Arduino code that we could use to generate some square waves.
The problem with the setup we’ve been looking at so far, is that we can only produce signals of one amplitude – equivalent to the HIGH logic level.
In order to be able to produce any other waveforms we’ll need to be able to produce a variety of different output voltages. Although the PWM method we looked at last time gives us a way to do this, it’s not suitable for producing variable waveforms – as it’s time-based.
I was looking around for an interesting Arduino project, and I came up with the idea of making a function generator (also called a signal generator). The reason I picked a function generator is that it gives us the chance of playing with some interesting circuits – and some interesting code…
Before we start with that – what is a function generator?
A function generator is a circuit that generates some kind of waveform.
Google & Samsung have announced the details of the first generation of Chromebooks – thin-client laptops running Google’s Chrome OS & reliant on a web connection for all of their capabilities. But can they succeed in a competitive market-place?
The Chromebook is a nice idea. Thin-client (cloud) computing is becoming (if not yet the norm) common-place in many corporate data centres; but (to date) it’s not really been a viable option for the home-user.
I’ve just taken delivery of a device, which I believe, will mark the end of the paperback book as we know it: the Amazon Kindle.
Electronic books aren’t exactly new. E-readers of various types have been around for some time now – but never before have they had quite the flexibility & performance of the latest Kindle.
The single most important, and most striking, aspect of the Kindle is it’s fantastic eInk display.
I’m about to buy a new car; and with a bit of luck it’ll be the last oil-burning vehicle I ever own… But what it won’t be is an all electric car.
http://www.flickr.com/photos/handolio/3617292073/ – ‘Toyota Prius by Handolio, on Flickr’ Before I go on, a few disclaimers. Firstly I’m not any kind of tree-hugging hippie – in fact I am what might be described as a technophile: or (less charitably – but perhaps more accurately) as a geek… That said, I am concerned about the environment; and I do think that we probably oughtn’t to go polluting the place (whether you think man-made climate change is real or not 1).
Whilst you have quite a few outputs to play with on an Arduino board; sometimes there won’t be enough. One way to get around this is with the use of a shift register. This is a brilliant way to output eight pin’s worth of outputs – using just three pins. What’s more – it’s a fascinating insight into some elementary computer science…
I’m using the 74HC595 – purchased from the good folks at Oomlout.
There’s been a lot of comment about Apple’s new iPad – much of it very positive but not universally so…
It’s Cory’s point that I want to talk about here.
Before I start, I have to “declare an interest” (as it were) – I am an Apple fanboy; I admit that – but that doesn’t (or at least, I hope it doesn’t, make me unable to take a more dispassionate and reasoned view).