Skip to main content

Posts

Showing posts from November, 2016

Mounting ARM Linux (OLinuXino/Raspberry Pi) SD card .img files on Desktop PC to access its rootfs

Linux distributions for embedded ARM board like Raspberry Pi or iMX233-OLinuXino-MAXI are available as prebuilt SD card images supplied as raw .img files. For example, .img files for ArchLinux are available for Raspberry Pi and OLinuXino . These files can be written to SD cards using the program dd on Linux or Win32 Disk Imager on Windows. These files contain the image of the SD card as a whole including multiple partitions - bootloader/bootlets, rootfs, swap etc. At some point of time we might find ourselves wanting to access the files from the rootfs contained within one of the partition of these image files. Accessing the kernel headers folder for cross-compiling kernel modules for these boards can be one such situation. And one does not necessarily need to write the image to an SD card and mount it back on ones desktop to achieve this. Major Hayden has straightforward instructions here  on how to mount .img files which contain multiple partitions. So when I found ...

Compiling Linux Kernel modules on OLinuXino (ArchLinux ARM)

So if you have an OLinuXino and have installed the development tools on the board and successfully compiled userspace programs on it (refer this blog post ), and are feeling adventurous, you can try compiling kernel modules as well. (Make sure you have gcc setup – refer to the blog post linked to above) So at the OLinuXino console (Serial or SSH) logged in as root: Install kernel headers: pacman -S linux-armv5-headers In your home directory, create the main.c source file: nano main.c and type the following and save the file: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 #include <linux/module.h> //Needed by all modules #include <linux/kernel.h> //Needed for KERN_INFO int init_module ( void ) { printk(KERN_INFO "Hello world\n" ); //A non 0 return means init_module failed; module can't be loaded. return 0 ; } void cleanup_module ( void ) { printk(KERN_INFO "Goodbye world\n" ); } MODULE_A...

Interface USB Mouse to your Arduino using CH375B

CH375B module. It is usually supplied with a 2 way jumper mounted on TXD and RXD pin. The TXD RXD pins are located next to the female USB receptacle. Please unmount the jumper before use. Get the following components: Arduino Nano  Male to female jumper wires  - 4 pieces USB Mouse CH375B module Download MeUsb.cpp and MeUsb.h from  https://github.com/xeecos/Me-USB-Host On your Windows computer which already has arduino installed, go to your documents folder. There you will find a folder called arduino and within that another folder called libraries. Inside this libraries folder create a new folder called "MeUsb" Place MeUsb.cpp and MeUsb.h in this folder In the arduino\libraries folder, create another folder called "SoftwareSerial_fix" And in this folder download and place SoftwareSerial_fix.cpp and SoftwareSerial_fix.h from the same link as above. Assemble the circuit on the bread board as follows: +5V of Arduino Nano to ...

Automatically rebooting Vstarcam HD C7838WIP Wireless IP Camera

I have 6 IoT devices in my house. Most of them are DIY and I have documented their build processes on this blog. One of them is a commercial product. Weather Station (OpenWrt) blogpost Energy Meter (OpenWrt) blogpost Ambient Sensors (Particle Photon) blogpost ADS-B Receiver (PiAware on RPi2) instructions on piaware DIY Security Camera (motionEye/RPi) blogpost Commercial Security Camera (Vstarcam HD C7838WIP) Out of these, the ADS-B Receiver and the Vstarcam (both running linux) kept losing connection to the cloud regularly. I have a few theories behind why this might be happening: Both these devices lie in the fringe area (near door/windows) of my house far away from the home router which is placed in the center of the house. The WiFi signal from my neighbors might be causing interference and decrease in signal quality for these devices and the WiFi driver might be trying hard to maintain connection before giving up. I know this because I looked up the system logs of th...

Automatically rebooting piaware and prevent outage (avoid "not feeding ADS-B to FlightAware" emails)

A few months ago, I setup a Raspberry Pi 2 at my house in Pune to monitor the ADS-B signals from aircrafts passing overhead. I referred the build process outlined here to build my own PiAware setup. The problem is that roughly twice a week, I used to get this mail saying that my feeder was no longer feeding data to flighaware. Barring a few rare instances when the trouble was due to internet outage, most of the time it required me to reboot the Raspberry Pi. Eventually I got tired, like a few other users here . Apparently it is due to WiFi dongle hanging or losing connection to the WiFi Router. To get around that, I wrote a script and set it up as scheduled task that runs every 5 minutes. The script checks if the RPi is able to ping Google's Public DNS servers, if yes, then it exits. If the ping fails, it waits for 10 seconds, tries again to ping again and if it fails this time, it issues a reboot command. In both cases, it loges results to a text file (saved on SD car...