A little while ago I purchased a very cheap Floureon Wifi IP Camera webcam. It comes with a short user guide to setup the device. You start by downloading the Camhi software onto your phone or ipad. The webcam has wifi and ethernet connections. You introduce the handheld device to the webcam by holding them physically close together and allowing the ipad to start an audio dialog with the webcam to establish its ip address. Once they have "paired" in this rather novel fashion you can look at the camera output on the ipad and swipe in any direction on the screen to pan/tilt the camera so that it shows what you want to see. The picture quality is detailed and clear with good colour, sound is also available, I found the movement functions tedious. You can take snapshots or record videos and optionally save them to an SD card. I couldn't find any further details about the webcam online so at face value you have a very nice webcam with an interface to a handheld device.
My current application requirement is to provide a nightime garden webcam to look for activity, particularly from foxes. I need to record video when motion is detected in the picture so that it can be looked at the next day. I have a Raspberry pi noir webcam which isn't being terribly useful for this purpose although it did previously carry out great service as a puppy cam in our kitchen.
As the supplied CamHi software doesn't have the functions we require (in particular motion based recording), it is necessary to find other ways to access the webcam via its network interface. A very helpful open source site ispyconnect provides details of URLs which can be used to access webcams. We know our ip address 192.168.0.175 and user/password admin:admin.
To take a snapshot from the camera we can use a chrome URL:
http://admin:admin@192.168.0.175/snap.jpg
To stream a video from the camera we can Open a network stream in vlc with:
rtsp://admin:admin@192.168.0.175/1/h264major
The video can be streamed at a lower resolution with:
rtsp://admin:admin@192.168.0.175/2/h264major
For the picamera we have previously used linux motion software very successfully to process a video stream and record only when motion is detected. We can utilise the stream coming from the webcam by specifying in motion.conf configuration file netcam_url the rtsp streaming address. Once we restart the motion service (on RPi pi34) we can view camera output at http://pi34:8081.
I am quite keen to be able to be able to control pan/tilt from linux or PC. I found that I can login to its network interface http://192.168.0.175.
In addition to showing the camera view it allows me to use pan and tilt. "Left and right", "up and down" buttons cause the camera to scan throughout its range. You can view two streams, full detail (1280x720) or smaller (640x352). There are 8 preset positions you can setup.
The settings tab is informative, allowing you to see/set many more features on the camera (e.g. turn IR on / off). The network page includes settings for ONVIF, which is already on at port 8080. This should allow me to use a general purpose ONVIF client to control the camera. ispyconnect has a suitable client Agent DVR which I could install on Windows.
After a little experimentation I was able to setup the camera in ispy Agent UI and see the camera. It also gives me a device service URL http://192.168.0.175:8080/onvif/devices . Using Ispy PTZ controls are a bit better.
I was now ready to try out the solution. It turns out, quite reasonably, that infra red light reflects well off glass (which is designed to let optical wavelengths through) so attempts at a setup inside were not successful. As the weather is good I took the IPCAM outside and set it up in the garden. Using the web interface I set the IR leds on continuously. I setup linux motion software to record when movement is detected. I set the sensitivity quite high to capture small changes, and I did capture various moths / insects whizzing by, but I did also see the fox doing his/her evening walk across the garden just before midnight. The motion software worked well, it only recorded about 5 minutes video overnight so it isn't onerous to look through the recording.
Wednesday, 22 April 2020
Tuesday, 21 April 2020
Pi-Lite
It is a little strange to be posting about Pi-Lite. It is a Raspberry Pi add-on which I received in 2015. I picked it up and tried it out after a gap of a few years and I was again struck by what a lovely little product it is. It came from a company called Ciseco which folded in about 2017 so the original documentation is no longer available. However Matt Hawkins produced a tutorial I used at the time for familiarisation and he (his site anyway) is still around so I was able to find what I needed.
The board is simply a set of 14x9 monochrome LEDs which can be used to display images or scrolling text. It is connected to the RPi using a serial UART and just needs to be plugged straight in to the RPi or 4 pin TX, RX, 5V and GND connections. LEDs are controlled by an ATmega328 chip on the board which accepts commands input from the serial port and changes the displays accordingly. You can program individual pixels, bars, or download a 14x9 pixel image using commands. By default information downloaded is treated as text characters and scrolls across the display as a message, which you can speed up or slow down.
To try out the board you start up minicom, a simple terminal emulator. Any text you type in is displayed on the Pi_lite as scrolling text. It makes more sense to control the display using a program and python-serial is a good way of doing this. Matt Hawkins / Ciseco provide some good demos. A stock ticker and weather report would have been fun but their data sources no longer work.
Pi-Lite doesn't have to be connected to an RPi, it works equally well on a PC serial port (with appropriate convertor). Of course you may not be satisfied with the commands provided on the ATmega328 and will probably have already realised this is an Arduino processor. You can modify the inbuilt program using the Arduino IDE to amend the Pi-Lite sketch. Alternatively you can write your own sketch using the Pi-Lite Arduino library to control the display however you want.
The board is simply a set of 14x9 monochrome LEDs which can be used to display images or scrolling text. It is connected to the RPi using a serial UART and just needs to be plugged straight in to the RPi or 4 pin TX, RX, 5V and GND connections. LEDs are controlled by an ATmega328 chip on the board which accepts commands input from the serial port and changes the displays accordingly. You can program individual pixels, bars, or download a 14x9 pixel image using commands. By default information downloaded is treated as text characters and scrolls across the display as a message, which you can speed up or slow down.
To try out the board you start up minicom, a simple terminal emulator. Any text you type in is displayed on the Pi_lite as scrolling text. It makes more sense to control the display using a program and python-serial is a good way of doing this. Matt Hawkins / Ciseco provide some good demos. A stock ticker and weather report would have been fun but their data sources no longer work.
Pi-Lite doesn't have to be connected to an RPi, it works equally well on a PC serial port (with appropriate convertor). Of course you may not be satisfied with the commands provided on the ATmega328 and will probably have already realised this is an Arduino processor. You can modify the inbuilt program using the Arduino IDE to amend the Pi-Lite sketch. Alternatively you can write your own sketch using the Pi-Lite Arduino library to control the display however you want.
Wednesday, 15 April 2020
Tiny Core Linux
Intro
Recently we have looked at Linux in a variety of ways. Buildroot has been used to tailor and build a distribution, we have compiled Linux to run on the Atlas board, we have created many different systems on Qemu. Along the way I came across Tiny Core Linux (TCL) which provides a Linux system in 11MB. Kudos to Robert Shingledecker who developed it in 2008 and those who have supported it since then. It has an extensive user manual and an active forum.
Core System
The simplest variant of TCL is called Core. This comprises two files a recent linux kernel (5.4.3) and core.gz a compressed file system. It is available as an ISO. I could quickly boot from the iso file in Qemu and bring up a small system. It looks like linux, feels like linux and quacks like linux.
PiCore
A version of the system has been provided to run on RPi. I simply copied the iso to an SD card and booted on my RPI 1B. It comes complete with network access and SSH. Initially I connected a screen and keyboard but it was soon reliable enough to run headless.
TinyCore
The next step is to setup a windows manager FLWM (fast light windows manager) so that we have a working X system. Again we have a small amount of software. Using X under Qemu was a bit of a pain and I don't want to use an RPi like this so I installed on Roy's old laptop. A 2GB partition is vast overkill for a system which is now about 50MB but it enabled me to run some variants.
Linux Structure
The irresistable attraction of a tiny system is that it is small enough to have a crack at understanding the overall makeup of linux. The TCL manual was a big help as it describes the boot process initiated by the kernel which lays out the file system, sets up devices and hands over to init which is part of busybox. Init provides utilities for all the processes running on the system and makes requests to the kernel where necessary. Applications / programs can be added as necessary but aren't essential for a running system. TCL minimises the ones provided by default but has a good variety of extensions available for download and install.
So we really just have the kernel, Busybox binaries, some libraries and a few start up scripts which make up our system. As the icing on the cake Busybox has a link to Fabrice Ballards, linux in a browser running busybox.
Recently we have looked at Linux in a variety of ways. Buildroot has been used to tailor and build a distribution, we have compiled Linux to run on the Atlas board, we have created many different systems on Qemu. Along the way I came across Tiny Core Linux (TCL) which provides a Linux system in 11MB. Kudos to Robert Shingledecker who developed it in 2008 and those who have supported it since then. It has an extensive user manual and an active forum.
Core System
The simplest variant of TCL is called Core. This comprises two files a recent linux kernel (5.4.3) and core.gz a compressed file system. It is available as an ISO. I could quickly boot from the iso file in Qemu and bring up a small system. It looks like linux, feels like linux and quacks like linux.
PiCore
A version of the system has been provided to run on RPi. I simply copied the iso to an SD card and booted on my RPI 1B. It comes complete with network access and SSH. Initially I connected a screen and keyboard but it was soon reliable enough to run headless.
TinyCore
The next step is to setup a windows manager FLWM (fast light windows manager) so that we have a working X system. Again we have a small amount of software. Using X under Qemu was a bit of a pain and I don't want to use an RPi like this so I installed on Roy's old laptop. A 2GB partition is vast overkill for a system which is now about 50MB but it enabled me to run some variants.
Linux Structure
The irresistable attraction of a tiny system is that it is small enough to have a crack at understanding the overall makeup of linux. The TCL manual was a big help as it describes the boot process initiated by the kernel which lays out the file system, sets up devices and hands over to init which is part of busybox. Init provides utilities for all the processes running on the system and makes requests to the kernel where necessary. Applications / programs can be added as necessary but aren't essential for a running system. TCL minimises the ones provided by default but has a good variety of extensions available for download and install.
So we really just have the kernel, Busybox binaries, some libraries and a few start up scripts which make up our system. As the icing on the cake Busybox has a link to Fabrice Ballards, linux in a browser running busybox.
Monday, 6 April 2020
Atlas - Kernel Build
WS2
Following success with Rocketboards WS1 tutorial enabling me to write a C program running under linux in two way communication with an FPGA program I was excited by the prospect of WS2.
WS2 describes how to build a preloader (as before) build u-boot and build a kernel. I was able to build the preloader and build u-boot but kernel build dates from about 2015 and not all the sources are still available. The installation is very technical and I wasn't able to adapt it for myself.
Digikey
Robert Nelson, a modern day hero at Digikey has published, and kept upto date, a sequence of instructions to build u-boot and linux then create a bootable SDcard. The instructions explain how to:
Following success with Rocketboards WS1 tutorial enabling me to write a C program running under linux in two way communication with an FPGA program I was excited by the prospect of WS2.
WS2 describes how to build a preloader (as before) build u-boot and build a kernel. I was able to build the preloader and build u-boot but kernel build dates from about 2015 and not all the sources are still available. The installation is very technical and I wasn't able to adapt it for myself.
Digikey
Robert Nelson, a modern day hero at Digikey has published, and kept upto date, a sequence of instructions to build u-boot and linux then create a bootable SDcard. The instructions explain how to:
- Install the Linaro ARM cross compiler
- Obtain and compile u-boot
- obtain and build kernel
- Obtain Debian 10.3 root filesystem
- SD card creation.
I created a Debian 10.3 linux system on a USB hard drive so I could do the build without affecting my Windows PC configuration and the tutorial worked like a dream. The new SD card boots up on the Atlas system complete with ethernet interface, ssh and nginx. It used 550MB of the 2GB microSD card I supplied so there is plenty of space.
Subscribe to:
Posts (Atom)