Sunday, January 18, 2015

calibrating an rtl-sdr with PMR

The cheapness of the dvb-t style SDR comes with a price of it's own - an internal oscillator has not the highest possible precision and it's oscillating frequency tends to float a bit as the device gets warmer during an operation.

Thankfully there are ways to somewhat mitigate this issue in SDR software by setting the crystal's ppm offset. But how to determine the required value? Well, by comparing the SDR capture to something own like the PMR frequencies.
Via this simple method I found out the the freq. correction value for my dongle: -107 ppm.

Sunday, January 11, 2015

graphing sensor data

What's the value of collecting and logging sensors data if no graphs are produced? (a rhetorical question :)

As with many things, graphs can be generated in very-very many ways. I preferred using RRD until I found an excellent alternative - dygraphs!

Here are some examples of how I've utilized the dygraphs powers:


Electricity consumption measured from the meter directly.

The "idle" consumption is from the inverter-pump, refridgerator, aquarium lighning+pump, home HiFi and couple of connected wall-warts.

The peak comes from coffe-kettle and some breakfast preparations. 

Celler's temperature and humidity measured by a HopeRF TH01.

All three graphs data is gathered by (2) AVR microcontrollers and stored in an old EeePC from Asus running a pure debian Linux. 

Temperature measurements from the my wireless weather-station's outdoor unit.

Domesticating arduino pro mini clone

DIY Arduino ISP

At some point I realized that it was time to move on from convenient prototyping boards to more aschetic ones to both save in energy consumption and in money. As I've always wanted my hobby projects to be small in size I spotted those cheap arduino pro mini clones on eBay that suited my search criteria. (Search for an atmega328 running on 3.3V at 8 MHz. Anything under 3 EUR will do - there are just too many of those clones to point out any of them separately)

Pro mini boards do not have an FTDI chip meaning that programming can only be done via an external programmer. As I didn't have any I turned one of the MINI-AT boards to an ISP. That was really easy - the hardest part being solving the wiring and connectors problem (PC signal cables are notoriously fragile without dedicated connectors on either side) since I needed the programming process to be repeatable with many pro-mini boards that might end up on my workbench.

The key to my problem was in finding a spare 15 pin connector I had salvaged from an old printer just recently. By cutting off the excess the connector matched perfectly with the pro-mini 12 pin headers I was about to re-flash. To the other side of the programming cable I clamped a 6 pin type RJ11 connector and hid the wiring, status-LED's and an entire AT-MINI board inside a small telephone connection-box. (I had to take two extra connector-wires from another box since these are all shipped with just four wires. Same trick with the RJ11 plug - two extra metal tooth were needed from another connector-plug.)

Wiring

Programmer   -->   pro-mini board

VCC (+3.3V)   VCC
GND                GND
SCK                SCK
MISO              MISO
MOSI              MOSI
SS                   RST

PS! It is advised in forums to add some caps for the programming to be successful. I ended up with adding just one balancing 100uF 16V electolytic capacitor between VCC and GND. Nothing more, nothing less.

Uploading the code

To upload code via an external programmer one has to select 'Upload Using Programmer' from an arduino IDE (File menu) or press a keybord shortcut CTRL+SHIFT+U