Tuesday 31 May 2016

Build a Pi media centre

Build a Pi media centre

Get your monitor, speakers, keyboard and mouse plugged in, then install OSMC – this is your main home theatre PC. Configure a Bluetooth remote control, or a remote control app on your smartphone or tablet. Connect a powered external hard drive to your Raspberry Pi, loaded up with all your favourite music, movies and TV shows. Set up your OSMC media centre by adding the content stored on your external hard drive, and add new files from USB flash drives as and when you plug them in. Set your Pi up as a media server for your mobile devices. Finally, browse through OSMC’s App Store for things like a torrent client and TV tuner.

You will need:

– Home theatre peripherals
– Bluetooth remote
– Powered external hard drive



from Linux User & Developer – the Linux and FOSS mag for a GNU generation http://ift.tt/25vVYjQ
via IFTTT

Monday 30 May 2016

Mozilla turns Firefox OS into IoT hub

Mozilla turns Firefox OS into IoT hub

As an operating system, Firefox OS has undergone a massive transformation in the past 24 months – it’s far more than just a web browser nowadays. But now Mozilla is looking to take Firefox to the next level by using it as a hub for a plethora of Internet of Things projects.

Mozilla is currently working on four IoT projects behind the scenes: Project Smart Home, Project Link, Project Sensor Web and Vaani. Each of the projects will deal with IoT technology in different ways, but all are aimed at making the end consumer’s home and devices smarter. In a blog post, Mozilla’s SVP of Connected Devices, Ari Jaaksi, posted: “Everything is connected around us. This revolution has already started and it will be bigger than previous technology revolutions, including the mobile smartphone revolution. Internet of Things, as many call it today, will fundamentally affect all of us.”

Smart Home is pretty self-explanatory, and looks to give users the tools needed to automate some of their home’s basic functions, while still giving more discerning users some useful flexibility in how they adopt it into their home. With Link, users will have a new personal assistant that bridges the gap between themselves and their smart devices. Over prolonged time, Link will remember certain preferences, making it faster and eventually requiring minimal user interaction.

Vaani is the name given to Mozilla’s new voice interface that can be integrated into third-party apps and hardware. To start with, Vaani will recognise simple commands, with a view to catering to more complex statements down the line. Sensor Web is a little different, and relies on a network of sensors to collate crowd-sourced data that will be openly accessible to all. Mozilla will process the data and present it to users to view in their own time.

Many of Mozilla’s outlined projects are very much in their early phases and it’s not known when we’ll see any of these actively in our homes. With Mozilla’s continued development of the Firefox platform, it’ll be interesting to see where its new IoT focus leads it.



from Linux User & Developer – the Linux and FOSS mag for a GNU generation http://ift.tt/1TRYQ6C
via IFTTT

Hackaday Prize Entry: Raspberry Pi Zeros And Drones

How do you get eyeballs on a blog post? Put Raspberry Pi Zero in the headline. How do you get even more eyeballs? Put the word drone in there too. Lucky for us, there’s one very special project in the Hackaday Prize that combines both. It’s the Pi0drone from [Victor], and it’s exactly what it looks like: a flying Raspberry Pi Zero.

[Victor] has been working on the PXFmini, a ‘shield’ or ‘hat’ for the Raspberry Pi that integrates a barometer, IMU, and a few PWM outputs into a very small form factor that is just a shade larger than the Raspberry Pi Zero itself. It comes with standard connector ports for UART and I2C to attach GPS and on screen display for FPV flying.

Of course, there are dozens of flight controllers for drones and quads out there, but very few are running Linux, and even fewer platforms are as well supported as the Raspberry Pi. To leverage this, [Victor] is running Dronecode on the Pi for mission planning, real autopilot, and everything else that turns a remote controlled quadcopter into a proper drone. It works, and it’s flying, and you can check out the video proof below.

The HackadayPrize2016 is Sponsored by:

Filed under: drone hacks, Raspberry Pi, The Hackaday Prize

from raspberry pi – Hackaday http://ift.tt/1OWY1DS
via Hack a Day

Sunday 29 May 2016

Hackaday Prize Entry: A Hat For The Headless Linux System

Connecting a headless Raspberry Pi to a wireless network can be quite a paradoxical situation. To connect it to the network, you need to open an SSH connection to configure the wireless port. But to do so, you need a network connection in the first place. Of course, you can still get command-line access using a USB-to-UART adapter or the Pi’s ethernet port – if present – but [Arsenijs] worked out a much more convenient solution for his Hackaday Prize entry: The pyLCI Linux Control Interface.

His solution is a little LCD-pushbutton-hat that sits on the single board computer’s GPIOs along with a Python application. This allows you to configure all important aspects of a Raspberry Pi – or any other Linux SBC – from a tidily organized click-and-scroll menu. [Arsenijs] implemented a whole bunch of useful tools: There’s a network tool to scan and connect to WiFi networks. A systemctl tool that lets you manage the services running on the system, which is especially helpful when you need to restart a stuck service. A partition tool helps with mounting and unmounting mass storage devices. He’s even planning to add a filesystem browser.

With his Open Source project, [Arsenjs] aims to shorten the development time for embedded projects by taking out the efforts of implementing the basic interface functions from scratch. Indeed, there are countless scenarios, where a basic display interface can be of great value. Given the great project documentation and the fact that this works with virtually any Arduino or Raspberry Pi LCD-pushbutton-hat or shield, we’re sure this is going to be used a lot. Enjoy the video!

The HackadayPrize2016 is Sponsored by:

Filed under: linux hacks, Raspberry Pi, The Hackaday Prize

from raspberry pi – Hackaday http://ift.tt/1VnODjm
via Hack a Day

Saturday 28 May 2016

LeMaker Guitar review

 

LeMaker Guitar review

LeMaker first raised hackles in the hobbyist computing market back in 2014 when it launched the Banana Pi, a blatant attempt at duplicating the success of the Raspberry Pi single-board computer. While the company was pilloried for its choice of name, later abandoned in favour of successor board the Banana Pro, the company’s first release was far from a slavish copy: boasting a more powerful processor, more memory, and SATA connectivity, the device proved a hit until the launch of the improved Raspberry Pi 2.

The Guitar, part of a new family of designs from LeMaker, may not carry the Banana branding but there’s no denying its influence. Rather than designing the device around the mainstream Raspberry Pi form factor, though, the company has this time opted to build a computer-on-module inspired by the Raspberry Pi Compute Module.

Anyone who has worked with the Compute Module will find the LeMaker Guitar immediately familiar. The system-on-chip processor, an Actions S500, sits alongside 1GB of memory, a combined audio and power management unit, and 8GB of NAND flash storage on an over-sized small-outline DIMM (SODIMM) form factor circuit board. This board then connects to a baseboard, supplied with the Guitar, which provides more accessible connectivity than the SODIMM’s 204 electrical contacts.

The baseboard isn’t a dumb breakout board, however: while the bulk of the active components are located on the Guitar itself, wired and wireless networking PHYs are installed on the baseboard. Those planning to integrate the Guitar module into a baseboard of their own design following prototyping will need to keep that in mind and add their own network connectivity accordingly.

Want to find out more about the LeMaker Guitar? Check out the full review in issue 162 of LU&D!



from Linux User & Developer – the Linux and FOSS mag for a GNU generation http://ift.tt/1TK2hy0
via IFTTT

Raspberry Pi Levels with You

It is easy to imagine how early man started using rocks and then eventually developed better and better tools until they created the hammer. Some simple tools took a little longer to invent. The spirit level, for example, didn’t exist until sometime in the last half of the 1600’s.

The idea is simple. A clear tube holds a liquid and a bubble. When the bubble is in the center of the tube, the device is level in the direction of the tube. [Mark Williams] has a slightly more involved approach. He took an internal measurement unit (IMU) and a Raspberry Pi to create a modern take on the spirit level.

The device shows virtual spirit bubbles on an LCD using some Python libraries. You can see a video below and find the code on GitHub.

We’ve certainly seen more exciting uses of IMUs. We’ve even looked at some tiny IMUs, if you want to go smaller. But this is a nice project, and well done. We thought you should see it.


Filed under: Raspberry Pi

from raspberry pi – Hackaday http://ift.tt/1TKEj2r
via Hack a Day

FriendlyARM: A Different Flavor of Raspberry

A lot of old science fiction movies show people wearing the same–or nearly the same–clothes. We’re left guessing if this is because there is a single centralized plant mass-producing skin-tight jumpsuits, or if everyone is under orders to dress the same. Now that we live in the past’s future, it looks like science fiction was a poor predictor of fashion. People want variety.

Which calls to mind development boards. How many different ones do we need? Need doesn’t matter, because we have plenty of them. There may be strong leaders: in the 8-bit world, you think of the Arduino, and on the Linux side, maybe the Raspberry Pi. But there are options.

[Eric Brown] recently compared several inexpensive development boards from FriendlyARM including the NanoPi M3, the NanoPi M1, and the NanoPC-T3. These range from about $11 to $60 with the M3 costing $35. You can see an M1 booting on an HDMI screen in the video below.

The $35 board (the M3), in particular, is pretty impressive:

  • Processor — Samsung S5P6818 (8x 28nm Cortex-A53 cores @ 400MHz to 1.46GHz; Mali-400MP GPU
  • Memory — 1GB DDR3 SDRAM; microSD slot (up to 64GB)
  • Wireless — 802.11b/g/n; Bluetooth 4.0 dual mode; IPX interface
  • Networking — 10/100/1000 Ethernet port
  • Multimedia I/O: HDMI 1.4a output; LCD interface; LVDS interface; DVP camera interface; 3.5mm audio jack; I2S audio interface
  • Other I/O: 2x USB 2.0 host ports; 2x USB 2.0 host headers; Micro-USB 2.0 client port; Debug serial port header; 40-pin, Raspberry Pi compatible GPIO connector for UART, SPI, I2C, PWM etc.
  • Other features — Power and reset buttons; power and status LEDs
  • Power — DC barrel jack; +5V @ 2A; RTC Battery header; AXP228 power management unit
  • Dimensions — 64mm x 60mm

The board can boot several Linux flavors and Android. It looks like a strong choice.

The geodesic dome didn’t replace conventional homes, and unitards didn’t replace the business suit. These probably won’t replace the Raspberry Pi, either. We’ve covered other “Pi killers” in the past that either compete on price or features. While none of them are likely to displace the Pi either, they do give you choices, should you dare to be different.


Filed under: ARM, Raspberry Pi

from raspberry pi – Hackaday http://ift.tt/1TFLM0z
via Hack a Day

Friday 27 May 2016

SuperTux 0.4 review

SuperTux 0.4 review

You’ve probably played SuperTux in the past – it’s been around for a while. In your distro’s repository, you’ll have 0.1.3, the last stable release, dating from 2005. Development on the unstable 3.n branch has been going along mostly unremarked for more than a decade, and now a new stable release, 0.4, bursts onto the scene!

A classic 2D sidescroller in the spirit of Super Mario games, originally written by Bill Kendrick of Tux Paint and Circus Linux! fame (if you have young children, those two programs are a must), SuperTux has undergone an extensive rewrite of the game engine and, more visibly, gameplay, graphic effects, and features. The level editor is scriptable with the Squirrel scripting language (easy to get started on if you’ve never used it).

We installed on LMDE with Jessie backports – with packages scheduled for Ubuntu 16.04, you may not even have to add a new repository. It’s configurable for either keyboard or joystick use. Revisiting 2D side-scrollers is always fun, and time passes quickly – SuperTux’s levels and gameplay make it every bit as addictive a challenge as navigating an Italian plumber around strange 2D worlds.



from Linux User & Developer – the Linux and FOSS mag for a GNU generation http://ift.tt/1TE4TYL
via IFTTT

Thursday 26 May 2016

Raspberry Pi Cluster Build Shows How and What

Raspberry Pi clusters are a dime a dozen these days. Well, maybe more like £250 for a five-Pi cluster. Anyway, this project is a bit different. It’s exquisitely documented.

[Nick Smith] built a 5-node Pi 3 cluster from scratch, laser-cutting his own acrylic case and tearing down a small network switch to include in the design. It is, he happily admits, a solution looking for a problem. [Smith] did an excellent job of documenting how he designed the case in CAD, prototyped it in wood, and how he put the final cluster together with eye-catching clear acrylic.

Of interest is that he even built his own clips to hold the sides of the case together and offers all of the files for anyone who wants to build their own. Head over to his page for the complete bill of materials (we didn’t know Pis were something you could order in 5-packs). And please, next time you work on a project follow [Nick’s] example of how to document it well, and how to show what did (and didn’t) work.

If 5 nodes just doesn’t do it for you, we suggest this 120-node screen-equipped monster, and another clear-acrylic masterpiece housing 40 Pis. This stuff really isn’t only for fun and games. Although it wasn’t Pi-based, here’s a talk at Hackaday Belgrade about an ARM-based SBC cluster built to crunch numbers for university researchers.


Filed under: computer hacks, Raspberry Pi

from raspberry pi – Hackaday http://ift.tt/1TGaCiY
via Hack a Day

Pi project: RasPiViv

Pi project: RasPiViv

“The Raspberry Pi is set up as a LAMP server,” explains RasPiViv creator Nate Bensing. “I started playing around with the DHT22 temperature-humidity sensor – originally I just wanted to monitor that, the temperature and the humidity, but then I got into using relays to control the lighting and it just progressed further and further. I was just making this for myself and I posted on a forum. Then a lot of people seemed really interested, so I said I’d clean things up and throw together a guide.

“So the temperature and humidity sensors are read every 60 seconds and logged into a database. Using WiringPi and Adafruit’s DHT22 sensor (and the driver for it, which is brilliant and works really well), lighting is controlled by regular relays or relay modules, and the fan is just a basic transistor switch. The main idea behind the fan is that if the atmosphere is too saturated with water then the frogs can’t thermoregulate. So the database is read every five minutes, and when it reaches 95% humidity it then kicks on the fan to blow in some fresh air.

“There’s a whole web interface where you can check out the current readings. Check out the Demo section on my website and the first thing that pops up is my blue poison dart frog vivarium. It gives you the current temperature and humidity, and then also the readings for the last hour.”

Want to know more about Nate Bensing’s RasPiViv project? Check out the complete interview in issue 153 of LU&D!



from Linux User & Developer – the Linux and FOSS mag for a GNU generation http://ift.tt/1Vjn2Qd
via IFTTT

Wednesday 25 May 2016

Solus OS

Solus OS

For the seasoned users among you, chances are you may have previously heard about the development of the Solus operating system – for both good and bad reasons. For those less aware of the behind-the-scenes antics, you might want to check out our full interview with its founder, Ikey Doherty, back in LU&D 162.

Following on from a successful launch, the project looks to offer a stable, and alternative, take on the more common GNOME-based distributions. Without doubt, Solus’ most distinguishing feature is its unique graphical interface: Budgie. The Budgie desktop has been written from the ground up, enabling easy integration into other distros and is essentially an open source project in its own right.

At its core is its simplicity, which is something that Solus heavily relies on, and it pays dividends when moving around the interface. A large part of this is the Raven applet technology that provides an intuitive notification centre for desktop users, which is still fairly uncommon for most modern distros to contain. It’s also highly accessible out-of-the-box, not only due to the amount of key software readily available, but also the use of ‘high contrast’ theming to make it the distro of choice for those with visual impairments.

Solus OS has just launched its first point release (1.1 Shannon) and with that, it has optimised, refined and tweaked Budgie to be better than ever before. For those who are after a traditional desktop experience, but don’t want to compromise on how their interface looks, then you really need to download Solus as soon as possible. Official downloads can be found over at solus-project.com.



from Linux User & Developer – the Linux and FOSS mag for a GNU generation http://ift.tt/1TDtwHc
via IFTTT

Tuesday 24 May 2016

Shower Thoughts in Your Car

The subreddit for Shower Thoughts offers wisdom ranging from the profound to the mundane. For example: “Every time you cut a corner you make two more.” Apparently, [Harin] has a bit of an addiction to the subreddit. He’s been sniffing the CAN bus on his 2012 Hyundai Genesis and decided to display the top Shower Thought on his radio screen.

To manage the feat he used both a Raspberry Pi and an Arduino. Both devices had a MCP2515 to interface with two different CAN busses (one for the LCD display and the other for control messages which carries a lot of traffic.

The code is available on GitHub. There’s still work to do to make the message scroll, for example. [Harin] has other posts about sniffing the bus, like this one.

We’ve covered CAN bus quite a bit, including some non-automotive uses. We’ve even seen the CAN bus for model railroading.


Filed under: Arduino Hacks, car hacks, Raspberry Pi

from raspberry pi – Hackaday http://ift.tt/1WfGRJj
via Hack a Day

We need your help!

We need your help!

Are you a regular reader of Linux User & Developer? Do you frequent our website? If so, we’d love you to share your opinions and help us make your magazine and site even better!

Complete our readers’ survey to tell us more about what you like, don’t like and what you want from the magazine and site. Thank you for your help!



from Linux User & Developer – the Linux and FOSS mag for a GNU generation http://ift.tt/25eaUTn
via IFTTT

Build a Pi weather station

Build a Pi weather station

Stuck for something to do on a rainy Tuesday afternoon? How about turning your Pi into a weather station so you can predict precipitation?

While a waterproof case is also a good idea here, some of the sensors would benefit from being outside the case, like the temperature sensor –  there are waterproofed variants available for some of them. You could always use a mix of sensors, so you can take an average of the readings and also have some built-in redundancy.

The idea here is to connect up lots of sensors via the GPIOs in order to get a reading of the weather state in your area. With the Wi-Fi and portable power pack, you can have the weather station in your garden connected to your home router (or a Wi-Fi repeater!) for an internet connection, and you can post all of the data onto an easily-accessed WordPress site, hosted on the Pi.

You will need:

– DHT22 sensor
– BMP085 sensor
– TGS 2600
– UV1-01 sensor
– LDR (light dependent resistor)
– ADC (analogue-to-digital convertor)
– Wind vane
– Anemometer



from Linux User & Developer – the Linux and FOSS mag for a GNU generation http://ift.tt/1OTzg0x
via IFTTT

Monday 23 May 2016

Smartwatches go open source

Smartwatches go open source

Until now, the open source community has largely been left behind when it comes to the world of smartwatch operating systems. With Google and Apple leading the charge in this field, there’s been little competition, and any independent launches have been heavily restricted in what they can do. However, we now finally have a choice with the launch of AsteroidOS.

Developed by Florent Revest, AsteroidOS is the first true open source distribution that’s been specifically made for smartwatches. In its current state, AsteroidOS contains only the bare minimum of functions. So things like a calculator, stopwatch and calendar are all ready to use, but many of the smartphone connection features we’ve become accustomed to are not.
Adoption rates are still in their infancy, and Revest has been quick to state that the project will move at a much faster speed once more developers are working on it. Currently, owners of the LG G Watch and LG G Watch Urbane have full access to the OS, but as long as your bootloader is unlocked, porting it over to other devices isn’t a difficult task. The kernel source is built around libhydris, which allows the re-use of Android drivers.

Initial tests on the AsteroidOS software have proved positive. On videos uploaded to AsteroidOS’ official Twitter account, videos have shown off many of its core apps working. Speeds are quick, crashes are infrequent and there’s plenty of on-board customisation on hand. Keen developers can go hands-on with the code that Revest and his team have uploaded to GitHub. There’s scope to build applications from scratch and directly implement them on your smartwatch, and even change the way that your hardware performs. Due to the open source nature of the operating system, users also have the tools to adopt the OS for use on various other wearables. So perhaps a VR version of AsteroidOS could be with us down the line.

Visit the official AsteroidOS website for a full overview of the project, where you’ll find a guide to installing the OS on to your device, and also GitHub where you can check out its source code for yourself.



from Linux User & Developer – the Linux and FOSS mag for a GNU generation http://ift.tt/1TFBj8H
via IFTTT

Sunday 22 May 2016

Build a Replica Apple ///

[Mr. Name Required] pointed us to a great video on the modeling of a replica Apple /// to the small scale needed to contain a Raspberry Pi by [Charles Mangin].

[Mr. Name] pointed out that the video was a great example of the use of reference photos for modeling. [Charles] starts by finding the references he needs for the model. Google image search and some Apple history websites supplied him with the required images.

He modeled the Apple /// in Autodesk 123. It has sketch tools, but he chose to craft the paths in iDraw and import them into the software. This is most likely due to the better support for boolean combination tools in vector editing software. Otherwise he’d have to spend hours messing with the trim tool.

Later in the video he shows how to change the perspective in photographs to get a more orthographic view of an object. Then it’s time for some heavy modeling. He really pushes 123 to its limit.

The model is sent off for professional 3D printing to capture all the detail. Then it’s some finishing work and his miniature Apple /// is done. Video after the break.

 

Up Your CAD Game with Good Reference Photos


Filed under: classic hacks

from raspberry pi – Hackaday http://ift.tt/1W92lHT
via Hack a Day

Friday 20 May 2016

Virtually Free Rapsberry Pis

One of the nice things about the Raspberry Pi is that it runs Linux and you can do a lot of development right on the board. The converse of that is you can do a lot of development on a Linux desktop and then move things over to the Pi once you get the biggest bugs out. However, sometimes you really need to run code on the actual platform.

There is, however, an in-between solution that has the added benefit of upping your skills: emulate a Pi on your desktop. If you use Linux or Windows on your desktop, you can use QEMU to execute Raspberry Pi software virtually. This might be useful if you don’t have a Pi (or, at least, don’t have it with you). Or you just want to leverage your large computer to simplify development. Of course we would be delighted to see you build the Pi equivalent of the Tamagotchi Singularity but that’s a bit beyond the scope of this article.

Since I use Linux, I’m going to focus on that. If you insist on using Windows, you can find a ready-to-go project on Sourceforge. For the most part, you should find the process similar. The method I’ll talk about works on Kubuntu, but should also work on most other Debian-based systems, including Ubuntu.

Step 1. Tools

Your PC probably has some sort of Intel processor in it. The Pi has an ARM chip. QEMU is the emulator that lets you run–among other things–ARM executables on the PC. You need a static copy and the binfmt-support package. This combination will let Linux recognize alien executables and run them transparently. Here’s how you install what you need:

apt-get install qemu qemu-user-static binfmt-support

Step 2. Raspberry Pi Image

Make a working directory and download a Pi image in zip format. You can then unzip it, to create an IMG file. Here are the steps:

wget http://ift.tt/1IXxaVe

unzip 2015-11-21-raspbian-jessie.zip

Step 3. Get Data

We need a few numbers from the img file and yours may be different than mine, depending on what you downloaded. The command you want to run is:

fdisk -lu 2015-11-21-raspbian-jessie.img

Here’s the output, with the important parts in bold:

Disk 2015-11-21-raspbian-jessie.img: 3.7 GiB, 3934257152 bytes, 7684096 sectors 
Units: sectors of 1 * 512 = 512 bytes 
Sector size (logical/physical): 512 bytes / 512 bytes 
I/O size (minimum/optimal): 512 bytes / 512 bytes 
Disklabel type: dos 
Disk identifier: 0xea0e7380 
 
Device                          Boot  Start     End Sectors  Size Id Type 
2015-11-21-raspbian-jessie.img1        8192  131071  122880   60M  c W95 FAT32 (LBA) 
2015-11-21-raspbian-jessie.img2      131072 7684095 7553024  3.6G 83 Linux

The first partition is the boot partition and the second is the filesystem.

Step 4: Increase Hard Drive Size

The base filesystem isn’t very large, so let’s make it bigger:

dd if=/dev/zero bs=1M count=2048 >>2015-11-21-raspbian-jessie.img

This will add 2 GB to the image. However, the filesystem won’t know about it yet. First, we need to mount the image as though it were a set of disks:

losetup -f --show 2015-11-21-raspbian-jessie.img

losetup -f --show -o $((131072*512)) 2015-11-21-raspbian-jessie.img

The numbers (131072 and 512) must match the ones highlighted in step 3. The 512 probably won’t change, but the start of the filesystem can and does change.

Unless you already had loopback devices, this should give you a /dev/loop0 that corresponds to the whole “disk” and /dev/loop1 that is the filesystem (the part we want to expand). Recreate the partition table to know about the extra space (the mkpart command will need some numbers you can read from the output and those numbers are marked in bold):

$ sudo parted /dev/loop0
GNU Parted 3.2 
Using /dev/loop0
Welcome to GNU Parted! Type 'help' to view a list of commands. 
(parted) print                                                             
Model: Loopback device (loopback) 
Disk /dev/loop0: 6082MB 
Sector size (logical/physical): 512B/512B 
Partition Table: msdos 
Disk Flags:  
 
Number  Start   End     Size    Type     File system  Flags 
 1      4194kB  67.1MB  62.9MB  primary  fat16        lba 
 2      67.1MB  3934MB  3867MB  primary  ext4
 
(parted) print

(parted) rm 2

(parted) mkpart primary 67.1 6082

(parted) quit

$ e2fsk -f /dev/loop1
$ resize2fs /deve/loop1
$ losetup -d /dev/loop[01]

Step 5: Mount Filesystem

Make a directory to use as a mount point. I usually just make a directory called mnt in the current directory. You’ll need to be root to mount and use the offsets found in step 3 (8192 and 131072, in this case):

mkdir mnt
sudo mount 2015-11-21-raspian-jessie.img -o loop,offset=$((131072*512)),rw mnt
sudo mount 2015-11-21-raspbian-jessie.img -o loop,offset=$((8192*512)),rw mnt/boot
sudo mount --bind /dev mnt/dev
sudo mount --bind /sys mnt/sys
sudo mount --bind /proc mnt/proc
sudo mount --bind /dev/pts mnt/dev/pts

Step 6: Modify ld.so.preload and Copy Executable

As root, you need to edit mnt/etc/ld.so.preload with your favorite editor (which is, of course, emacs). You could, if you wanted to, use vi or some other editor of your choice. Just make sure you are root. Just put a hash mark (#) in front of the line you’ll find there. Failure to do this will cause illegal instruction errors to pop up later.

In addition, you need the qemu-arm-static executable available to the new fake Raspberry Pi:

sudo cp /usr/bin/qemu-arm-static mnt/usr/bin

Step 7: Chroot!

The chroot command will cause the Pi’s filesystem to look like the root directory (in one shell window). Then you can change user to pi (or any other user you want to configure):

cd mnt
sudo chroot . bin/bash
su pi

Using It

How do you know it is working? Try a uname -a command. You should see an armv7l processor type. You can run executables just like on the Pi. If you want to use X, set DISPLAY=:0 to use your main screen. For example:

DISPLAY=:0 dillo

Or you can set the display for all programs:

export DISPLAY=:0

Optional: Flash It

Now you are ready to go. After some development, you might want to save your work. All you need to do is to exit the chroot (type exit) and change /etc/ld.so/preload back (remove the # character you added). Then you should unmount everything that you mounted. The image file will remain and will contain all your changes. You can flash it, and you can reload it by repeating the chroot and mount instructions.

In Summary

There are lots of ways to do cross development on the PC for the Raspberry Pi. This is one of them. However, it also points out the power of using QEMU to run alien executables. That’s a trick you could use for lots of different development boards and platforms. There are QEMU emulators for several CPU types ranging from Microblaze to other ARM variants to PowerPC, to an S390. A quick glance at the /usr/bin directory for qemu-*-static will give you a list.

Sure, it is easy enough to get a Pi and use that. But this is yet another tool to do cross development when you need it.


Filed under: Hackaday Columns, Raspberry Pi, Skills

from raspberry pi – Hackaday http://ift.tt/1VdUjwl
via Hack a Day

Tuesday 17 May 2016

Raspberry Pi Zero now with Camera Support, Still Only $5

Self-Driving Cars Get Tiny

There’s a car race going on right now, but it’s not on any sort of race track. There’s a number of companies vying to get their prototype on the road first. [Anurag] has already completed the task, however, except his car and road are functional models.

While his car isn’t quite as involved as the Google self driving car, and it doesn’t have to deal with pedestrians and other active obstacles, it does use a computer and various sensors to make decisions about how to drive. A Raspberry Pi 2 takes the wheel in this build, taking input from a Pi camera and an ultrasonic distance sensor. The Pi communicates to another computer over WiFi, where a neural network operates to make decisions about how to drive the car. It also makes decisions based on a database of pictures of the track, so it has a point of reference to go by.

The video of the car in action is worth a look. It’s not perfect, but it’s quite an accomplishment for this type of project. The possibility that self-driving car models could drive around model sets like model railroad hobbyists create is intriguing. Of course, this isn’t [Anurag]’s first lap around the block. He’s already been featured for building a car that can drive based on hand gestures. We’re looking forward to when he can collide with model busses.


Filed under: car hacks

from raspberry pi – Hackaday http://ift.tt/1TTW902
via Hack a Day

Thursday 12 May 2016

Hackaday Prize Entry: Powering A Pi From A Battery

Knocking a microcontroller into sleep mode and waking it up on demand or in intervals is common practice in many low power applications, enabling devices to stay in operation for years on a single coin cell battery. Since there are tons of applications where you might want to do similar things with a Raspberry Pi, [Patrick Van Oosterwijck] created the LiFePO4wered/Pi. The module that snaps on to eight GPIO pins of a Pi, extending it by a long life LiFePO4 battery, a charging regulator, and a proper power management. Obviously, it also makes a great UPS.

lifepo_pcbs[Patrick] realized this project by expanding his already available and equally useful LiFePO4wered/USB charging regulator module by a low power MSP430G2131 microcontroller and a load switch. A daemon on the Raspberry Pi speaks to the module over I2C, allowing you to schedule a wake-up timer, let your Pi autoboot after a power outage or just read out the current battery voltage through a command line tool. Once the Pi is safely shut down, the microcontroller will also go to sleep, resulting in a standby current of 8 uA for the whole system. Together with the 500 mAh LiFePo4 cell, that’s theoretically low enough to send your Pi-ncess into a seven-year-long sleep.

LiFePO4wered/Pi is not only good for sleeping, though. [Patrick’s] runtime tests show, that the 500 mAh cell will power a Raspberry Pi Zero and a WiFi dongle for about two hours. Because the Raspberry Pi and many USB peripherals won’t complain when only 3.2 V are present on the VBUS, [Patrick] was able to squeeze out even more runtime by dismissing the boost converter from the design and driving the Pi directly from the battery voltage. If that worries you, you can either read a detailed explanation on why that works so well or just have a look at the more compliant 5 V version.

lifepo_time_laps_cameraEventually, [Patrick] used his module to create a Raspberry Pi time-lapse camera. A little script lets the Pi take a picture on boot up, set a wake-up timer and go back to sleep again. Safely enclosed in a waterproof electric box and deployed into the wild, the camera took 120 pictures on a single charge.

We’re sure the module will find it’s way into many cool projects and we’re counting the hours until we can get one in [Patrick’s] tindie store. Until then, enjoy the time-lapse video:

The HackadayPrize2016 is Sponsored by:

 


Filed under: Raspberry Pi, The Hackaday Prize

from raspberry pi – Hackaday http://ift.tt/24Qo6Bg
via Hack a Day

Monday 9 May 2016

Minimal MQTT: Building a Broker

In this short series, we’re going to get you set up with a completely DIY home automation system using MQTT. Why? Because it’s just about the easiest thing under the sun, and it’s something that many of you out there will be able to do with material on-hand: a Raspberry Pi as a server and an ESP8266 node as a sensor client. Expanding out to something more complicated is left as an exercise to the motivated reader, or can be simply left to mission creep.

We’ll do this in four baby steps. Each one should take you only fifteen minutes and is completely self-contained. There’s a bunch more that you can learn and explore, but we’re going to get you a taste of the power with the absolute minimal hassle.

In this installment, we’re going to build a broker on a Raspberry Pi, which is the hub of your MQTT network. Next time, we’ll get an ESP8266 up and running and start logging some data. After that, we’ll do some back-end scripting in Python to make the data speak, and in the last installment, we’ll explore some of the useful frills and fancy bits. Let’s get started!

Overview

MQTT is a pub-sub, store-and-forward, IoT-enabled, machine-to-machine connectivity protocol juggernaut. As you can see, it’s fully buzzword-compliant. That doesn’t necessarily mean that it’s super complicated, though. You can read up on MQTT until you’re blue in the face. Here’s the bare minimum you need to know to be comfortable.

The network has clients (called “clients”) and servers (called “brokers”). Clients, whether it’s your temperature sensor node or the graphing application that’s going to use the data, use the broker as a central hub. Data are arranged in “topics”, which use a directory-like structure. So the temperature node in my bedroom is called “home/bedroom/temp”. When I add a light sensor to my bedroom node, I’ll set up a topic called “home/bedroom/light” and so on.

When a client gets some new data, it “publishes” it to the topic — sends the data to the server. The server then forwards the data along to all of the other clients that have “subscribed” to the topic. In my example, the bedroom node publishes to “home/bedroom/temp” and then a databasing program which is a subscriber to “home/bedroom/temp” automatically receives it. And so does any other client that’s subscribed to the topic.
Often a given physical device will subscribe to some topics and publish to others.  My heating controller will want to act on the temperature sensors, and display its status on an LED in the bedroom, for instance. There’s naturally more to say, but let’s get our broker up and running first and explore the details later.

Build a Broker

attachment_69370628OK, “build” is a little bit overstated. We’re just going to download mosquitto, which is the most widely-used broker. If you’ve got a Raspberry Pi (or other spare computer) lying around, you’ve got an MQTT broker-in-waiting. Unfortunately, Raspbian comes with an old version of mosquitto by default, so we’ll have to do a tiny bit more typing to get the most recent version. Here’s how I set up a fully-featured MQTT broker on a brand-new Raspberry Pi (Jessie Lite):

curl -O http://ift.tt/1Jo2xYJ
sudo apt-key add mosquitto-repo.gpg.key
rm mosquitto-repo.gpg.key
cd /etc/apt/sources.list.d/
sudo curl -O http://ift.tt/20kE7aR
sudo apt-get update
sudo apt-get install mosquitto mosquitto-clients

Et voilĂ . Later, when we need to access the broker from the outside world, we’ll need to know the Raspberry Pi’s IP address, but that’s it. You’re up and running. If you’re using an older version of Raspbian, substitute “wheezy” for “jessie” in the fifth line. If you’re using anything other than a Raspberry Pi, you can probably find what you need, including Windows binaries, here. (I haven’t tested Windows or Mac.)

Playing Around

Now that our broker is set, let’s do some quick experiments to get a taste of how MQTT works in practice. The astute among you noticed that I also installed mosquitto-clients. Let’s try them out.

Open up a window and type mosquitto_sub -h localhost -t "test/topic". Congratulations, you’ve just subscribed a client to the “test/topic” topic. -h localhost connects you to an MQTT server on the local machine, rather than on the broader Internet. If we weren’t setting up our own server, I’d have you point to the MQTT test servers. As it is, I’ll just let you know that they’re out there when you need them.

OK, let’s publish our first data. Open up another window and type mosquitto_pub -h localhost -t "test/topic" -m "hello!" Same server, same topic, but now we’re sending a message. You should see the message pop up instantly in the subscribed window.

Try opening up multiple subscriber windows, subscribed to the same topic. You’ll see that they all get the message. Try sending messages to topics that don’t exist yet. What happens?

One last stupid MQTT trick before we get to the important stuff. MQTT can use two different types of wildcards in the topic names. So my network has “home/bedroom/temp” and “home/cellar/temp” topics. I can read all the temperatures by subscribing to “home/+/temp” and get all the values from my bedroom node from “home/bedroom/#”. (“+” matches one hierarchical level, while “#” stands for everything deeper in the tree.) Once you start using wildcards, you’ll want to know which topic is reporting, so try subscribing in verbose mode mosquitto_sub -h localhost -v -t "test/#" and send yourself some test messages to different topics.

Quality of Service

Here is MQTT’s killer feature for a low-power home automation sensor network: it’s a “store and forward” protocol with a couple levels of quality of service (QOS) guarantees. If your node has already registered with the broker and it’s offline when a new message comes in, the broker can take care of delivering that message to the node as soon as it reconnects. This means that your nodes can spend most of their lives in a deep sleep, conserving battery power, and when they do finally connect, they haven’t missed anything.

Three things are needed for the QOS feature: the subscribing clients need to be previously registered by ID with the server, and they need to disable the (default) clean-slate behavior otherwise all stored messages are erased when you log back in. Both the subscriber and the publisher need to be using quality-of-service level one or two so that the server knows it’s a stored message. (QOS level one usually suffices, but feel free to read up.)

Here’s an example:

subscriber:  
    mosquitto_sub -h localhost -v -t "test/#" -c -q 1 -i "james bond"
publisher:
    mosquitto_pub -h localhost -t "test/topic" -m "wowie" -q 1
    mosquitto_pub -h localhost -t "test/topic" -m "zowie"

To demonstrate what QOS does, run the subscriber’s command in one window and send the other two messages to it. You’ll get them both. Now stop the subscriber with ctrl-c and resend both messages. Now, when you subscribe again, you’ll only get “wowie” because it was the message sent with QOS enabled.

One gotcha with IDs is that you’ll only get whatever has happened between IDed logins. You have to be previously registered with the server so that it saves messages for you. You can’t just walk in, give it a new ID, and say “what have I missed?” because it doesn’t know you yet.

Also note that the subscriber must do three things to enable receiving messages with QOS. The ID and QOS levels are obvious. The one I always forget is to disable clean-slate logins with the -c flag. Don’t forget.

Retained Messages

If you don’t need to get the full history of messages since your node was last online, consider the “retain” flag. When messages are sent as retained, the last such message gets automatically transmitted to any client that subscribes to the topic. Retained messages are great for things like status reports. Any time that you want to log in and see just the last value without having to wait for an update, you’ll wish you had retain set. And note that retained messages and QOS aren’t exclusive — just be careful because you’ll get one message (the most recent one) delivered twice.

More??

This was just a taste of the power of having your own MQTT server running. Next, we’ll connect some small devices to the network, and then we’ll build up some back-end processing. If you’ve gotten this far and just can’t wait, try playing around with mosquitto_sub -h test.mosquitto.org -t "hackaday/new_articles" -c -q 1 -i "your_name_here". The stream is published with QOS=1 and retains the last message. Feel free to play around and show us what you build in the comments.


Filed under: Engineering, Hackaday Columns, Network Hacks, Original Art

from raspberry pi – Hackaday http://ift.tt/1XhnMWl
via Hack a Day

Sunday 8 May 2016

Raspberry Pi Balloon Goes Too High, Goes Boom, But Survives

Some people like to get high on a Wednesday afternoon. [Kevin Hubbard] of Black Mesa Labs likes to get really high. Even higher than intended: last month, he flew a helium balloon powered by a Raspberry Pi to 103,000 feet. It was only supposed to go to 90,000, but a fault in the code for the controller meant that it went higher, burst and plunged to the ground. All thanks to an extra hash mark in his code.

[Kevin] was part of a team called the Balloongineers who are competing in the Global Space Balloon Challenge, a project to simultaneously fly balloons from multiple locations. The Balloongineers entry was called HAB1, built around a Raspberry Pi, an FPGA watchdog system, a uBlox GPS and an Iridium satellite modem. The idea was that their balloon would zoom up to 90,000 feet, where it would release some helium gas, hover, and move eastwards with the prevailing winds. reporting back via satellite as it went. Unfortunately, something went wrong. The balloon didn’t report back properly, and kept on rising, eventually reaching over 100,000 feet, where it burst and fell to earth.

[Kevin] thought all was lost, including the expensive satellite modem that HAB1 used. But the next day, his balloon sent him an email, reporting that it was hale and hearty at an altitude of 300 feet. After recovery, he analyzed HAB1, and figured out what had happened: a single mistyped hash mark had caused the system to lock up when it tried to open the vent to release the gas.

What saved the rig was the foresight [Kevin] had in building it. Although the system didn’t work fully as planned, the FPGA watchdog (nicknamed the Lizard Brain) eventually noticed that the main computer was locked up, and rebooted it, enabling the system to report back to [Kevin]. An additional recovery mode woke the system once an hour sent a location and went back to sleep, which allowed the small battery to keep powering the system until it could get a signal out the morning after. That’s a smart piece of design in a system that allowed them to recover the hardware, even though the main objective of hovering at 90,000 feet wasn’t achieved.

[Kevin] ends his writeup of the flight with a few notes that any engineer would be wise to consider. Primary among these is his decision to have the system check very rarely for manual overrides over the satellite connection. He decided to do this to save money: checking for messages on Iridium costs a certain amount each time you do it. If he had checked more frequently, he might have been able to fix the problem earlier by venting the helium manually, leading to a more controlled descent and recovery. In any project, a failure can only be useful if you can figure out what the problem was, gathering as much information as possible to help you avoid it next time.


Filed under: Raspberry Pi

from raspberry pi – Hackaday http://ift.tt/273UZZM
via Hack a Day

Saturday 7 May 2016

Chess Computers Improve Since 90s

The AlphaGo computer has been in the news recently for beating the top Go player in the world in four out of five games. This evolution in computing is a giant leap from the 90s when computers were still struggling to beat humans at chess. The landscape has indeed changed, as [Folkert] shows us with his chess computer based on a Raspberry Pi 3 and (by his own admission) too many LEDs.

The entire build is housed inside a chess board with real pieces (presumably to aid the human player) and an LED on every square. When the human makes a move, he or she inputs it into the computer via a small touch screen display. After that, the computer makes a move, indicated by lighting up the LEDs on the board and printing the move on the display. The Raspberry Pi is running the embla chess program, which has an Elo strength of about 1600.

While the computer isn’t quite powerful enough to beat Magnus Carlsen, we can only imagine how much better computers will be in the future. After all, this credit-card sized computer is doing what supercomputers did only a few decades ago. With enough Raspberry Pis, you might even be able to beat a grandmaster with your chess computer. Computer power aside, think of the advancements in fabrication technology (and access to it) which would have made this mechanical build a wonder back in the 90s too.

 


Filed under: Raspberry Pi

from raspberry pi – Hackaday http://ift.tt/1WQ9WtH
via Hack a Day

Amazon

Donate

Donate Towards More Raspberry PI's for Projects