Tag Archive for 'Python'

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’

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’

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’

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’

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’