Go to content Go to menu

Walkera has a lot of interesting Copters and also a lot of add on’s for them. The X-Z-18 is a simple camera module usable for example withe the Hoten-X quadcopter. Unfortunately there is nearly no or wrong documentation available on how to install and use it.

So this post shows how to install and use it. If you are interested on some internals of the X-Z-18 then have a look at this post.

The R/C transmitter used is a Walkera Devention DEVO-7.

[Read more…]

Warning: Trying to access array offset on value of type bool in /home/.sites/98/site1277/web/prinz/fp-plugins/bbcode/plugin.bbcode.php on line 190

Based on this post which describes controlling a Flight Simulator software with your R/C transmitter the following post describes the other way round: controlling a R/C model from the PC using an Arduino UNO.

The R/C transmitter used in this project is a Walkera Devention DEVO-7.

There are two ways to control a R/C modell from the PC:

  1. Using a standard R/C transmitter by using the trainer port most transmitters have (this should also work on older transmitter models). In this case the PC is responsible for providing a PPM signal which contains information’s about all transmitter channels. The PC can produce such a signal using it’s sound card or by using an Arduino connected to the PC via USB.

  2. By using only the transmitter module which could be found especially in newer 2GHz transmitters. The transmitter module used by the Devo7 is a WK-21201RF which uses a Cypress CYRF6936 wireless USB chip. This module has just 8 pins using standard signals like MISO, MOSI, Reset, CS, VDD, GND (Pinout can be found on Google) and can be directly connected to the Arduino.

This solution uses the DSC trainer port of the Devo7 (so there is no need to open the Devo7) and an Arduino for creating the PPM signal.

[Read more…]

Large service providers like Google are already offering two way authentication for their services. Others like Microsoft will follow. This authentication mechanism is based on One Time Passwords OTP combined with a timing factor resulting in Timebased One Time Passwords TOTP specified in RFC-6238.

But it’s also possible to provide two factor authentication for self written services. The provided package can be found in the following repositiory:

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

It provides a simple way to create and validate TOTP’s for a given time or a time window.

" Enter the shared secret here. This is for example "
" the secret you will get if  you change your Gmail "
" account to two way authentication "
key := TOTP decodeBase32: 'qqmholtfsmddokpy'.
" Instantiate a new tokenprovider with a 30 seconds "
" time window "
tp := TOTP createWithSecret: key StepSeconds: 30.
" Calculates a new one time password which "
" changes every #StepSeconds seconds "
token := tp calculateOneTimePassword.
" Validate a token "
valid := TOTP verifyOneTimePassword: token Secret: key.

The larger the StepSeconds parameter the longer the generated tokens won’t change and the greater the time difference between client and server can be. The algorithm uses UTC for client and server times. 30 Seconds time step means that a new token is generated every 30 seconds and that a token is considered valid 30 seconds before and 30 seconds after the point in time it was created.

So change your Google account today and use Pharo to calculate the tokens.

Playing around with Zinc’s streaming entities I looked for a source of streaming data. A never ending streaming source are video streams. So I implemented a very simple Motion JPEG reader using Pharo Smalltalk. It does not use any plugins. Just plain smalltalk and a stock pharo image.

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

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

Some people have reported hat they cannot load the package into their image. Opening a monticello browser, adding a new http repository with +Repository and pasting the code snippet above and then opening the repository works as expected. Alternatively you can download the package using this link and open it from a local directory repository.

Update 2:
As noted by Sven Van Caekenberghe the mime type for .mcz monticello archives is now set to application/x-monticello in the webserver response. So now there should not be any format errors. Thanks for this hint.

Update 3:
Cédrick Béler modified the source to work under Pharo 7. Thanks for that. The new version can be found in the repo.

It consists of just one class Mjpeg.

| cam |
" Create a new MJPEG stream from a given url "
cam := Mjpeg 
   fromUrl: ''.
" Start reading the stream and displaying it in a window "
cam start. 
" Start capturing the stream frame by frame to disk "
cam startCapture: 'c:/temp/test'.
" Returns true if the stream is started (reading or "
" capturing), false otherwise "
cam isRunning.
" Stop reading the stream and close the camera window "
cam stop.
" Stop capturing "
cam stopCapture.

There are two example class methods availabe.

" Sample of a webcam stream from Tokyo "
Mjpeg exampleTokyo.
" Webcam from Vienna "
Mjpeg exampleVienna.

Performance of this simple implementation is quite good. The Tokyo example used the stream available at Playing this stream with Pharo has no impact on CPU usage whereas playing the same stream with Chrome has a noticeable effect on CPU usage.

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.