Go to content Go to menu

This post describes the Cosm smalltalk package which allows it to send sensor measurements to a cosm.com stream using either Pharo or Squeak Smalltalk.

It’s also possible to use this package with squeak on your Raspberry PI so you can create a data logger with Smalltalk instead of Python or shell scripts as described here.

Use your smalltalks monticello browser to add the following repository and open the repository.

	location: 'http://www.min.at/prinz/repo/cosm'
	user: ''
	password: ''

Inside you will find two packages. One for Squeak (4.x) and one for Pharo (1.4; 2.x).

First you should already have a cosm.com registration. If not register it’s easy and free. Cosm.com allows you to create so called feeds. A feed represents a collection of one or more streams. Streams are used to store values which can be charted on your cosm.com dashboard. So for example you can register a feed MyFeed and inside this feed a stream called Temperature. Now using the Cosm Smalltalk package you are able to send temperature measurements to your Temperature stream.

| client stream result ]

" Create a client instance with your cosm.com API key "
" and feed id "
client := CosmClient 
     newApiKey: 'this should be your API key' 
     feedID: 12345.

" Specify to which stream you want to send data and "
" in which format. Available formats are #JSON, #CSV "
" and #XML "
stream := client 
     openStream: 'my stream name' 
     withFormat: #JSON.

" Send a value (42) to the stream once "
result := stream put: 42.

" Take a block, execute it every x seconds (10) and send "
" the result of it to a cosm.com stream. This represents "
" an automatic stream "
stream put: [ 255 atRandom ] every: 10 
	align: false.
" Check if a stream is running automatically "
stream isRunning.

" Stop an automatic running stream "
stream stop.

When using automatic stream mode the time window can be controlled by every: which controls how often data is sent in seconds and align: which specifies if the time window should be time aligned. If set to false the time window starts after the block is evaluated. If set to true the time window is aligned based on how long the block took to evaluate. For example:

Aligned StartAt TimeWindow Block evaluation Next run
true 21:10:10 10 sec. 5 sec. 21:10:25
false 21:10:10 10 sec. 5 sec. 21:10:20
true 21:10:10 10 sec. 13 sec. 21:10:30
false 21:10:10 10 sec. 13 sec. 21:10:33

Running the following code

stream put: [ 255 atRandom ] every: 10 
	align: false.

produces random results between 0 and 255 sent to a stream resulting in a simmilar graphs like this:


So now you can send your measurements into the cloud.

After building the Raspberry PI extension board it’s time to do some useful things with it.

The board contains an I2C temperature sensor and you can also connect external sensors so how can you use it to monitor temperatures over a long time range and store and visualize the measurements?

This post describes a very simple way to do this as well as how to store the measurement data local as well as in the cloud.
[Read More…]

Makeing a mobile phone or tablet holder out of Lego bricks is not only very easy but also
fun to do.

You just need 13 parts. Just follow these steps and you will end up with a very handy tool
holding your phone in a perfect 65° degree angle position when watching videos.

The 3D model is done using ML-CAD and can be downloaded here

And here are some pictures of the finished holder.


Little Wireshark

Friday, February 8, 2013

In times of Carrier IQ and other unwanted pieces of software possibly active on your mobile phone it would be nice to have tools like on your desktop PC to see whats going on. One of these tools on a PC is WireShark, a network sniffer. Unfortunately it only runs on PC’s (either Windows or Linux) and not on your SmartPhone. So how would it be possible to trace your phones network traffic?

[Read More…]

Some Windows Mobile 6.x phones have a very nice feature which allows you to get notified if someone removes your SIM card from your phone (e.g. in case it was lost or stolen) and inserts another one. Unfortunately this feature is buried very deep in config menus for example on a Windows Mobile 6.5 phone (Samsung Omnia B-7350). It’s called uTrack or MobileTracker.
This post shows a step by step guide how to enable this feature and what happens in case of a SIM change.

[Read More…]