AS3935 Franklin Lightning Sensor™ + Arduino

Just a short post.
1) AMS made a nice lightning sensor chip AS3935
2) Jayson Tautic from TAUTIC ELECTRONICS LLC made even nicer breakout board
3) I made Arduino library to make use of AS3935 easy on this ever so popular platform
4) and tested it on Arduino Mega 2560 and chipKIT MAX32

The code (hopefully) works with most of original boards and clones.

Here is the link again, just in case you missed it – https://github.com/raivisr/AS3935-Arduino-Library

cheap signal generator? yes please!

Who does not want a VNA and/or Spectrum Analyzer? I do, but those are a bit out of my budget right now. But I still want to play with some loop antennas for the project that is in the works, so I need a way to measure loop antenna parameters. How is it done? Well, you put known signal into loop and measure response, that’s what VNAs and SAs do, but those are expensive…

Cheap AD9850 breakout to the rescue. China made AD9850 breakout boards are available on eBay for ~6USD shipped (I wonder how they do that if chip itself costs ~15USD in 1000 quantities from DigiKey). Those things are capable of putting out 0-40MHz in sub-Hz steps of quite nice and clean sine wave, but you need a way to control them. And so “somewhat useful” Arduino sketch was born. It uses AD9850 library from ELECFreaks, one can set specific frequency with it, make AD9850 sweep through frequencies tracking generator style or sweep through frequencies in oscillating manner – back and forth.

It is probably good for testing AD9850 breakouts too, enjoy – somewhat useful AD9850 Arduino sketch.

A bit of background info. Serial control is used, see the datasheet what pins need to be pulled up and what pin needs to be pulled down to enable that and since there is no information on module available, some nice guy called Andrew Quinn has documented pinout of these little neat boards on his blog.

antennas again – make-shift DVB-T antenna

We were chilling in countryside property over weekend and EuroCup 2012 was on. Good. No, in fact bad, because we had TV set, we had STB from local DVB-T provider, but no antenna. Quick check on frequencies our DVB-T is available on, revealed that channel we were after is is either on 474MHz or 530MHz depending on what tower we can get signal from. My assumption was that 474MHz tower is closer (later I was proven wrong), so I went looking for materials to make an antenna, I opted for so called folded dipole as it is extremely simple to build and has somewhat broader bandwidth than regular dipole. Search for materials on-site gave me following – piece of ~2.5mm insulated copper wire, piece of 75Ohm coax cable, piece of scrap cardboard and antenna connector, everything I needed!
Next, went to El Goog, searched for folded dipole calculator and found out that length of antenna in  meters can be calculated by formula 145/freq in MHz, so that was ~30cm. Off I went, copper wire got bent to shape, cardboard used as holder for it all, coax connected to antenna by wire wrapping and connector attached to the other end of coax.
While sipping our drinks we watched Greece win Russia 1:0 and we got signal from tower 73km away on 530MHz that this antenna was not designed for, if one can speak about any design at all in this case 🙂
make-shift DVB-T antenna

GSM/UMTS broadband discone antenna

At country house where we usually spend weekends gsm/umts network coverage is very poor, even voice jumps on and off, leave alone data. So in a course of trying to get my dose of internet while in this operator forsaken place I built a discone antenna that is known for it’s broadband properties. First tests while in good coverage area show that antenna works and works better than built in thingie of Huawei E1752, real tests will be conducted on weekend. As a backup, I purchased professionally made 9dBi log periodic that covers all frequencies in question.

Link to online discone antenna design tool
and image of antenna I built –


Antenna is built from 0.3mm brass sheet for cone and regular single sided PCB material, held together with hot glue 🙂

upd:
tests in very poor coverage conditions prove that antenna works and works good, while my HTC Desire barely has connection at all and even making voice calls is almost impossible, internet connection using Huawei E1752 usb modem and discone antenna has stable 3G/HSDPA connection.

upd2:
got return loss plot back from friend at  http://www.saftehnika.com/:

what this plot essentially means – my antenna has VSWR under 1.5:1 in gsm/umts range and is absolutely suitable for transmission.

3M EX111 HID Linux driver

I was confronted with touchscreen that identified itself as “3M EX111 HID” or in more technical terms – vid 0596, pid 0003 and of course there was no Linux driver for it.

Now there is, thanks to 3M being so nice as to publish reference manuals for their touchscreen controllers.

Driver can be found at https://github.com/raivisr/3M-EX111-HID-Linux-driver
Fork it, branch it, include it in Linux kernel tree, in short, make it live!

Linux hiddev MSR or timing is the king

Documentation about generic hiddev api in Linux is almost non-existent and there are little to none examples on the internet that can be easily googled. Nevertheless, I have been confronted with piece of software that reads USB MSR using HID interface. It was working all nice and fine only very rarely throwing up some glitch but most of the time that went by almost unnoticed. So was it until that piece of software was moved to new Linux kernel/hardware. Bummer, every 20th or so swipe would return previous card information. Totally not something one would expect looking at the sources et al.
After 2 days of debugging and messing around I found that cause for those hiccups were timing or good old race condition. No documentation of Linux hiddev tells you that you should give some time for driver to update data structures before trying to read them out and after event has been fired over “read” interface (Documentation/usb/hiddev.txt). So if you deal with generic linux hiddev API, use poll to check if something came in from device and use ioctls to read usages (just because device calls for that) make sure to insert some delay between poll/read and ioctl. I used 10ms, long enough for any modern computer to do lots of things, like update data structures in driver, short enough for human being not notice it.