Tag Archives: Raspberry Pi

Monitor Your Solar System with a Raspberry Pi

Most photovoltaic systems contain parts such as the solar modules (panels) to provide the electrical power, a battery charger for converting the panel output to the battery voltage, a battery pack to store energy during the day and provide it during the night time, an inverter to transform the battery voltage to the proper line voltage for operating home appliances and an line source selector to switch between the solar and grid power.

When the sun is shining during the daytime, the solar photovoltaic cells convert the sunlight falling on them into electricity. Although the efficiency of the conversion may be only about 17%, solar power can easily reach 1KW/m2 and suitable panels can produce 5000 Watts in these conditions.

Solar panels typically produce a high voltage, 120V DC being a common figure. The battery charger has to convert this to match the battery voltage, generally 48V DC. Solar light power charges the batteries continuously during the daytime; therefore, the charger has to keep tracking the maximum power point to optimize the yield of the system. As the charger has to charge the battery also, this device forms the most elaborate part of the system.

With the above arrangement, the solar panels charge the battery during the daytime and the battery discharges during the night. The size of the battery depends on one day of consumption plus some extra to tide over an overcast day. That also decides the size of the solar panel. Batteries are essentially heavy and the lead-acid types generally have a lifespan of about 7 years.

The batteries feed the inverter, which converts the 48V DC into the line voltage – usually 230V AC or 110V AC. With a 5KW continuous rating, inverters can essentially run almost all household appliances such as the clothes dryer, the washing machine, the dishwasher and the electric kitchen oven. When the inverter is supplying a large load, the battery current may climb up to 200A.

Multiple sensors measure the solar field power from and temperature of the solar modules divided into arrays. The information comes to a PV panel via a CAN bus, which unites all the sensors. The PV panel also acts like a gateway between the CAN bus and a single board computer.

The tiny, versatile single board computer, the Raspberry Pi or RBPi is suitable for gathering data from the PV panel and storing them in a database. On the RBPi is a web server connected to the home Ethernet network.

Another set of sensors monitor the battery voltage, current and temperature. These are also on CAN bus and the information collects on a PV battery monitor board. A Wi-Fi module on the board acts as a gateway between the CAN bus and the Ethernet.

The boards and modules of the monitoring subsystem do not provide any interface with the user, except for a few activity modules. The system is meant for being supervised and controlled remotely. This is possible with a Web User Interface or an Android application.

Latest Touch Display for the Raspberry Pi

Those who were on the lookout for a proper touch display for their single board computer, the Raspberry Pi or RBPi can now rest easy. The official RBPi touch display is on sale at several stores and others will be receiving stock very soon. Users of RBPi models such as Rev 2.1, B+, A+ and Pi 2 can now use the simple embeddable display, instead of having to hook it up to a TV or a monitor. Watch the You-Tube video demonstration for a better understanding.

The new official touch display for the RBPi is a 7” touchscreen LCD. A conversion board interlinks the display module with the LCD and plugs into the RBPi through the display connector. Although the ribbon cable is the same as that used by the camera, the two do not work interchangeably. Therefore, identify the display connector first, before plugging in the ribbon cable from the display.

You can power up the display in one of three ways: using a separate power supply, using a USB link or by using GPIO jumpers. When using a separate power supply, you need a separate USB power supply with a micro-USB connector cable. The power supply must have a rating of at least 500mA and requires plugging in to the display board at PWR IN.

It is also possible to power the RBPi through the display board. For this, use an official RBPi power supply of rating 2A and plug it into the display board at PWR IN. Use another standard micro-USB connector cable from the PWR OUT connector and plug it into the RBPi power in point.

Powering the display from the RBPi GPIO requires using two jumpers – one from the 5V and the other from the GND pins of the GPIO.

After plugging in the ribbon cable and making one of the above power connections between the RBPi and the display, using the display requires updating and upgrading the OS on the RBPi. On rebooting, the OS automatically identifies the new display and starts to use it as its default display rather than the HDMI. To allow the HDMI display to stay on as default, the config.txt file must contain the line:

display_default_lcd=0

For further setup steps, follow these instructions.

The RBPi display comes with an integrated 10-point touchscreen. The driver for the touchscreen is capable of outputting both full multi-touch events and standard mouse events. Therefore, it is capable of working with ‘X’ – the display system of Linux, although X was never designed to work with a touchscreen.

For finger touch operations in cross-platform applications, the Python GUI development system Kivy is a great help. Although designed to work with touchscreen devices on tablets and phones, Kivy works fine with RBPi.

The 7” touchscreen display for the RBPi is of industrial quality from Inelco Hunter and boasts of an RGB display with a resolution of 800×480 at 60fps. It displays images with 24-bit color and a 70-degree viewing angle. The metal backed display has mounting holes for the RBPi and comes with an FT5406 10-point capacitive touchscreen.

The GoPiGo Robot Kit for the Raspberry Pi

Making a robot work with the tiny computer Raspberry Pi or RBPi has never been so easy. If you use the RBPi robot kit GoPiGo, all you will need is a small screwdriver with a Phillips head. The GoPiGo kit comes in a box that contains a battery box for eight or 6 AA batteries, two bags of hardware, two bags of acrylic parts, two motors, the GoPiGo board and a pair of wheels. For assembling all this into a working robot, follow these step-by-step instructions.

You start with the biggest acrylic part in the kit, the body plate or the chassis of the GoPiGo. Lay the plate on the GoPiGo circuit board and align the two holes with those on the circuit board. Place two short hex spacers in the holes below the body plate to make sure of which way is the upper side.

Next, you must attach the motors to the chassis. Use the four acrylic Ts in the kit for attaching two motors. Do not over tighten the bolts while attaching the motors, as this may crack the acrylic.

With the motors in place, it is time to attach the two encoders, one for each motor. These encoders fit on the inside of the motors and poke through the acrylic chassis of the GoPiGo. Encoders are an important part, providing feedback on speed and direction of rotation of the motor. If the encoders will not stay on, use blue ticky tacky to make them stay.

Now it is time to attach the GoPiGo board to the chassis. Place the GoPiGo board on the spacers and line its holes with the holes in the board before holding them together with screws. Two hex supports on the back of the GoPiGo board allow you to attach the castor wheel.

That brings us to attaching the wheels to the GoPiGo. You must do this gently, backing the wheels so they do not touch or rub against the screws. The battery box comes next, to be placed as far back on the chassis as possible. This gives it extra space and prevents the box from hitting the SD card on the RBPi.

This completes the mechanical assembly of the GoPiGo robot and only the RBPi remains to be attached. Locate the black plastic female connector on the GoPiGo and slide the GPIO pins of the RBPi into this connector. The RBPi remains protected by a protected plate or a canopy that has to be attached by screwing it on to the chassis.

Make the electrical connections according to the instructions. Be careful while flashing the GoPiGo hardware and leave the motors unconnected during the flashing. After connecting the GoPiGo for the first time, if you find any motor running backwards, simply reverse its connector.

GoPiGo comes with an ATMega 328 micro-controller, operating on 7-12VDC. SN7544 ICs handle the motor control part, which has two optical encoders using 18 pulse counts per rotation and a wheel diameter of 65 mm. External interfaces include single ports of I2C, Serial, analog and digital/PWM. The idling current consumed is about 3-500 mA, and full load current is 800 mA – 2A with both the motors, the servo and the camera running with the RBPi model B+.

A Raspberry Pi HAT with 16-Channel PWM Servo

DC servo motors are a few of the things that the single board computer, Raspberry Pi or RBPi, finds uncomfortable. The reason being the specific and repetitive timing pulses these motors require for setting their position, which the RBPi is unable to provide in the absence of a real time clock. Although the Linux kernel can do the job, it leaves the RBPi rather over taxed.

A HAT or Hardware Attached on Top board eases the situation. It takes care of all the timing requirements, runs and controls 16 Servos, and is capable of delivering pulse width modulated or PWM signals up to 1.6 KHz using 12-bit precision. Additionally, all this is completely free running that leaves the RBPi to handle everything else.

The 16-Channel 12-bit PWM/Servo HAT from Adafruit can drive 16 servos simultaneously or output PWM signals. It communicates with the RBPi through only two pins using the I2C protocol. Additional RBPi processing overhead is not required for the on-board PWM controller on the HAT board to drive all the 16 channels at a time. Moreover, you can stack more HAT boards – up to 62 of them and control 992 servos – all with only the same two pins.

Adafruit offers a Python library that you can use to immediately set up and run the servos to make your robotic system come to life. When you need to run several servos, this HAT and the Python library to go with it are the simplest and perfect solution.

The HAT board requires two levels of DC voltages. The 3V3 DC comes from the RBPi to power the PWM chip and to decide the logic levels for the PWM signals and the I2C signals. The voltage is available as soon as you plug in the RBPi – shown by the PWR or the red LED on the RBPi.

The other voltage is required for the servos, for which you need to supply 5-6V DC. Usually, most servos will be happy with only 5V, and will work a little more strongly if you give them 6V. You can connect this supply via the DC jack or the blue terminals on the HAT board. A reverse-polarity diode protects the board in case you have the wires connected in reverse. However, do not use both the DC jack and the terminal block at the same time.

Keep in mind that servos need a lot of current from the 6V DC supply. Even if you are using micro servos, they will draw several hundred mA when moving. Larger servos will need more power and you should have provision of about 2A for up to four servos. That means it is not recommended drawing this power from the 5V supply of the RBPi, as it could cause your RBPi to behave erratically. Keeping the servo power supply and the RBPi power supply totally separate gives good results.

On the RBPi, there is a place for soldering a through-hole capacitor. It is a good idea to use one if you are driving many servos. Switching motors generate dips and spikes on the power lines and these can upset the RBPi. A capacitor takes care of the sudden variations – use n*100µF, where n is the number of servos.

Make Your Raspberry Pi Follow Walls

The versatile single board computer, the Raspberry Pi or RBPi, makes an excellent base for an autonomous bot using a rover 5 platform. The bot uses custom laser range finders for basic wall following. It features speed control of each track, regulated by PID using feedback from its quadrature encoders, giving it the ability of directional control. The basic features are explained below.

Batteries power the bot, feeding two separate switching mode regulators. One supplies power to the motors via the H-bridge, while the other powers the RBPi and other electronic devices. The H-bridge and the SMPS reside on the lower layer of the bot, while the sensors and the RBPi are on the upper layer. Mechanical standoffs separate the two layers, and the physical separation between the two layers creates a barrier for the electromagnetic fields from the power system that would otherwise affect the compass.

A Pixy CMUCam and a line laser form the laser range finding system of the bot. A simple piece of PVC pipe with slots cut into it breaks up the beam from the line laser. That allows the cam to recognize the color of the laser blobs as it reports this data via I2C to the RBPi, which then uses simple trigonometry for converting the data into vectors representing range and angles.

A sonar device mounted on the front of the bot implements a fairly simple crash prevention mechanism. The laser range finding system may also be used for a more sophisticated crash prevention system. Even though the bot is meant for autonomous operation, it also has a basic user interface built-in to allow control for testing purposes. The interface allows simple operations such as setting the heading and limiting the forward and backward speeds. It uses some feedback from the current heading of the robot.

For testing the laser range finding, the bot has a built-in GMR or graphical mapping representation, but in a minimal configuration. Using the GMR reveals a basic difference between the mapping from the sonar device and that from the laser range finder. For example, the sonar data interprets long flat surfaces as convex, but the data from the laser shows them to be perfectly straight – implying the laser range finding is linear.

A custom mount holds both webcams and the laser line. As the cases of the webcams made it difficult to mount them, they had to be removed from their casings. One of the cams faces 25-degrees to the left, while the other faces 25-degrees to the right. That gives a 100-degree field of view to the bot. Both the cams are tilted upwards such that the bottom-line of their images is just below the horizontal.

The software processes the images and locates the laser line to calculate ranges. It makes 30 vertical scans from the top of the image looking for the laser line. Looking specifically for a laser line makes it simpler as the line is never vertical. Therefore, every point located on the line has a neighboring point.

A New Raspbian for your Raspberry Pi

Your single board computer, the Raspberry Pi or RBPi runs an operating system, or more specifically a Linux OS. Keeping true to its form, the Linux OS comes in umpteen flavors and you can choose and pick the one most suitable to your purpose. Operating Systems are built for the processor in the system, and the most popular so far are the Intel family of processors. Since SBCs generally use the ARM family of processors, a special version of the Linux OS is available for them. Of the many versions of the Linux OS for the ARM processors, the Raspbian is the most popular. A new version of Raspbian is now available.

Although people consider versions of operating systems primarily as updates and bug fixes, the new Raspbian is something more. The existing Jessie image used for the desktops and laptops has been modified and adapted to work with the ARM family of processors. Among the standard applications that come with Raspbian, many have been upgraded to offer newer features.

The new Raspbian offers Sonic Pi, version 2.9. If you view the history section of the Info window in Sonic Pi, you can read the full list of changes. The most important are two new effect functions – all articles of SAM Aaron of The MagPi magazine are now included as part of the online tutorials, and there is a new logging system.

Scratch, at version 20160115, has an improved capability for sound input, and supports the CamJam Edukit 3 robotics board. It offers basic PWM support in its GPIO server, and adds several improvements to the font scaling and display.

You will get the new Mathematica at version 10.3 with added support for additional functionality as described by Stephen Wolfram in his book. It supports Sense HAT, includes several new functions, and adds more interfacing to the Arduino.

WiringPi library has been upgraded to version 2.31 and now it allows access to the GPIO pins without use of the the sudo command from applications that use the library. Another Python library, the Rpi.GPIO is at version 0.6.1, and includes several bug fixes that plagued the GPIO Zero library. Additionally, the ping command does not require sudo anymore.

The ALSA system had earlier made it very difficult to get some USB devices to work as the default output. Now it has a new volume/audio device icon on the taskbar. That allows it to be compatible with a wider range of audio devices than before.

With the improved Main Menu editor, you can now create new menus. Earlier, the LXDE desktop environment did not allow visibility of all other menus, and this has now been addressed to work correctly.

Overclocking options for the RBPi models 1, 2, and Zero boards are now available from the command-line and the RBPi Configuration GUI. Updated language translations are also available for those not using English.

Earlier, there was a wide selection of names in different places such as Trash, Rubbish Bin, and more. Now, the name is consistently Wastebasket everywhere when you set the desktop to British English.

PIXY: Versatile CAM for Your Raspberry Pi

If you are looking for a small, fast, low-cost, easy-to-use, and readily available vision system for your Raspberry Pi or RBPi, then the Pixy can be a great choice. Pixy or CMUCam5 is somewhat more than a normal camera that you may have used so far for your single board computer. It comes with several features not available on most camera systems.

First, Pixy is versatile – use it for all kinds of projects. Along with the hardware, you will receive all kinds of information – PCB layout, bill of materials, schematics, and other hardware documentation. All software/firmware is GNU-licensed and open-source. The configuration utility provided with Pixy runs on all platforms – Windows, MacOS, and Linux. RBPi can communicate with Pixy over one of several interfaces – analog/digital output, USB, UART, I2C, or SPI. The Pixy comes with all libraries for RBPi, BeagleBone, and Arduino and supports programs written in Python and C/C++. The cable provided with Pixy can connect directly to Arduino, and it also works with BeagleBone and RBPi.

On the performance side, Pixy can learn to detect and recognize objects that you have taught it and outputs what it detects 50 times per second. With a Pixy, an RBPi and a servo control board, you can reconstruct Wall-E, the waste-collecting robot.

Pixy resulted from a partnership of the Carnegie Mellon Robotics Institute with Charmed Labs. First started as a Kickstarter campaign, Pixy is now the most popular vision system since it first started selling in March 2014. You can gage the versatility of Pixy from the activities it can do in association with an RBPi – pick up objects, chase a ball, locate a charging station, and more – doing all this with a single vision sensor.

Although there are other vision systems that can sense or detect practically anything, almost all of them have two drawbacks. One, they output huge amounts of data, a few megabytes per second. Two, enormous computing power is necessary to process this data, leaving the attached SBC with little else to cater to other tasks.

Pixy gets around these barriers as it pairs a powerful and dedicated processor along with its image sensor. The processor does all the processing of the data captured by the image sensor, and sends only the relevant information to the attached SBC. For example, yellow ball detected at x=50, y=110. Therefore, the RBPi can easily talk to Pixy and still have enough computing power left over for other activities. That also means you can have multiple Pixy cams hooked up to your RBPi. For instance, you can make a robot with a 360-degree sensing capability with four Pixys.

Although Pixy began with interfacing capabilities with the Arduino controller, it has matured sufficiently to be able to communicate with other controllers as well. The Pixy comes with all sorts of software libraries and a Python API for connecting to Linux-based controllers, such as an RBPi.

On-board Pixy is a color-based filtering algorithm that helps in detecting colored objects. The popular color-based filtering method makes Pixy singularly fast, efficient, and relatively robust. Pixy examines each RGB pixel from the image sensor and computes the saturation and hue to use as its primary filtering parameters.

An Energenie Pi-Mote controller Board for Your Raspberry Pi

Those looking for a low-cost automation and home control solution can use the Pi-Mote controller board from Energenie. The Pi-Mote controller board is an add-on for your single board computer, the Raspberry Pi or more simply, RBPi. With this combination, you can control electrical appliances connected to special radio controlled electrical sockets.

Working at 433.92 MHz, the Pi-Mote controller board for radio-controlled sockets is easy to install and command. The product offers a safe and simple way to let your RBPi control mains powered devices and appliances. The Pi-Mote controller board from Energenie is compatible with all RBPi models such as the A, A+, B, B+ and B2.

The Pi-Mote controller has a range of up to 30 meters and puts out an output power of 3V, 27mA at +12 dBm. The output is encoded at four data bits, offering a 20-bit address pre-set with OTP. The user can select the output modulation with software from OOK or FSK.

The product actually comes in two parts, the RF board and the electrical socket. The RF board attaches to the RBPi for controlling several 13A, 3-pin electrical sockets. Although the original Energenie sockets are meant for use in the UK, plug adapter sockets are available, which make these almost universal. You can also get kits with a 4-way extension lead and other compatible sockets from Energenie. All can be controlled from the Pi-Mote controller board.

A small Python program allows the add-on RF transmitter board to control up to 4 radio controlled sockets simultaneously by toggling the socket on and off individually. The add-on board attaches to the GPIO pins of the RBPi. In its basic form, each board transmits a frame of information to the sockets. The frame is made up of a 20-bit address and a 4-bit control data. Additionally, the frame uses the On-Off Keying or OOK technique, a basic form of Amplitude Shift Keying or ASK. The source addresses are pre-programmed and the user cannot change them.

When using the Pi-Mote controller, you are required to insert the radio-controlled socket into the mains wall socket and switch it on. The socket then enters a learning mode, which is indicated by the slowly flashing LED in front of the socket housing. You can force a socket to enter the learning mode at any time by pressing the green button on its housing form, holding it for five seconds and releasing it.

Once it is in the learning mode, send the socket a signal from the program running on the RBPi. The LED on the socket housing gives a brief flash and stops glowing. This indicates the socket has accepted and memorized its address. You can then program the rest of the three sockets in turn; otherwise, they will react to the same address. When using more than one socket, insert each into separate mains wall outlets, maintaining a physical separation of at least 2 meters so they do not interfere with each other. The sockets must not be put into a single extension lead.

Expand the Ports of your Raspberry Pi

The ubiquitous single board computer, the Raspberry Pi, or the RBPi, as it is fondly called by its users, is rich in General Purpose Input Output or GPIO pins. These are lined up on the board in two rows of 13 easily accessible pins, totaling 26 of which 17 are GPIO pins, the others being either power or ground pins.

GPIO pins provide a physical interface between the RBPi and the external world. Speaking plainly, these act as switches that the user can turn on or off as inputs or the RBPi can turn on or off as outputs. GPIO pins are physically arranged along the edge of the RBPi board, next to the yellow output socket for video.

To allow the RBPi to interact with the real world, you can program the pins in amazing ways. For example, there need not be a physical switch to connect inputs. Inputs can come from a signal from a device such as another computer or a sensor. Similarly, outputs can be made to do almost anything, such as sending data or signal to another device such as an LED.

One of the advantages of having an RBPi on a network is you can control devices attached to it from remote places, while collecting data from those devices. Connecting to and controlling physical devices over the Internet is exciting and a powerful feature best done by the RBPi.

However, some applications demand more input and output pins apart from the 17 that are available on the RBPi. That requires the user to expand the GPIO pins and this they can easily do by using the Quick2Wire Port Expander board. The board adds 16 more GPIO pins to the RBPi’s 17, so you can now have 33 GPIO pins with one expander board.

Additionally, you can stack more boards to have more GPIO pins. Each expander board can be preset with a configurable address via DIP switches on-board. Since eight addresses are possible, you can add eight more boards. Each board communicates to the RBPi via the I2C bus.

The Inter Integrated Circuit Communication protocol, called I2C in short, links the micro-controller or microcomputer to other micros or circuits. Another similar protocol is the Serial-Parallel Interface or the SPI. Both protocols are widely used for robotics and hobby electronics projects.

NXP (originally Philips) developed the I2C protocol. This is a very popular protocol used in several equipment including computer motherboards, monitors and TVs. Although a very flexible protocol, I2C is rather limited in its bandwidth.

Freescale (originally Motorola) developed the SPI protocol, which is much faster as compared to I2C. However, it is somewhat more complicated to use and has its own limitations.

Modern micro-controllers now support both protocols. These include the RBPi, Arduino, BeagleBone and BeagleBoard. Therefore, with I2C, you can control a host of devices, treating them as slaves and using two lines SDA and SCL. With SPI, data rates of over 10 MHz are common. Data transfer happens over three lines, one of which carries the clock and the other two communicate between the master and the slave.

Cool your Raspberry Pi with PiCoolFan

Applications for the single board computer, the Raspberry Pi or RBPi are exponentially increasing and there is a great demand on the RBPI for extending its performance to the limits. While users try to push their RBPi to achieve higher results with overclocking, this may result in SBC frying itself, unless the CPU temperature is kept in check.

To enable complete control over the CPU temperature, an advanced cooling fan system is available – PiCoolFan. On the bonus side, the system also includes a Real Time Clock that RBPi does not have in-built. Therefore, if your RBPi is running hot, for whatever reasons, you can use the PiCoolFan to keep its CPU cool. The applicability extends to all models of the RBPi.

The cooling fan does not require any additional power supply to operate. It draws its power from two GPIO pins. You simply have to insert the connector on the PiCoolFan on top of the P1 connector of the RBPi. A dedicated sensor on the PiCoolFan continuously senses the PCB temperature of the RBPi, feeding the readings to an embedded temperature measurement system on the PiCoolFan. Depending on the measured temperature, the micro-controller on-board the PiCoolFan will start, stop or regulate the rotational speed of the tiny fan.

As an added advantage, PiCoolFan contains an Air Distribution Plate, which cools not only the microprocessor on the RBPi board, but also all the heat-generating devices and the entire RBPi PCB. The RBPi user can easily access the embedded micro-controller on the PiCoolFan via the I2C interface. Apart from being able to read the temperature measured, the user can also set the temperature threshold and the temperatures at which the micro-fan will start and stop.

The PiCoolFan also offers on the same board a real time powering voltage monitoring and a real time clock with full battery backup. The entire unit is small enough to be included within most of the already existing cases of the RBPi. Apart from reading the temperature via I2C interface, PiCoolFan offers the user an information system based on three LEDs. A glowing blue LED assures the user the RBPi is comfortably within the allowed operating temperature range. If the temperature exceeds the range, the red LED will start to glow.

A flashing green LED indicates the powering status. When the voltage is within threshold limits, the flashes are continuous. When higher than the threshold, the frequency of the flashes increases. If the voltage is below the threshold limit, the frequency of the flashes decreases. Therefore, with a transparent case, it is easy to see from a distance whether the temperature and voltage of the RBPi system is within specified limits.

The user has complete control over the PiCoolFan system via the I2C interface. The fan can be switched on or off unconditionally and its speed controlled by pulse width modulation or PWM. The user can read the current system temperature and set the temperature threshold – PiCoolFan supports both the Celsius and the Fahrenheit scales. The PiCoolFan kit contains all the hardware necessary for setting up the fan and the air distribution plate.