Category Archives: Raspberry Pi

ElectroSmash Pedal for the Raspberry Pi

Guitarists favor expensive gear. For instance, they hold online discussions about the best types of wire for guitar pickups. They even go to great lengths while selecting the type of transistors that will give them the best fuzz tone. They hold extensive discussions about the merits of the pentode rectifier over the tetrode type. While the geeks in the electronics world share several common characteristics with the guitar geeks, the ElectroSmash Pedal Pi would interest both.

Both teams are already familiar with the single board computer, the Raspberry Pi (RBPi). ElectroSmash provides a pedal that works with the RBPi Zero and allows the user to program the effects. The brains behind the project are in the code that the user has to download and compile on the RBPi.

Although it is possible to write the code afresh, but downloading the sample provided by ElectroSmash is more sensible, and gets you started faster. The community behind the Pedal Pi has contributed the code, and the user has the complete freedom to use it as it is, or to modify the parameters. ElectroSmash provides the Pedal Pi in a kit form, which means owners have to assemble it first.

Instructions for the assembly are available from the ElectroSmash website. The kit comes with all components neatly labeled, which makes the kit easy and straightforward to put together. One does not need extensive soldering experience for the assembly.

The kit has two ICs, the first an op-amp, and the other an analog to digital converter chip. Follow the instructions on the ElectroSmash site to place them on the board the right way around.

Typically, the RBPi Zero comes with the header pins not soldered to the board, and the user has to do the placement and soldering. However, one can get around this problem by using the RBPi ZWH variant, as this board comes with the header pins soldered in place.

Once you have assembled the pedal, you may find it is not as robust as the regular guitar pedals available on the market. According to ElectroSmash, the aim of the Pedal Pi project is to offer learning about guitar pedals and having fun with them. As an electronics kit, the ElectroSmash Pedal Pi kit certainly lives up to its claim.

Although the kit may seem slightly expensive, comparing it with other guitar pedals shows its true value. For instance, the distortion pedal from Ibanez, the classic Tube Screamer, costs almost twice the full kit. Although the ElectroSmash kit has about ten other effects built in, the user can add many more—in fact, only the programmer’s ingenuity, imagination, and programming skills limit the range of effects that the kit can handle.

Following the code sample that ElectroSmash provides is simplicity itself. They list the code sample in order of increasing complexity, ranging from the simple tone to the looping effect. The user can have fun playing with different types of distortion and use a processed quality on the fuzz, bit-crusher effect, and distortion. The effects are all available in the file fuzz.c and one can change a few numbers to give a new effect.

A Smart Development Board for the Raspberry Pi

The Raspberry Pi or RBPi single board computer when fortified with Cloudio makes a personal IoT computer that users can play with or use for prototyping. Cloudio, the add-on board suitable for the RBPi, offers advanced features such as sensor monitoring and displaying on dashboard, providing custom notifications with image and video, unlimited cloud services, one tap upload for multi-boards, voice assistant capabilities, IFTTT integration, drag and drop programming for Android and iOS, and much more.

As a smart development board kit, Cloudio offers drag and drop programming using the included GraspIO Studio app. Users get a block-based approach that is fairly intuitive. For IoT developers, this approach allows them to reach their goals faster, as the simple but powerful mobile IDE simplifies the complexity of software development.

On the hardware side, the Cloudio kit includes an OLED display, a light sensor, temperature sensor, a mini servo port, a tactile switch, three ADC ports to handle external sensors, three ports for digital outputs, an RGB LED, and a buzzer. This provides the user nearly all the tools necessary for an IoT project. On the software side, the kit comes with the GraspIO, which provides unlimited cloud service, allowing the user to program and manage Cloudio from their mobile devices.

GraspIO provides the user with a block-based feature. Users can treat program modules as blocks, dragging and dropping the blocks as necessary to combine them to achieve various functionalities. This feature offers users with an intuitive mobile interface.

Users can monitor the sensors they attach to the RBPi and arrange their response to be studied in a dashboard. They can set up sensor monitoring projects easily and configure the dashboard to exhibit their response in an intelligent and responsive manner. The kit allows plotting the sensor response in real-time graphs on a mobile device, and exporting data for IoT analysis.

Users can manage several Cloudio kits at the same time, as they can connect their mobile devices to the IoT Cloud Service. Therefore, users can connect to, program, control, monitor, and manage several kits with a single smartphone. The IoT Cloud Service comes with a lifetime offering of 100 daily non-cumulative calls, along with a bunch of 50,000 free preloaded calls.

The IoT Cloud Service also helps in voice control and speech recognition. Users can create their own voice assistants, and add custom voice commands including their own wake-word.

For instance, with the Cloudio Smart Development Board hooked up with the RBPi, a user can interface the RBPi and a USB camera, using the in-app camera block to capture images, videos, and even create GIFs or time-lapse videos. The user can add several features to their projects, including custom email, images, and video notifications.

The Cloudio kit enables features such as adding speech outputs to projects. Therefore, users can make their projects respond with voice outputs, using the easy to use in-app speak block that comes along with the kit. Other features the kit offers are creating real-time speech notifications, custom messaging, or playing recorded audio from the board.

Industrial Controls and the Raspberry Pi

Industries with control equipment prefer to use a standardized system of mounting components such as circuit breakers within equipment racks. The most popular arrangement is the DIN rail and enclosure. The rails are typically made from a cold-rolled carbon steel sheet and zinc-plated or chromated for a bright surface finish. DIN is the acronym for Deutsches Institut fur Normung in Germany, and the rest of the world has adopted their standards as the EN and IEC standards.

The famous single board computer, the Raspberry Pi (RBPi) is becoming increasingly accepted as a development platform and a suitable solution for applications involving process controls. Some of these applications involve simple HVAC controls, power management, materials management, and gas detection, among a vast range. However, moving to the industrial arena means the RBPi needs to be fitted with a DIN rail enclosure.

That is exactly what VP Process Inc. has planned. Their series Pi-SPI-DIN of products, based on the RBPi, will all be DIN rail mountable, and hence, suitable for use in the industry. Their first product in the series is the RPi-3 controller, which will work from a wide range of input voltages between 9 and 24 VDC. It will provide RS485 Interface available on RJ45 connectors and Terminal Block. It will provide the RBPi with a real-time clock and battery backup with a CR2032 battery. The user will be able to make use of all the GPIO interfaces of the RBPi as they will be available on a 16/24 pin ribbon cable connector. The DIN rail enclosure will have LED indicators, and VP Process Inc. will be offering sample test programs in C and Python. The idea behind developing the RPi-3 is to allow the RS485 interface to communicate with all the eight channel modules available from VP Process Inc.

The first of the new series from VP Process Inc. is the PI-SPI-DIN-RTC-RS485, and this will be available with DIN rail mounting hardened interfaces in three mounting versions—with DIN rail clips, DIN rail enclosures, and PCB spacers.

The wide-ranging power input accepting any voltage between 9 and 24 VDC of the unit will produce an output of 5 VDC at a maximum current of 3 Amps. There will be two GPIO connectors, one belonging to the RBPi board, and the other is external for peripherals. Another 16-pin connector will provide the power, SPI, I2C, and five chip-enables for the PI-SPI-DIN series.

Apart from the RS485 interface, VP Process Inc. is planning for other peripheral units as well. These will include the eight-channel 4-20 mA module, four-channel relay output module with contacts rated for 2 Amps, eight-channel isolated digital input module, and four-channel 4-20 mA module.

VP Process Inc. will be providing each module with two 16-pin ribbon cable sockets and cables. Each of the connectors and cables will carry the main power supply input to the main interface, SPI bus, I2C bus, and the five GPIO lines serving as chip-selects.

To maintain compatibility with non-industrial uses, VP Process Inc. will also provide each peripheral as a PCB on spacers, apart from PCB with DIN rail enclosure or DIN rail clips.

Raspberry Pi to Linux Desktop

You may have bought a new Single Board Computer (SBC), and by any chance, it is the ubiquitous Raspberry Pi (RBPi). You have probably had scores of projects lined up to try on the new RBPi, and you have enjoyed countless hours of fun and excitement on your SBC. After having exhausted all the listed projects, you are searching for newer projects to try on. Instead of allowing the RBPi to remain idle in a corner, why not turn it into a Linux desktop? At least, until another overwhelming project turns up.

An innovative set of accessories converts the RBPi into a fully featured Linux-based desktop computer. Everything is housed within an elegant enclosure. The new Pi Desktop, as the kit is called, comes from the largest manufacturer of the RBPi, Premier Farnell. The kit contains an add-on board with an mSATA interface along with an intelligent power controller with a real-time clock and battery. A USB adapter and a heat sink are also included within a box, along with spacers and screws.

Combining the RBPi with the Pi Desktop offers the user almost all functionalities one expects from a standard personal computer. You only have to purchase the solid-state drive and the RBPi Camera separately to complete the desktop computer, which has Bluetooth, Wi-Fi, and a power switch.

According to Premier Farnell, the system is highly robust when you use an SSD. Additionally, with the RBPi booting directly from an SSD, it ensures a faster startup.

Although several projects are available that transform the RBPi into a desktop, you should not be expecting the same level of performance from the RBPi as you would get from a high-end laptop. However, if you are willing to make a few compromises, it is possible to get quite some work done on a desktop powered with the RBPi.

Actually, the kit turns the RBPi into a stylish desktop computer with an elegant and simple solution within minutes. Unlike most other kits, the Pi Desktop eliminates a complex bundle of wires, and does not compromise on the choice of peripherals. You connect the display directly to the HDMI interface.

The added SSD enhances the capabilities of the RBPi. Apart from extending the memory capacity up to 1 TB, the RBPi can directly boot up from the SSD instead of the SD card. This leads to a pleasant surprise for the user, as the startup is much faster. Another feature is the built-in power switch, which allows the user to disconnect power from the RBPi, without having to disconnect it from the safe and intelligent power controller. You can simply turn the power off or on as you would on a laptop or desktop.

The stylish enclosure holds the add-on board containing the mSATA interface and has ample space to include the SDD. As the RBPi lacks an RTC, the included RTC in the kit takes care of the date and time on the display. The battery backup on the RTC keeps it running even when power to the kit has been turned off. There is also a heat sink to remove heat built-up within the enclosure.

Let the Raspberry Pi Monitor Energy

If you are looking for monitoring energy remotely, an open source system that uses the ever-popular single board computer, the Raspberry Pi (RBPi) may be suitable. The company, OpenEnergyMonitor, makes the open-source tools for monitoring energy, and at present, they are using the RBPi3. According to their co-founder Glyn Hudson, the aim of OpenEnergyMonitor is to help people understand and relate to how they use energy from their energy systems, and the challenges of sustainable energy.

The system uses five main units. Users can assemble and configure these to work in a variety of applications. Both hardware and software in the system is fully open-source, and the hardware is based on Arduino and RBPi platforms. Users can opt to use the system for monitoring home energy, monitoring solar PV, and or monitoring temperature and humidity.

emonPi

When configuring the OpenEnergyMonitor system, emonPi, as a simple home energy monitoring system, it allows measuring the daily energy consumption and analyzing real-time power use. The all-in-one energy-monitoring unit, emonPi is a simple installation based on the RBPi, requiring only an Ethernet or Wi-Fi connection at the meter location.

Clip-on CT sensors on the emonPi enable it to monitor independently two single-phase AC circuits simultaneously. While the emonPi can monitor temperature, it has an optical pulse sensor to interface directly with the utility meters, which means the emonPi has to be installed next to the utility meter.

The emonPi comes with Emoncms, the open-source web application. This helps in logging and visualizing energy use along with other environmental data such as temperature and humidity. It has two power outlets and requires Ethernet or Wi-Fi to transfer data. The RBPi operates on a pre-built OS on an SD card included with the energy monitor. The 5 VDC power required has to be fed in from an external power supply unit.

As power is the product of voltage and current, the emonPi requires an AC-AC voltage sensor adaptor and a clip-on CT sensor. While the emonPi comes with one CT sensor as standard, it can accept two CT sensors.

emonTx

For remote monitoring, users can use emonTx, a remote sensor node as an alternative to emonPi. The emonTx runs as a standalone unit, with an ESP8266 Wi-Fi module running EmonESP. This can post directly to Emoncms without using emonPi or emonBase.

Users can monitor a maximum of four single-phase AC circuits with the clip-on CT sensors using the emonTx. A plug-in AC-AC adaptor powers the unit, and provides the AC voltage sample, which the emonTx uses for real-time power calculations. If AC power is not available, emonTx can be powered using four AA type batteries.

Optional LED Pulse Sensor for Utility Meter

This sensor allows interfacing directly with utility meters that have LED pulse output. It is compatible with emonTx and emonPi, and reports the exact amount of energy as the utility meter does. Although best used together with clip-on CT sensors, the LED pulse sensor cannot measure instantaneous power.

emonBase

This is a web-connected gateway, consisting of an RBPi and RFM69Pi RF receiver board. It receives data via a low power RF carrier at 433 MHz from emonTx or emonTH and offers local and remote data logging using Emoncms.

A Soundcard HAT for the Raspberry Pi

If you have been wondering how to use the popular Raspberry Pi (RBPi) single board computer for effects to be used with musical instruments such as the guitar, the Pisound board from Blokas may be the answer. With the Pisound board, any musician can connect any type of audio gear to the RBPi, and bring their project to an entirely new level. Pisound is a soundcard HAT for the RBPi.

HAT is an acronym for Hardware Attached on Top of an RBPi. HAT boards have an EEPROM that tells the RBPi the values of its variables specific to the device on the board. The HAT board will also have a GPIO connector to match with that on the RBPi, so that when plugged in, the HAT will sit atop the RBPi.

The Pisound HAT for the RBPi3 acts as a high-technology sound card. Not only does it allow sending and receiving audio signals from its jacks, but it can also send MIDI input and output signals to compatible devices. On board the card are two 6 mm input and output jacks, two standard DIN-5 MIDI input/output sockets, potentiometers for gain and volume, and a button for activating patches of manipulating audio. The Indiegogo campaign has given the Pisound board an incredibly successful start.

The Pisound website offers excellent documentation, making it a simple affair to set up the board. First, you have to mount the board atop your RBPi, matching the GPIO pins, and securing it with screws. Next, download and install a fresh installation of the Raspbian OS and set up the software according to instructions from the website. The only thing that remains now is to connect the instrument and create patches for Pure Data. This is a popular visual programming interface to manipulate media streams.

The possibilities with Pisound are endless. For instance, you can create simple fuzz, delay, and tremolo guitar effects. Limited only by your imagination, you could come up with endless ideas.

For example, the guitar effects could go into a web interface, accessible over a local network on a tablet or smartphone. On the other hand, with the characteristics of the guitar signals, you could control an interactive light show or project visualization on the stage. One of the advantages of the Pisound is you can use the audio input stream basically to generate other non-audio activities.

The compact and practical size of the project makes it convenient for embedding it within one of your instruments say the guitar. However, it is always possible to design and fabricate a custom enclosure for the board and the RBPi.

Sonic Pi, a musical community favorite, has also pledged to support the board very soon. That means even if you do not own a musical instrument, or play one, you can still make awesome sound effects with this clever little HAT.

You can load patches from Pure Data using a USB key. The button on the card makes it easier to interface with the RBPi. Moreover, it you are familiar with Automatonism, it will be easier for playing with the Pisound just as if it were a modular synthesizer.

How to Simulate the Raspberry Pi?

You may have an urgent project that requires the use of a Raspberry Pi (RBPi), but do not have immediate access to a physical kit or the SBC. However, that should not hamper your progress with the project, as Microsoft is now offering an online RBPi simulator. The online RBPi simulator allows users to write code for controlling emulated hardware. Therefore, for the present, users can interact with a sensor to collect data from it and control an LED.

On the simulator, the user has a graphic of an RBPi wired on a breadboard to a combined humidity, temperature, and pressure sensor, along with a red LED. On a side panel, the user can enter JavaScript code as Node.js, with which, they can control the LED while collecting dummy data from the simulated sensor. A command line at the base of the panel allows execution of the code.

When loaded, the simulator starts with a sample program, which the user can use to collect temperature from the sensor and display it on the command line. Tutorials are available from Microsoft on running this code, and for this, the user has to first sign into Microsoft’s Azure IoT Hub, and select the free tier service option. Microsoft has designed the simulator to be compatible with a real RBPi. Therefore, anyone can test their code for controlling hardware using the RBPi, before they are ready to transfer their code it to a real device.

According to a Microsoft employee, Xin Shi, the simulator is presently in preview, offering only basic functionality. That means the embedded image of the RBPi is static, allowing only a limited interaction with the sensor and the LED. There are plans for emulating new devices and sensors, but there is no timeline. Moreover, the simulator’s code being open-source, anyone is free to work on expanding the simulator.

However, this is not the first time a simulator has been designed for simulating RBPi controlled hardware. Working with the US startup Trinket, the Raspberry Pi Foundation had created a web-based emulator for Sense HAT. This is an RBPi compatible add-on board bundled with several sensors, a joystick, and a matrix of LEDs.

Just as the Microsoft simulator does, the emulator for the Sense HAT also allows users to work with Python codes for interacting with the add-on board. Compared to the Microsoft simulator, the emulator from the Foundation offers users a greater number of sensors to interact with, and allows the user to have more control over the simulated version of the LED matrix on the board.

On the website, users have a choice of four Python programs. The first one allows selecting temperature, pressure, or humidity sensors, and manipulating the sliders to change the readout of the LEDs. The second is a game of rock, paper, and scissors, which the users can play using arrow keys to select while competing against the RBPi. The third is another game where a small bird has to fly through obstacles, and the fourth is a game of Astro Bug, which has to eat the food, while avoiding enemies.

Raspberry Pi Controls the Cardboard Dog

This is a project for beginners using the Raspberry Pi (RBPi) single board computer. The RBPi is used to control a servo for turning the head of a cardboard dog away whenever a person is looking at it. This is to mimic a begging dog that seems ashamed of its begging nature.

This project requires the SBC RBPi, its power supply with the 5 V micro-USB cable, a USB keyboard and mouse, a display, and an HDMI cable. For storing the OS, an 8 GB micro SD card is also necessary. Another computer will be necessary to write the OS to the micro SD card and edit the files in it. The official PI camera will help to recognize the faces looking at the dog, and a micro servomotor is required to turning the head.

The RBPi will be controlling the servo through its GPIO pins. The servo has three wires that need to connect to the GPIO pins using female connectors. The camera has a ribbon cable, which goes into the port labeled camera on the RBPi. The HDMI cable goes into its port on the outside of the RBPi, and its other end goes to the HDMI-compatible TV or monitor.

Download and install the latest version of the Raspbian (with Pixel) from the official website of the RBPi. While installing the image on to the micro SD card, the process will destroy all data on the card, so be sure there is nothing of value before you begin.

Once the OS is installed on the micro SD card, insert it into the slot on the reverse side of the RBPi. If the power cord is now plugged into the RBPI socket and the power turned on, there should be some code running on the monitor screen, with the desktop showing up at the end. At this time, right click anywhere on the desktop and select “Create a New File.” Name the file Dog Turn.py, and select it to open with Python 2 IDLE.  Now open IDLE, and paste the code from here into it.

To make the code in the file to work, the RBPi will need additional Python modules to be installed. These are the libopencv-dev, python-opencv, python-dev, and you must use the sudo apt-get install command to download them.

The cardboard dog for this project uses four 9×6 inch cardboard rectangles, and two 6×6 inch squares, which form the main body. A hole at the top of the box allows the servo to go through. Another 5-inch cardboard cube forms the head, and attaches to the servo. Some cardboard legs make the dog look more realistic.

The entire electronic hardware can fit within the body of the dog. It may be necessary to use standoffs to hold the RBPi in place. The camera should look out from one of the eyeholes in the dog head. Fix it in place so that the cable has sufficient play when the servo moves the head. Simply running the python code should be enough to let the dog do its trick. To stop, turn off the power.

Sensor Nodes Based on the Raspberry Pi

Building sensor networks is economical if a microcontroller hosts the sensors. However, sometimes the computational power a microcontroller offers is not adequate. For instance, it may be necessary to convert the data to a different format, print a hard copy of the sensor data, or incorporate the data within an application. What you need is a computer that not only has more processing power, but also allows the use of common applications, affords access to peripherals, and permits the use of scripting languages.

Although the use of an inexpensive personal computer would be of great advantage here, using them as sensor nodes in the networks has its own disadvantages. The primary hurdle is most personal computers are built for use as servers or desktop computers, and almost no general-purpose input/output ports are available. Of course, a data collection card added to the personal computer will serve the purpose, but the cost of the computer added to that of the data-collection card makes the cost of the sensor node uneconomical.

Fortunately, single board computers such as the Raspberry Pi (RBPi) provide an easy solution to the above problem. With sufficient processing power and memory, use of standard peripherals, supported programmable I/O ports, and a small form factor, the RBPi is the most suited for building sensor networks economically.

Essentially, the RBPi is a single board computer that runs Linux as its operating system. To get started with the RBPi, you need a few additional things, such as a USB power supply rated at 2 A with a male micro-USB connector, an HDMI monitor, a keyboard, an optional mouse, and most importantly, an SD card to hold the OS.

The most commonly used operating system for the RBPi is the Raspbian image provided by the Raspberry Pi Foundation on their download page. Once you have downloaded the image, you will have to unzip it and write it into an SD card. The easiest way to do this with a Windows PC is to use the Win32 Disk Imager software. Those on the Mac OS X or the Linux PC may use the dd command.

Now it is time to boot up your RBPi board. Plug in the SD card holding the new image, plug in the keyboard, mouse, and the monitor. Once all the peripherals are in place, plug in the USB power and turn on the power. When prompted to enter a username and password, use Pi and raspberry respectively, and configure the system to your requirement.

For connecting and experimenting with sensors, you may use expansion boards, but using a simple prototyping board instead is more flexible. Using a Pi Cobble Breakout board or similar allows a simple ribbon cable from the GPIO connector on the RBPi to the prototyping board, with the pins arranged in the same order as those on the RBPi are.

Be careful to make or change connections with the RBPi powered off. Also double-check all connections are rightly connected. The GPIO on the RBPi is not protected against short circuits and high voltages, and is easily damaged.

Voice HAT for Raspberry Pi for Controlling a Motor

If you were one of the unlucky ones to miss out on the issue 57 of the MagPi, then the only option is to buy the Voice HAT from the AIY projects. The issue 57 had offered a free AIY projects Voice Kit, which Google had developed to make a Voice Assistant, and you could control a speaker with the voice HAT that attached on top of a Raspberry Pi Zero (RBPiZ).

Other tutorials in the MagPi show how to connect the Voice HAT hardware to simple circuits.  So far, the tutorials have dealt with LED lights and servomotors, but this project is somewhat more complex—using the Voice HAT to control a DC motor. Therefore, you will need a DC motor, four AA size batteries, breadboard, and jumper wires.

Usually, the RBPiZ draws its power from the power supply on the Voice HAT board. For this project, this connection has to be broken, else the motor may draw too much power from the RBPiZ and short it. On the Voice HAT board, locate the external power jumper marked JP1, and use a sharp knife to cut the track. If you later wish the power to be shared again between the board and the RBPiZ, re-solder the cut joint.

Power off the RBPiZ and the Voice HAT, and connect the positive terminal of the DC motor to Driver 0, middle pin, which is marked with a “+” symbol. Same way, the negative terminal of the DC motor connects to the “–“ pin of the Driver 0. As this pin connects to the GPIO4 pin, it allows the motor to be turned on and off.

The four AA battery pack connects to the +V and GND pins on the Voice HAT. This ensures the motor is supplied adequate power from the battery pack and the Voice HAT and does not crash the RBPiZ when it draws power. Now turn on the power to the Voice HAT, and then turn on the battery pack.

At this point, you are ready to turn on power to the RBPiZ. Boot into the AIY Projects software and enter the code from motor.py for testing the circuit. The control to the motor comes from the PWMOutputDevice from GPIO Zero, and this allows managing the speed of the motor.

The motor is controlled via a Pulse Width Modulation (PWM) method. The RBPiZ controls the power to the motor by controlling the on and off periods. If the on period is more than the off period, the motor receives more power and therefore, rotates faster.

To manage the speed of the motor, you control the variables .on() and .off() in the software.  Alternately, you may set the value of the instance variable to a value between 0.0 and 1.0 for controlling the speed. Here, 0.0 means the motor is a dead stop, while 1.0 sets the motor to a maximum speed. The motor.py uses both techniques and you can also use pwm.pulse() for pulsing the motor on or off. To integrate this with the Voice Assistant, enter the code from add_to_action.py to the relevant sections. You can now control the motor using voice commands.