Archive for the 'Software' Category

Trim and bleed boxes for Xelatex PDF files

Printers need trim and bleed boxes to position and cut the printed pages correctly. Xelatex has no provision to transfer information about such boxes to the PDF file. Therefore the boxes must manually be added later, I use the podofo toolset. This procedure is only for when the file is ready for the print shop.
Continue reading ‘Trim and bleed boxes for Xelatex PDF files’

C-function calculates CRC of Sensirion SHT1x humidity sensor data

When reading the measured humidity or temperature value from the SHT1x Sensirion humidity sensor one may also read the optional check sum. This check sum can then be used to validate the read value. This function does this operation without using a precalculated CRC table.

Continue reading ‘C-function calculates CRC of Sensirion SHT1x humidity sensor data’

Python function calculates SHT1x humidity sensor check sum

When reading the measured humidity or temperature value from the SHT1x Sensirion humidity sensor one may also read the optional check sum. This check sum can then be used to validate the read value. This python function does this operation. See also a C-source alternaltive.

Continue reading ‘Python function calculates SHT1x humidity sensor check sum’

Interrupt driven SHT1x humidity sensor

The Sensirion humidity and temperature sensor has a two wire serial interface to read out the temperature and humidity. It also has a status register which can be set up, e.g. to choose the number of bits of the measured values . This post is about reading the sensors using the  power on defaults. Continue reading ‘Interrupt driven SHT1x humidity sensor’

Script reads public IP address from ADSL router using UnP

I know of three ways to get the present IP address of an ADLS router:

  • send a request to one of the “whatismyaddress” sites
  • write a script to log into your router and get the address from a status page
  • send a UPnP request to the router

The public IP address is an important thing to know if the router connects using dynamic IP. I use the following script to check my public IP now and then (every ten minutes actually) to detect changes, using UPnP. Another script then signals a dynamic IP name server about this.

Continue reading ‘Script reads public IP address from ADSL router using UnP’

Change Beaglebone display geometry

I’m not into the GUI on my beaglebone black, only multiuser run level 3. That is, I get a big black terminal on my HDMI display. OK, that’s what I want.

The problem was: the acendents of letters and the underscore ended up below the screen area, makes line editing difficult.

So, I installed fbset, a program to adjust the geometry of the frame buffer screen Continue reading ‘Change Beaglebone display geometry’

Arduino library for the AM2302 humidity and temperature sensor

The AM2303 sensor  from Aosong integrates a humidity and temperature sensor. A micro controller can fetch the sample values from the device via a single serial signal line. The measurement resolutions (not accuracy) are 0.1% RH and 0.1 °C.  AM2301, DHT21, DHT22,  SHT15, SHT11 and SHT10 are probably equivalent products. I have tested the library using an Arduino Pro Micro module. You can download the library here . Continue reading ‘Arduino library for the AM2302 humidity and temperature sensor’

Thunderbird: Import mail from Kmail

I think I have used Kmail for at least ten years, but now I give up. I have used Kmail2 for more than a year, but it just doesn’t work. I think this is the worst Linux application I ever have ever used – probably a KDE-killer application. I can’t get Kmail1 back, so now I migrated to Thunderbird. One practical aspect of this: How do I transfer mail from Kmail to Thunderbird?
Continue reading ‘Thunderbird: Import mail from Kmail’

Python script sends bulk email

Many organizations need to send e-mail to all their members now and then. This script sends one copy of the original e-mail to each member.  Continue reading ‘Python script sends bulk email’

Script reads present IP address from ADSL router

Update: A simpler and morre universal method to get your IP address:    http://oao.no/wpe/2014/10/script-reads-public-ip-address-from-adsl-router-using-unp/

I have a dynamic IP address ADSL subscription. This means that my public IP address changes now and then. If the address changes and I don’t know the new one, I cannot access my network from the outside. Address change detection also enables me to inform the dynamic IP name server I use ( http://freedns.afraid.org/ ) so my DNS entry will be updated. All this has to be done automatically in a script. There are servers around the Internet you can query for your present IP address (e.g. http://www.whatismyip.com/ ), but they usually have a limit on how often you can send queries.
Continue reading ‘Script reads present IP address from ADSL router’

Busybox DNS server

Busybox  is a collection of Linux utilities used for embedded systems, like network routers, robots, video cameras and toasters. A DNS (domain name system) server looks up the IP address when given a domain name. E.g. the response from querying with ‘busybox.net’ will be  140.211. 167.224. This post is a short introduction to the Busybox DNS server.
Continue reading ‘Busybox DNS server’

A class of Turing machines: Some turmite pair simulations

2012 is the Alan Turing year. One of his innovations is the Turing machine. My tribute to him is this online publication of papers related to my work og turmites. Turmites belong to a class of Turing machines acting on an infinite board divided into equal size squares.  The turmite concept was popularized by A. K. Dewdney  in Scientific American, Sept. 1989. Continue reading ‘A class of Turing machines: Some turmite pair simulations’

TS-7500: Accessing DIO from C and Python via server

The TS-7500 single board computer from Technologic Systems is one of a family of boards based on the Cavium ARM processor. The board runs a standard Debian Linux system from an SD card, useful for development, and alternatively a uClibc/Busybox system from flash for the production phase (boots in less than 3 sec). This computer board can be plugged onto a TS-252 IO-board for external connections.

The IO-pins can be accessed via the two port dioctl server running on the main board (or directly). One server port serves manual access by Telnet, the other one accesses from programs – any programming language with a socket library, remote or local.

Continue reading ‘TS-7500: Accessing DIO from C and Python via server’

Compile TS7500 sample code

The TS-7500 single board computer from Technologic Systems is one of a family of boards based on the  Cavium ARM processor. The board runs a standard Debian Linux system from an SD card, useful for development, and alternatively a uClibc/Busybox system from flash for the  production phase (boots in less than 3 sec). This post describes how to compile that sample code

Continue reading ‘Compile TS7500 sample code’

Cross compile for ARM, TS-7500 board

The TS-7500 single board computer from Technologic Systems is one of a family of boards based on the  Cavium ARM processor. The board runs a standard Debian Linux system from an SD card, useful for development, and alternatively a uClibc/Busybox system from flash for the  production phase (boots in less than 3 sec). Programs for the Debian system can be compiled on board, but that is a somewhat slow experience. So except for small test programs one will want to cross compile using a Linux work station. Continue reading ‘Cross compile for ARM, TS-7500 board’

NV-RAM for the TS7500 ARM single board computer

Technologic Systems’ ARM single board computers for embedded systems, the 7500 series, may be ordered with a battery backed up real time clock. However, unlike RTC chips used for PC’s these come with no static RAM. I missed this RAM for an application I was working on and therefore modified the board. This made this computer board a perfect fit for my client.

Continue reading ‘NV-RAM for the TS7500 ARM single board computer’

Encrypted vCards on server

Matrix codes appear everywhere. They often represent a URL pointing to a web page where more information can be found. Matrix codes can be scanned and decoded using a smart phone camera combined with an appropriate application. I can print a matrix code on my card which points to my vCard file on a server. A person I gave my card can scan the code and get more up to date and complete contact information than that printed in clear text. But I don’t like the idea of leaving my contact information openly on a server ready for search robots and other snoopers to take. Therefore the need for encryption.
Continue reading ‘Encrypted vCards on server’

Automatic podcast to player copier

When I plug my mobile phone or mp3 player into my PC the newest editions of the podcasts I subscribe to are transfered. No mousing and clicking anymore, everything is handled automatically by the computer.

Continue reading ‘Automatic podcast to player copier’

Dynamic IP nameserver updater, with a tweet

I have a server connected to the Internet over a dynamic IP ADSL connection. Now and then the IP address changes and name servers need to be updated so I can access the server from outside. This updater periodically checks the IP address, informs a dynamic IP name service when changes occur, and tweets me about it. Continue reading ‘Dynamic IP nameserver updater, with a tweet’

CRC integrity check of ARM Cortex flash memory

The program and data contained in a micro controller flash memory can become corrupted over time. The integrity can be verified by running a CRC test over the flash. This post describes how to automatically add the correct CRC to a binary file and later let the micro controller perform the check. Continue reading ‘CRC integrity check of ARM Cortex flash memory’

Hide PIN-code in random matrix

The digits of a PIN-code can be hidden in a message taking the form of a matrix of random digits. The digits of the PIN-code are placed in matrix positions given by a template. The owner of the PIN-code knows the pattern and is therefore able to decrypt the message. This is a simple way to make a paper based PIN-code reminder. Continue reading ‘Hide PIN-code in random matrix’

Stellaris Cortex and OpenOCD

I have always had problems with OpenOCD, mainly due to bad documentation out of sync with the code. I got a new evaluation board for the LM3S2965 processor (EK-LM3S2965) last week and gave OpenOCD a new try, and lo, this has become quite simple. Continue reading ‘Stellaris Cortex and OpenOCD’

Store docs in the microcontroller’s flash

When starting out as an engineer, building electronic circuits of many kinds, my mentor advised me to always leave a copy of the schematics within the box. This is a wise proposition, the schematics in the box will probably be up to date and readily available. On the other hand, external documentation may be displaced and even lost during a period of time. This is equivalent to program documentation: Comments within the source file are easier to keep up to date than some external documentation, like flow sheets.

Now I use a board with a micro controller which  flash memory is much larger than what I need for the application. So why not use that spare flash to embed  some docs? Continue reading ‘Store docs in the microcontroller’s flash’

Let a cgi script write a server page file with proper permissions

Web servers should run under a user who does have minimal rights and files accessible by the server should be owned by and writeable only by another user, preferably root. So, what to do if the cgi script should update a file that is accessible from the web? Continue reading ‘Let a cgi script write a server page file with proper permissions’

Auto dial for C-motech D-50 modem

This modem uses the 450 MHz band for wireless internet access. In Scandinavia this mobile internet access network is operated by ice.net. The following rules and scripts constitute an auto-dialer: when the USB modem is inserted the system automatically connects to the network. Continue reading ‘Auto dial for C-motech D-50 modem’

A small static nameserver

This is a simple domain-name server for an embedded system in a closed local network. Originally called the Severely Crippled Domain Name Server, this server is now the name server of Busybox.

The purpose of this name server is to give the embedded controller a name, so if connecting a laptop for configuration and other maintenance, the controller provides the laptop with its name so the user can access by name instead of IP number.

A bison push parser skeleton

Bison is a compiler-compiler which generates a parser basedon a grammar specification. The parser usually runs in a loopgetting new tokens from a lexical scanner.

This push parser works the other way around by letting thescanner call the parser each time a new token is available.

The copyright of this parser skeleton has been transferred to the Free Software Foundation and is now integrated with the Bison project.

The ring binder PC

This PC is built into a very simple case: a ring binder. The PC is anembedded controller – not used by humans but independently doing its specialunsupervised job. In this case it wakes up once a day, takes a picturewith a USB camera, stores it and then powers off again. Continue reading ‘The ring binder PC’

Luminary Stellaris under Linux

You may log in to the Luminary web page and download the source files for the ARM Cortex based boards they produce. I needed the source for the brushless motor kit: SW-RDK-BLDC-4694.exe, which is a Windows executable. Continue reading ‘Luminary Stellaris under Linux’

Build gcc for ARM Cortex processor

I have lately built several versions of the Linux GCC tool chain for the ARM Cortex processor. But the generated tools do not work properly with floating point, issuing errors about floating point inconsistencies. Continue reading ‘Build gcc for ARM Cortex processor’