Category Archives: Raspberry Pi

Control your computers from anywhere with the Raspberry Pi

If you are one of those who often need to use the home computer from a remote location, then you need a Web-based application that can power your home computers up or down. For example, you may have a specific file or folder on your home computer that you urgently want to access but cannot do so because you are in a different location.

Keeping the home computer always powered on is not a great idea, even though it allows remote connections when required. For one, an always-on computer consumes power unnecessarily. Additionally, if there is a crash, there is no way you can get it up running again from your remote location. This is exactly what Martin Peters faced when he devised a hardware-based solution to cut the power down to his home computer and put it back up again when necessary.

What Martin realized that he had to have at least one computer always on and connected to the internet, to be able to control the others from a remote location. He hit upon the cheapest and lowest power consumption computer – the Raspberry Pi or the RBPi. Additionally, this tiny single board computer comes with an Ethernet port and some General Purpose Input Output or GPIO. The Ethernet port allows the RBPi to connect to the Internet and the GPIO allows controlling additional electronic circuitry.

Martin used the GPIO on the RBPi to control electronic circuitry on a circuit board he has custom made, see details here. This allows him to cut the power to his home computer, press its power switch and read the state of its power LED. For doing this, he has designed a web-based user-interface with which he wraps those GPIOs. The user-interface updates in real time and displays logs along with the power LED status.

The C++ widget-oriented web toolkit used by Martin is called Wt. The toolkit handles updates with a very simple method and even provides a native library called wiringPi to handle the GPIOs of the RBPi.

The GPIOs on the RBPi are very sensitive and can easily be damaged if more than 3mA is drawn from them when in output mode. The best solution Martin found was to isolate those using opto-isolators. Since Martin wanted to control many computers from the RBPi, he decided to place all the opto-isolators close to the RBPi and all the switching on the PC side. That meant each PC was to have a PCB and all the circuits could be connected with an Ethernet cable.

Keeping a relay to cut the power to the computer would require an additional 12V power supply to operate the relay. Instead, Martin accessed the green wire on the secondary side of the ATX power supply unit. When the computer’s motherboard wants to wake up, it shorts the green wire to the ground, which signals the ATX PSU to start supplying voltage to its other pins and the entire computer boots up.

Martin used a MOSFET in series with the green wire. He tied the gate pin of the MOSFET to the +5V (violet wire) of the ATX PSU via a 10K resistor. Pulling the gate to ground using an opto-isolator gave Martin complete control of the ATX PSU.

Raspberry Pi Lights up a 64×32 RGB LED Matrix

When you want to make a video wall such as those found on the sides of buses and bus stops in New York, you need a panel with a matrix of LEDs. These are very handy for displaying short video clips or animation. Adafruit has quite a few of them in different matrix sizes such as 8×8, 8×32, 16×24, 32×32 and 64×32. The last one is available in pitches of 3, 4, 5 and 6 mm.

LEDs on the panel are placed close together in a 3 mm pitch, so that you can appreciate it from up close. With the matrix being made of bright RGB LEDs, you have a 160-degree wide-angle view and the panel looks great both in either ambient light and indoors. You can use panels with a larger pitch if you want it to be read from still farther.

In the matrix on the panel there are 2048 gleaming RGB LEDs arranged in a grid of 64×32 in front. The backside of the panel sports a pair of IDC connectors – one of them is for input and the other for output. You can drive the display with a 1:16 scan ratio when the two connectors are chained together. For this, you need 12 numbers of 16-bit latches.

Along with each panel, Adafruit provides an IDC cable, a plug-in power cable, four mounting screws and mini-magnets (for mounting quickly on a magnetic base). You will have to buy the regulated 5V power supply unit separately. The panel consumes about 4A. The panels need 13 digital pins of which 6 bits are required for data and 7 bits for control. That makes the panels perfect for being driven with the tiny, inexpensive, credit card sized SBC, the Raspberry Pi or RBPi.

You cannot drive these displays by FPGAs or any other processors using high speed, as there is no PWM control built into the panel. Instead, you need to refresh the display manually by redrawing the screen repeatedly. For example, for displaying a 4096 color image (12-bits), you will require about 3200 bytes of RAM for buffering and the process will take up about 40% of CPU time. Adafruit provides support with complete wiring diagrams and library code for drawing pixels, circles, rectangles, lines and text.

An RBPi cannot directly drive the RGB LED display matrix directly. The GPIO pins on the RBPi cannot provide the necessary drive. Moreover, signals from the RBPi will have to be level shifted as the panel works off 5V, as compared to the 3.3V for the RBPi. Adafruit has a drive board – the RGB Matrix Hat. This sits on the RBPi and makes it easy for the RBPi to control the RGB matrix for creating a colorful scrolling display.

It is very simple to link up the RGB Matrix HAT with the panel on one side and the RBPi on the other. Plug in the HAT on to the RBPi, plug in the IDC cable and turn on the respective power supplies. Now, run the Python code from Adafruit. The 5V, 4A wall adapter plugs into the HAT, which protects against under, over and negative voltages to the display.

Raspberry Pi accessories from Microstack

If you are looking for accessories for your tiny, credit card sized single board computer, the Raspberry Pi or RBPi, you now have a series of them from the distributer element14. This Microstack range of accessories allows all levels of users to create and prototype physical devices simply and quickly. Most popular among the Microstack accessories are the GPS positioning and accelerometer.

Microstack claims that its modules are the “building blocks for the Internet of Things for All”. The original designers of PiFace Digital and PiFace Control and Display accessories for the RBPi have come together to create Microstack. In fact, building on PiFace, Microstack now offers several types of connected-device possibilities for the RBPi.

Microstack offers a family of stacking accessory boards that a compact and reusable. They offer a common form factor, interface connections and software. All the accessories for the RBPi are built on a platform-specific baseboard called the adapter board.

The GPS module from Microstack is a simple and easy plug-and-play solution. You can use this module for projects requiring GPS positioning for creating geo-location awareness. The GPS module has several worthwhile features. Not only can the module log data in its standalone mode, it allows the RBPi to keep time in a highly accurate and globally synchronized manner. The Microstack GPS module is one of the most complete and advanced modules and it sports an embedded high sensitivity 15×15 mm internal patch antenna with an external socket.

The antenna switching function is automatic as the GPS module has antenna detection feature along with short circuit protection. For better sensitivity, the module has a built-in LNA. The advanced AGPS technology works with an intelligent controller of periodic mode that does not require any external memory. Microstack has provided LOCUS as an innate logger solution that works independently without host and external flash. The GPS module comes with anti-jamming features that sports Multi-tone Active Interference Canceller with 66 acquisition channels and 22 tracking channels. You can combine it with other Microstack add-ons to provide radio links for supporting remote telemetry.

The Accelerometer module from Microstack is also a simple plug-and-play device for the RBPi. It is useful where measuring acceleration is necessary for projects such as tracking and motion, game and tilt sensors and robotics. The module is based on MMA84910, a simple, low power, three-axis low-g accelerometer that offers multi-range 14-bit at +/- 8g resolution.

With a 1.95-3.6 V supply voltage range, the Accelerometer module consumes only 400 nA per Hz, but provides data at ultra-high speeds in about 700µS. Its 14-bit digital output has a sensitivity of 1 mg/LSB with a +/- 8g full-scale range. The Microstack framework compatible accelerometer module has 45° tilt outputs for its three axes and you can link it to your RBPi with the I2C interface.

You can use the Microstack modules as standalone or integrate them into full custom PCBs. Therefore, the modules provide a solution right from prototyping to production. These modules offer powerful building blocks that cut down on the development time with support software and easy installation.

Raspberry Pi Handles Extreme Machines

In general, we know of two types of internal combustion engines used in vehicles – Gasoline and Diesel. The gasoline engine relies on electric sparks for igniting its air-fuel mixture, while the diesel engine relies on heat and compression to do the same. Introduction of new types of renewable fuels such as biodiesel, bioethanol and Hydrogen are leading to newer types of internal combustion engines such as those utilizing HCCI or Homogeneous Charge Compression Ignition.

HCCI uses a type of internal combustion mechanism where fuel is mixed with an oxidizer such as air and the mixture is compressed until it ignites on its own. The exothermic reaction thus created by the combustion of the air-fuel mixture releases its chemical energy and transforms it into a sensible form that the engine can use for generating work and heat.

Extreme machines use HCCI as this method combines the characteristics of conventional diesel and gasoline engines. Diesel engines use CI or compression ignition with SC or stratified charge – abbreviated as SCCI. Gasoline engines use SI or spark ignition with HC or homogeneous charge – abbreviated as HCSI.

An HCCI engine injects fuel during its intake stroke. This is similar to what happens in an HCSI engine. However, unlike the HCSI engine using an electric discharge to ignite the mixture, the HCCI engine compresses the mixture to raise its temperature and density, until the entire mixture reacts completely. This is different from the functioning of the SCCI engine.

An SCCI engine also increases the density and temperature during compression. However, the difference is that it injects fuel only after the compression stroke is completed. This leads to combustion occurring at the boundary of the air-fuel mixture, resulting in higher emissions. Since the method allows a leaner and higher compression burn, SCCI engines are more efficient.

Controlling extreme machines such as HCCI requires precision and a physical understanding of the ignition process. With proper control, such as with a microprocessor, HCCI engines can achieve efficiencies typical of diesel engines and emissions such as gasoline engines do.

Adam Vaughan has developed an adaptive algorithm for controlling extreme machines such as those using the homogeneous charge compression ignition His algorithm runs on the tiny, credit card sized single board computer, the Raspberry Pi or RBPi. The algorithm learns and adapts to the HCCI mechanism in real time.

The near-chaotic combustion process in an HCCI engine is hard to predict. Adam’s algorithm requires roughly 240,000 samples per second of data to predict how the engine is likely to behave. This is very close to real-time monitoring – the latency or lag approaches a mere 300µS.

Data sent to the RBPi includes pressure from each cylinder of the engine, the angle of the crank rod and the heat released. RBPi records this data and uses it to control the engine in real time over a CAN or Controller Area Network. With the real-time control provided by his algorithm on the RBPi, Adam is able to improve the efficiency of the engine and reduce its carbon dioxide emissions drastically. Watch RBPi controlling the extreme engine here and you can read about Adam’s algorithm here.

Raspberry Pi drives photon elephant

You are looking for the best way to control your 3D printer and turn it into a smartprinter. If you are not averse to using a browser-based control panel that will allow you to stream from a webcam, start, pause and resume print jobs while slicing your STL files, you may consider the Photon Elephant.

The Photon Elephant uses the tiny, low-cost, credit card sized, single board computer – the Raspberry Pi or RBPi – to drive the motor controllers of your printer. A conventional SDK or Software Development Kit uses the GPIO pins of the RBPi for the controls. This is all open-source, which means you can tinker with it to your heart’s content. For example, you may want more than what the standard 5-motor controller has to offer. With the Photon Elephant, you can have more time innovating rather than figuring out what makes the firmware tick.

Photon Elephant provides you a bunch of software and hardware based on the RBPi that controls your 3D printer. Printers available in the market typically use an Arduino, without an operating system, to manage the sensors and motors, while the RBPi is used to send it commands. Photon Elephant puts the power of Linux directly into your printer by eliminating the Arduino.

Anyone can build on the simple but powerful Photon Elephant platform. The platform makes it easier to create new and exciting types of 3D printers. Available open source solutions for controlling 3D platforms tend to be out of date and tedious. With the Photon Elephant, the next generation of 3D printers will be more flexible to control.

Entrepreneurs, students, makers and hackers anyone can easily use the Photon Elephant. It handles the entire stack and controls everything from sensors, motors and the User Interface. If you are looking for the simplest solution for getting your printer up and running, Photon Elephant is for you. Additionally, with the Photon Elephant SDK, you have the easiest platform you can build upon.

There is no firmware to be flashed. Use the pre-programmed image on the SD card and plug it in to fire up your RBPi. All you require to do is to connect any compatible printer to the Photon Elephant companion board and you can start using your printer. All the different firmware such as the slicer and printer managers talk seamlessly to one another. Therefore, you simply have to open up a browser on any device and start using the printer over Wi-Fi.

The 3D printing industry is moving forward very rapidly and printers become outdated very quickly. Currently, Photon Elephant is able to support Cartesian RepRap style of printers only. Very soon, Delta printers will also be supported. The SDK is flexible to take on almost any printer methodology.

Flexibility is extremely desirable considering how difficult it is to predict the direction the 3D industry may be taking. There is no sense in spending time in modifying the firmware directly on a chipset as it may become useless by tomorrow. The flexibility of the Photon Elephant SDK helps the user keep up with the industry, as it is very easy to add newer features to the current design

Let Raspberry Pi do your Calling and Answering

In certain projects or experiments where you are monitoring an entity such as temperature or pressure, it is impractical to be physically present for any length of time. However, it may be important for you to know when the measured entity breaches a high or a low set point. For example, if something is not working out as it should – say temperature or humidity too high – you may wish to start or control another activity rather quickly to compensate.

In such cases, the handy, credit card sized single board computer, the Raspberry Pi or RBPi can be of immense help. RBPi can call, sms or inform you via web-interface, in case things are tending to go beyond their limits. Although sms and web-interface work equally well, for cases that are more important a call gets more attention than the others do.

When receiving a call, you expect the other party to speak up. Programs such as eSpeak and Festival endow an RBPi with capabilities of synthesized speech. Both tools allow you to cache speech as wav-files. eSpeak is more adjustable and creates wav files a bit faster than Festival; however, their performance is similar. You can select any one of the programs depending on your preference and install it with a ‘sudo apt-get install …’ command.

For making calls, it is simpler to use a sip/voip based system. Here again, you can select between two capable tools – PJSIP or Linphone. Of the two, Linphone is difficult to include into an application script. PJSIP has a command line interface and provides a powerful api that you can use within your own sip-based project. However, you will need to download and compile it for Raspbian.

After compilation, you may find some echo or jitter when making normal calls to another phone. To get rid of these, you will need two other tools – sipcall and sipserv. Sipcall will help you to make a completely automated call to a specified number using a text to speech converter. That makes it very useful when using via bash-scripts. For example, you can ask it to check the state of a sensor and place a call if a critical threshold is reached. On the other hand, Sipserv is more like a service, where you make a call to query information and/or execute a command via phone. Of course, your sip-provider must support inbound DTMF. Both tools are available here, but you will need the pkg-config-package tool to compile them.

The original author has also created simple bash-scripts that can check the actual load and place a call if the load is found too high. For stopping/starting the service available, he has provided a simple configuration and a bash-script that you can use for Sipserv. Readme files and general info is available for the user. For more details, refer here.

Although the tools are rather ‘proof of concept’ than a final product, they work well. The author permits changes and extensions to his original work and invites suggestions on any improvements, more especially for the current sound problems of echo and jitter.

Fun projects for the Raspberry Pi Model A+ – Part 1

Fun Projects for the Raspberry Pi Model A+ – Part 1

The latest release of the Raspberry Pi, the RBPi Model A+ is not only smaller, it is cheaper as well. That makes it an ideal device for taking a plunge into coding and for trying out new projects. Here are some fun projects that you may find interesting.

A Garden with Digits

With a Pibrella add-on board, your RBPi can run several small motors to create a digital garden. Define the garden to your exact specifications with ornate flowers that you could make out of card or cloth. Add artificial bees and make then spin when you press a button. You could also arrange a relaxing setup of plants and have some soothing music going on at the same time. For details, look here.

Juggle With Illuminated Pins

This is for those who like to juggle things. While juggling, let your RBPi help you out with the routing using some extra LED lights. You will need a Pibrella board and some custom Python code to make the project work independently. Although this may be a niche case, the project is worth undertaking. Lauren Egts has a blog post.

Console for Retro Games

Arcade cabinets of yesteryears still draw a lot of interest. Both young and old enjoy retro games and your RBPi can work as the basis for such a console. With RetroPie, you can simply load emulator software. All you need is an SD card and some USB peripherals. This simple but fun project can be completed within one hour. Life hacker has a guide.

Control Your Pottery Kiln via Wi-Fi

Those using kilns for firing up potteries will find this project useful. RBPi provides remote capabilities for automatic temperature control using a thermocouple and a stepper motor. Temperature stability is maintained with a system of closed-loop feedback. Visit the RBPi blog for code and photos.

Watch Birds with Infrared

Although this is a project for birdwatchers, others can adapt it for their own requirements. An RBPi makes it possible to watch what birds are doing inside the bird box. This way, you are in complete control of watching birds on the outside as well as on the inside of the bird box. The RBPi even makes it possible to set up a live internet stream if your bird box is in a remote location. You will need the RBPi NoIR camera board and some infrared LEDs. The RBPi site has more details.

RBPi Weather Station

You do not need to rely on forecasts from the radio or television any more. Make your own weather station with the RBPi. This project is very cheap and requires very little energy. Of course, some extra hardware is necessary, but nothing too complicated. For details on the setup, visit DragonTail.

Transmit Morse code

Although this is ancient technology, people dabbling in Amateur Radio still find Morse code very useful. Building an RBPi powered Morse code station will be a very exciting project. With this, you can have device for encoding and decoding Morse code. If you add a vintage Morse key, the authenticity of the project will increase dramatically. For complete details, head over to the RBPi website.

Raspberry Pi gets a stepper-motor hat

Robotics enthusiasts find the credit card sized single board computer, Raspberry Pi or RBPi – a versatile unit for controlling various functions. With several add-ons or HATs readily available in the market, the RBPi can be a formidable force to reckon with. With its latest Motor HAT from Adafruit, your RBPi can control up to four DC motors or two stepper motors using PWM to achieve full speed control.

Although the RBPi has several GPIO pins, not many of them work as PWM. That means, to control motor direction and speed, you require a fully dedicated PWM driver chip onboard. Such chips will handle all the motor and speed controls, while communicating with the RBPi on only two pins – SDA & SCL. These pins follow the I2C standard protocol for communication. Therefore, you can connect this Motor HAT to any other device working with the I2C protocol.

In case you need to control a larger number of motors, as it is often required in robotics, you can easily stack up several of these Motor HAT boards. A total number of 32 boards are allowed by the I2C standard. Therefore, you will be able to control simultaneously 64 stepper motors or 128 DC motors, or a mix of both. To do this, you will have to replace the header on the Motor HAT with a stacking header.

Typically, stepper motor drivers rely on L293D chips. However, the Adafruit Motor HAT uses TB6612 MOSFET drivers. These drivers have the flyback diodes built-in and provide a huge improvement over the L293D – you get 1.2A per channel with 3A as peak current capability. The Motor HAT board comes with a small prototyping area and a polarity protection FET on the power pins. Adafruit offers the Motor HAT fully assembled and tested. All that a user has to do is to solder on the included terminal blocks and the 2×20 plain headers. However, stacking headers are not included.

Looking at the specs of the Motor HAT, you will find four H-bridges with thermal shutdown protection and internal kickback protection diodes. The bridges are capable of driving motors operating from 4.5VDC to 13.5VDC. Each board is capable of driving up to four bi-directional DC motors with individual speed selection using 8-bits or 0.5% resolution. Alternately, you can drive up to two stepper motors – unipolar or bipolar. These could be of single coil or double coil type and the driving could be interleaved or micro stepping.

Motors require a good amount of current for producing the required torque. The huge terminal block connectors allow use or 18-26AWG wires for drive and power. External power can come from a 5-12VDC power supply; the two-pin terminal block connector on the board is polarity protected.

Adafruit Motor HAT board is best suited for RBPi models B+ and A+. For using with models A and B, you have to use an extra-tall 2×13 header in place of the 2×20 header supplied. Adafruit supplies the easy-to-use Python library that makes driving motors a breeze with the RBPi wearing the HAT.

Telegram, Raspberry Pi and Remote Control

People from an older generation may still recall the days the postman would land on the doorstep and deliver a slip of paper with some message in it. Those were the days of Telegrams associated with Morse Code, the dots and dashes way of communicating with far-off places. Mobiles and instant messaging services have now replaced that and other such slow modes of communication. As a result, you can always remain in instant contact with people across the globe.

Similar to the WhatsApp messenger service, Telegram is another application that allows you to chat and share documents with your contacts. Telegram surfaced when WhatsApp crashed about a year back. Being a cross-platform messenger app from Berlin, it gained above five million users within 24 hours and more, since Facebook purchased WhatsApp.

Although at first introduction Telegram and WhatsApp seem identical, there are interesting differences. Both require the telephone number of the recipient for sending them a message. In addition, chatting to individual contacts or to groups is possible. Both have a single and double track system for knowing if the recipient has received your message and has read it.

However, unlike WhatsApp, Telegram allows you to send your messages, videos and photos with a self-destruct timer. Once the set time ends, all your shared documents disappear within a ‘secret chat’. This has a huge advantage. Under secret chat, all documents, locations, videos and images remain encrypted end-to-end and only the sender and the recipient can read them; nobody else can read them, not even the staff at Telegram. The timer can be programmed to activate either after two seconds or up to a week.

Using Telegram on the RBPi is fun and you can use the versatile instant messaging service on the same phone number with different devices simultaneously. Apart from simply using the messaging service to exchange messages, it is also possible to make the RBPi take specific actions automatically, based on the message received by it. For example, if the text message sent is say, “photo”, the RBPi responds by taking a snap of the surroundings with its camera and sends the image to the sender. Similarly, if the message says “lamp”, RBPi can turn on a lamp or open a garage door if the message says “open”.

For using Telegram for remote control, it is best to use the RBPi model B or B+ and have the latest version of the Raspbian as the operating system. However, you can also use the pre-installed Raspbian on the 8GB Class 10 Micro SD card available here. Follow the configuration given in this tutorial as a starting point.

RBPi will be intercepting new incoming messages with Lua, a lightweight, fast, powerful and embeddable scripting language application. Lua uses extensible semantics and associative arrays by combining the simple procedural syntax to powerful data description constructs. That means Lua has the capability to understand text and interpret the action to be taken. In fact, Lua uses a lookup file “action.lua”, much as we use a dictionary, to correlate specific text messages received and the actions that RBPi will take. For details of programming, refer to this blog.

Two Delightful Robots Using the Raspberry Pi

Two kits are presented here for those trying to build a robot for the first time. The first is the GoPiGo, a complete robot kit from Dexter Industries and the second is TiddlyBot, a simple fun robot with lots of features. Both kits are great for introducing anyone to the exciting world of robotics and doing it in a fun and simple way. Building robots is a great way for learning Science, Technology, Engineering and Math (STEM), including basic robotics and programming.

GoPiGo

Apart from the robot itself, the GoPiGo kit comprises a full Linux computer, the Raspberry Pi or RBPi, USB and camera expansion for less than $100. You can turn GoPiGo into a full-fledged Wi-Fi robot for exploring unreachable corners of a closet. The inclusion of RBPi makes the possibilities endless. You can even control the robot with your mobile or phone over local Wi-Fi network.

GoPiGo has an acrylic robot body and associated hardware or mounting the RBPi and the Pi camera. It has a control board for motors, controls and extra hardware other than the encoders, wheels and motors.

You need only a screwdriver to assemble the kit. The kit comes with its power source in the form of an 8XAA battery pack along with its connector. You can use your desktop to program GoPiGo directly downloading the program wirelessly or via a USB stick.

The use of the Pi camera along with the RBPi increases the potential of GoPiGo many times over. There is a servo camera mount with the kit and it allows the camera to turn a full half-circle. This increases the robot’s potential for dynamic exploration – for details visit here.

TiddlyBot

If you are looking for something a little less complicated, TiddlyBot is sure to help. Under RBPi control, TiddlyBot begins with robot like movements, using a multi-colored light and progressing to line drawing and following. This is great for teaching children how to program robots as well as for simply playing games.

You can program TiddlyBot using any smartphone, tablet or PC with the provided Blocky Interface, out of the box. It has a web interface for remote control. Use TiddlyBot as a squiggly bot and draw programmatically or let it run freestyle. Use several pens with different colors to make modern art. Makers of TiddlyBot run many workshops for enabling young people pick up nuances of robot building and programming.

What can you do with these two simple but exciting robots? For starters, here are some suggestions:

• Use Wi-Fi To remotely explore a house or office
• Deliver drinks remotely
• Make sneak attacks on unsuspecting people
• Use it for herding pets and babies
• Use it for remote monitoring an event
The greatest benefit of both the robot kits is the inclusion of the Pi camera, which gives the robots their vision. You can monitor where they are going and manoeuver them remotely. This opens up possibilities of several awesome projects. You can make your robots follow hand motions, navigate and map rooms, track objects, follow faces, check on pets remotely, find lost stuff under the couch and so much more – the possibilities are endless.