Raspberry Pi GPIO programming in C

Raspberry-GPIO

Steve Chamberlin has written an article about Raspberry Pi GPIO programming in C:

The Raspberry Pi’s 40-pin GPIO connector often gets overlooked. Typical Pi projects use the hardware as a very small desktop PC (RetroPie, Pi-hole, media center, print server, etc), and don’t make any use of general-purpose IO pins. That’s too bad, because with a little bit of work, the Raspberry Pi can make a powerful physical computing device for many applications.

More details at Big Mess o’ Wires homepage.

App note: How to properly configure unused operational amplifiers

an_ti_sboa204

Good read app note from Texas Instruments about configuring unused op amps on multi amp chips. Link here (PDF)

Multi-channel operational amplifiers (op amps) are often implemented in circuits that do not require the use of all channels. Undesired behavior in an unused amplifier channel can negatively impact system performance, as well as the performance of the channels in use. To avoid degradation of both the op amp and system performance, the unused op amp channels must be configured properly.

App note: Current sense amplifiers in class-D audio subsystems

an_ti_slva031

App note from Texas Instruments about output current sensing in class-D amplfiers. Link here (PDF)

Current sensing in audio subsystems are widely used in conjunction with CLASS-D amplifiers for diagnostics or to provide speaker current feedback to the DSP for speaker enhancement to emulate smartamp. The most expensive component in the audio subsystem is the speaker. The impedance of the speakers ranges from 2Ω for subwoofer to a 8Ω for stereo speakers. Exceeding the current flowing through the speakers has a potential to create excessive heat in the voice coil which can lead to permanent damage of the speakers.

Adding the Nokia 5110 LCD to your Arduino data logger

From the comments on our ChipKIT based weather station using BME280 sensor module post, Edward Mallon writes:

A lot of us have ended up at this sensor / screen combination. But I couldn’t afford the extravagance of six dedicated control lines on our little pro mini based loggers.
However with some slight modification, you can drive the Nokia 5110 LCD with only 3 control lines, and power the display from a digital pin

More details thecavepearlproject.org.

Inside the 76477 space invaders sound effect chip: Digital logic implemented with I2L

p-die-blocks

Ken Shirriff has written an excellent in-depth look at the 76477 sound effects chip:

The 76477 Complex Sound Generation chip (1978) provided sound effects for Space Invaders1 and many other video games. It was also a popular hobbyist chip, easy to experiment with and available at Radio Shack. I reverse-engineered the chip from die photos and found some interesting digital circuitry inside. Perhaps the most interesting is a shift register based white noise generator, useful for drums, gunshots, explosions and other similar sound effects. The chip also uses a digital mixer to combine the chip’s different sound generators. An unusual feature of the chip is that it uses Integrated Injection Logic (I2L), a type of digital logic developed in the 1970s with the goal of high-density, high-speed chips. (I wrote about the chip’s analog circuitry last year in this article.)

See the full post on his blog here.

Banana Pi DLNA media server

media-server-bpi-m1-dlna-600

Dilshan Jayakody published a new build:

Couple of months back we decided to create our own media server to store our MP3s and digital photographs. But it gets postpone several months due to unavailability of main-boards and other resources. Finally, after reviewing several prototypes we decided to build our media server using Banana Pi (BPI) and MiniDLNA. Before finalize BPI we checked several main-boards which including Raspberry Pi B+, Orange Pi One and BeagleBone Black. Out of all above main-boards we choose BPI M1 because of its inbuilt SATA2.0 interface, Gigabit Ethernet port and availability in local market.

See the full post on his blog here.

SI5351 VFO project

original-600

Dave Richards (a.k.a. AA7EE) has a nice write-up about building another Si5351 VFO project:

To many, this will be just another Si5351 VFO project, with nothing to distinguish it from the others. In fact, that’s exactly what it is. The “how to” of connecting an Arduino board to an Si5351 board, wiring up a display, and loading the firmware, is straightforward, and well established. To me though, it was a complete mystery.

See the full post on his blog here.

Teardown of a GM3120 electromagnetic radiation tester

GM3120-600

Kerry Wong did a teardown of a cheap GM3120 field strength meter:

There are a lot of cheap electromagnetic radiation testers out there which boast some quite impressive claims. So I decided to pick up a popular one (GM3120) from eBay to see how well it works. And perhaps more importantly, I wanted to take a look inside to see how the E field and H field sensing is done.
Most professional field strength meters feature a dome-like sensor. Housed inside are three orthogonally arranged antennas used for picking up field component in that axis. A cheap tester like the GM3120 clearly doesn’t utilize this kind of sensor topology and presumably can only discern field strength along a single axis.

See the full post on his blog here.

Check out the video after the break.

ESP32, PlatformIO

PlatformIO is an opensource ecosystem (as it’s defined in the homepage of the project) to develop IoT projects.

The heart of the platform is a software component named PlatformIO Core. This component includes:

  • a cross-platform compiler
  • a libraries and dependences manager
  • a serial monitor

PlatformIO Core is developed in Python and therefore it can run on different operating systems (Windows, Linux, MacOS).

Although you can use the Core component directly, PlatformIO’s strength lies in its IDE, which allows the development of multi-platform projects and integrates with the Core itself.

In this article I’m going to show you how to use PlatformIO to develop projects running on the esp32 chip.

Installation

PlatformIO IDE is provided as a plugin for two different development tools: Atom and VisualStudio Code. I tried both solutions and I preferred VSCode: both the installation and the use are simpler and more immediate.

Install VSCode after having downloaded the package from Microsoft’s website (the installer is available for Windows, Linux and MacOS).

Open the Package Manager:

pio-001

search the PlatformIO IDE package, then click on Install:

pio-002

wait until the installation is complete:

pio-003

Hello world

Now it’s time to develop your first program, which traditionally will display the sentence Hello world! on the terminal.

If it doesn’t show up automatically, open the PlatformIO’s homepage:

pio-004

then click on New Project:

pio-005

give a name to the project and choose a devboard based on the esp32 chip (in this example I’ll use a Lolin32 board by Wemos). PlatformIO supports both the esp-idf framework and the arduino-esp32 one. All my tutorials are based on the first one:

pio-006

PlatformIO automatically creates some folders for your project. Choose the src folder (it stands for source, that is the folder which will contain the source code) and create a new file:

pio-007

name the file main.c and type the simple program as it follows:

pio-008

run the compiler by clicking on the corresponding button in the bottom bar:

pio-009

the editor displays an error… indeed your code is using the printf() function without having included the library:

pio-010

add the missing line, now you should be able to complile the code without errors:

pio-011

PlatformIO can also upload the compiled program to your board. Thanks to its auto-detect feature, you usually don’t need to specify the serial port the board is connected to:

pio-012

Serial monitor

PlatformIO also includes a serial monitor you can use to test your program. By default, this monitor connects to the serial port with a speed of 9600 baud. The esp32 chip instead has a default speed of 115200 baud; you have therefore to change the platformio.ini file included in your folder as it follows:

pio-013

Now open the serial monitor; you should see the correct output of your program:

pio-014

Conclusions

I found the use of PlatformIO really immediate: after a few minutes I was able to develop, compile, load and test a program. Try it and leave a comment with your impressions!