Here’s a quick update: remember I said in my original post on powerline networking that the reason why I wasn’t getting a clean sinusoidal wave on the transformer was probably due to the fact that the duty cycle of the PWM signal generated by the PIC’s CCP was not 50%? Turns out I was right. I set the duty to exactly 50% and though I not getting a sine wave even now, its still pretty close.
Thursday, January 28, 2010
Tuesday, January 26, 2010
NOTE: Windows Live Write S*CKS! WYSINWYG (what you see is NOT what you get). I used to type out something, and land up with some completely vague formatting! It took me a while to fix this.
* * * * * * * * * * * *
Now who would have thought
that the powerline would be fraught
with difficulties such as these –
from an imbalanced phase
to noisy EMI
it all just seems a maze
I want to send data, I wish to communicate
betwixt and between two PIC micros -
in short, that's the scene.
How shall I do it? Well that's the debate!
The TDA5051’s the answer to my problems,
but that darn piece of silicon’s elusive, I must say!
I’ve searched Lamington Road, I’ve scoured Lajpat Rai;
drat! I can’t source it! The only recourse left is to pray.
With God on my side, and inspiration high
I sat down with paper and pen.
I scribbled here, pondered there, calculated in mid-air.
Schematics in hand, my proof-of-concept is ready,
I’m gonna TX some 1's and 0's now, Amen!
* * * * * * * * * * *
WHY in the name of the good Lord would I compose such a poem? The current project that I’m working on entails transferring packets of data bi-directionally from my laptop to an appliance using nothing but the power line that both are connected to. Communication through the power lines - Power Line Communication. PLC.
So why compose atrocious ‘electro-poetry’? People do all sorts of things in frustration. And why write such rhymes? A poet-friend of mine would chide me for writing such stuff. In my defence, my poem composing skills are not much better than a kindergartener; to me, lines in a poem must rhyme (heck, that’s how I used to remember them in KG!).
Anyway, let us set aside my inanity for the time being and note that the power line in India carries 230V RMS at 50Hz (it’s 120V RMS at 60Hz in the US). Devices using the X10 scheme wait for zero crossings of the AC signal to send data. The idea is that when the instantaneous voltage is 0V, there is the least amount of spurious ‘external signal’ on the power line. One bit, modulated by a 120kHz carrier, is sent every zero crossing. Only a single bit at a time can be transmitted, because, understandably, the time for which AC is 0V or near-about, is very short.
Now while this method works (its been implemented in several home automation devices), data rates are abysmally slow (50bps for 50Hz systems, and 60bps for 60Hz systems), and the maximum number of controllable devices is low. There does exist an extended X10 protocol which increases the number of devices supported, but the lack of speed still remains an issue.
A workaround (it isn’t really a workaround, per se; more like the obvious solution :-P) is to send data not just at zero crossings, but at all times. By modulating the data at the TX end and then demodulating it at the receiver, and adding some good error checking schemes, higher data rates can be achieved. The TDA5051 works just like this.
The TDA5051 is a 600/1200bps, ASK, half-duplex PLC modem. It is a complete solution, with an integrated analog front-end, a BPF, a decoder, and a communication module for connection with a supervisor (a microcontroller, or a PC for instance). Only a few additional external components are required.
This is all very nice and dandy, but for the misfortune that I just can’t seem to get my hands (well, tweezers actually – it’s a small chip) on a TDA5051.
So how did I get around the problem of the hard-to-find TDA chip? Simple – I rolled my own modem :-D . OK, OK, I’ll come clean. I haven’t yet built it completely, but I’m working on it. The basic testing that I’ve done seems most promising.
The steps involved at the TX end are:
38kHz PWM @ 18.5% duty, from the CCP module of a ‘628. In retrospect, I should probably have used a 50% duty cycle.
The graph is annotated. UARTs idle high; start-bit is low; data is streamed LSB-first; stop-bit is high, followed by idle-high.
The final Boolean output is
(UART) AND (PWM)
Waveform on the mains side of the transformer; secondary side is loaded with an LM317-based power supply. The waveform is probably not sinusoidal due to the 18.5% PWM duty.
At the RX side (test data and pics will be up soon):
RX side block diagram
* a transformer steps down the voltage…..5
* a high pass filter removes 50Hz mains…..6
* this is fed to a squaring circuit (made by NAND logic)…..7
* the squarer drives an IR LED…..8
* 38kHz bursts are beamed at a TSOP1738 which demodulates the carrier…..9
* the data is then fed to a microcontroller for further processing…..10
Using a TSOP1738 IR detector for demodulation – I admit that’s pretty smart even by my standards :-P I bet the chaps at Vishay never intended the TSOP to be used like this :-D
Friday, January 15, 2010
I haven’t written in AEONS! And I figured, “Hey! What better way to begin my two-zero-one-zero archive than by bragging…..oops!….I mean blogging about one of my new acquisitions”. I’ve recently bought myself a DSO. Not the fancy Agilent or Tektronix scopes; I bought myself something much more affordable – a DSO2090. I’m pleased with it. Very pleased. And, since there are very few reviews about it online, I’ve decided to write one.
I had initially decided to build my own DSO, but as I soon found out, building test and measurement equipment is no child’s play. I tried in vain to get my hands on a decent ‘scope on eBay, but most of the scopes were out of my budget, and the ones that were in, wouldn’t ship to India. A lot of manufacturers make USB scopes – PicoTech and BitScope being the notable ones. But again, too expensive. And I really got sick of trying to use my soundcard as a low cost ‘scope. So after much forum-trawling and late night ‘research’ I settled on the DSO2090. Do note that the price of this instrument can vary from 160 bucks to over 300 bucks on the net!
The ‘2090 is a good piece of equipment. It’s priced reasonably well (obviously, a lower price would be better! :-P), and it has most of the functions that higher end DSOs have. A few words of warning – don’t expect the ‘2090 to match up to a dedicated bench DSO. The ‘2090 is more like a tool that the moderate-to-advanced-level hobbyist, rather than a test engineer at Texas Instruments, would have.
Ripped from the seller’s (www.getbetterlife.com) eBay page
I still haven’t test driven the socks of the DSO, but I have managed to get my fingertips dirty. Read on for the lowdown.
The ‘2090 is a USB driven, two channel digital signal oscilloscope. Mine is a Hantek clone. It can measure at 100 megasamples per second (MSps), and has a bandwidth of 40MHz (for a nice explanation about the difference between sampling rate and bandwidth go here, and also read this).
- 100MSps real time sampling
- 2.5GHz equivalent sampling (also called ‘ETS’)
- 40MHz (-3dB bandwidth)
- 8 bit resolution
- Max input voltage 35Vp-p
- Vertical deflection: 10mV – 5V @ 1x probe (9 steps)
- Horizontal deflection: 4ns – 1hr (38 steps)
- Trigger: external, or either channel (edge based, single, normal)
- Several convenient measurements (P-P, frequency, RMS, etc)
- Math (add, subtract, multiply, divide)
- Saving screenshots (JPG, BMP
- Logging (DAT, Word, Excel)
- Nice demo function
- Other useful features
I ordered my DSO2090 from a China-based site. The cost was the lowest from among all the web-based dealers, AND more importantly, shipping costs weren’t atrocious. The base price was USD161.20, and shipping was USD29.71, for a total of USD191.91 (~INR 9,324). Customer service on the site was very prompt and courteous. Shipping to Gurgaon, India, took a little long – 10 days. But in all fairness, it was the Christmas week. Packaging was very good, and the DSO came unscratched and unharmed. I had no issues with customs (both Bombay, and Delhi released the parcel in less than 3 hours).
The scope is totally USB driven – no external power required. The cable supplied is a USB ‘Y’ type cable – One for power and data (black), and the second (red), to supply additional power, if necessary.
Two BNC clip probes and a few probe accessories come as part of the kit. The probes supplied are compensated 1x/10x probes. Considering the price, they’re very good quality.
At the back of the scope there are two metal tabs – “Ground” and “Cal”. The calibration tab gives a 2Vp-p square wave at 1kHz.
The body of the DSO is plastic, and build quality is fairly good.
As with almost all digital T&M equipment these days, the ‘2090 can be interfaced with custom software. As a bonus, sample C++, VB, and LabVIEW programs are included on the driver CD.
Below are a few screen shots of some measurements.
A 50% 6.13kHz PWM from the Super Probe that I built some time back.
What the DSO2090 is NOT:
- a Tek or an Agilent ‘scope
- a full-fledged DSO with benchtop features
- a standalone device
- a super-accurate device that you can trust your life (or other’s lives) on
What the DSO2090 IS:
- an awesome hobby ‘scope with lots of features
- a very low price test and measurement device
- very portable
- a very cool device that will enhance your geek image
The final word? If you’re a poor student hobbyist like me, and have reached the stage where you ‘absolutely need’ a way of seeing what signals are zooming around in your circuit, then the DSO2090 is certainly for you. There are variants to the ‘2090:
- the DSO2150 (150MSps/60MHz)
- the DSO2250 (250MSps/100MHz)
- the DSO5200 (200MSps/200MHz)
- the DSO5200A (250MSps/200MHz)
I find that the ‘2090 is the best value for money, and it fulfils my need, at least for now :-D . A recommended buy for those looking to purchase a ‘scope.