Transport mechanisms
Connecting devices
-
Devices can be connected in two ways
-
There are many types of wireless connection
-
Mobile phone (many subtypes)
-
IEE 802.11 (many subtypes)
-
Bluetooth
-
Infra-red
-
There are many types of wired connection
-
one-wire
-
two-wire
-
serial cable
-
parallel cable
-
ethernet cable (many subtypes)
-
firewire
-
power cables
-
phone lines (many subtypes)
Wired characteristics
-
Nodes must be connected in some topology (e.g star from central hub,
linked by single cable)
-
Range on each link
-
Cell boundaries
-
Cell size
Wireless characteristics
-
Range in free space
-
Attenuation by materials
-
Power consumption of transmitter
-
Power consumption of receiver
-
Static or moving receivers?
-
Cell size
-
Cell handover
Ethernet
-
The main standard for computer to computer connection
-
Common speed is 10Mbits/second, though 100Mbps is also
popular and higher speeds are possible
-
An ethernet card costs A$30 upwards for 10/100Mbps
-
Category 5 cable is A$1.15 per metre from Jaycar
-
An 8-port 10 Base-T hub is about A$100
-
An ADSL modem/router is about $A150
Serial/parallel cable
-
9 core shielded cable is A$2 per metre
-
Used to connect computers to external devices
-
There are many kits to interface to other devices
-
8 relay switches and 0-5V analogue output (Dick Smith, A$50)
-
Stepper motor controller (Jaycar, A$50)
-
I/O controller kit with
8 inputs, 8 relay switches (Jaycar, A$57)
-
Typical serial bit rates are 9600 baud upwards
-
Theoretical max is 290kBps
USB
-
Standard connector for PCs
-
Max speed of 12Mbps
-
Multiple USB devices can be chained together
-
USB cable is A$1.40 per metre (Jaycar)
Firewire
-
IEEE 1394 standard arising from Apple Computers
-
Data transfer rates to 400Mbps, with 3200Mbps planned
-
Connect upto 63 devices without needing hubs
-
Evergreen PCI card costs US$99
-
Evergreen PCMCIA CardBus costs US$149
1-wire
-
A proprietary format from iButton
-
Low data rates (info is hard to find)
-
Good for uses such as sprinkler control, temperature control
where low speed and latency delays upto a second are not issues
-
iButtons exist for temperature, switches, etc
-
There are C and Java APIs for 1-wire
Power cables - X10
-
Power cables already exist within the house, so
additional cost is zero
-
X10 power cable devices send a 120 kHz burst across the 50/60 Hz
power line: the presence of a burst per 50 HZ cycle
is a one, absence is a zero
-
Data rate is 50 bits per second, and a message requires
48 bits (4 bit house code, 4 bit device address, 40 data bits)
-
X10 is proprietary
-
Communication protocol is one-way: command only, no feedback
-
Dick Smith sell X10 kits for A$150
X10 modules
-
Modules can replace non-X10 devices, such as an X10 light switch
-
Existing devices can plug in to X10 modules, such as a lamp module
-
Modules include
-
on/off/dimmer switch
-
timer
-
telephone responder to control other X10 devices from
touch-tone buttons
-
serial port plug to allow computer control of X10 devices
WiFi
-
IEE802.11b standard, most common for wireless networks
-
Data transfer rate upto 11Mbps
-
Uses public 2.4Ghz scientific band
-
Range of upto 30 metres, depending on power, aerial, walls, etc
-
PCI wireless card costs A$100
-
PCMCIA wireless card costs A$90
-
Wireless Access Point to connect to wired LAN costs A$300
-
Intel Centrino chips already include wireless
-
Has two modes:
-
Managed: uses Wireless Access Point
-
Adhoc: for "spontaneous" connection between computers
-
802.11a and 802.11g are two extensions that allow 56Mbps
Bluetooth
-
Designed for adhoc networks
-
Data transfer rate of 1Mbps
-
Uses 2.4Ghz scientific band
-
Shorter range than WiFi, about 10 metres, uses less power
-
Limited to 8 devices in each "pico network"
Infrared
-
Line of sight only
-
Cheap and unrestricted use
-
Commonly used betwen mobile phones and PCs to download email
-
Used to talk to toys such as Lego Mindstorms
-
Max data rate is 4 Mbps
Consumer infrared
-
Used in infrared remote controllers for TVs, etc
-
No standards - there are pieces of h/w to listen to remotes
and tell you what they transmit, and there are sites listing
the codes
-
Uses ~40khz signal
-
What do toys use?
iRda
-
Standard for higher-speed two-way transmission
-
Most laptops have iRda
-
iRda USB modules are available for desktops
RFID tags
-
Like electronic barcodes
-
Each RFID tag holds about 16 bytes of data
-
Tags may be active (own power supply) or passive (react in a wireless
field)
-
Passive tags have a range of about 10cm, active upto several metres
-
Passive tags can cost cents, active tags a few dollars
Typical system
-
Garden watering on 1-wire
-
Internal lighting control on X10 power devices (on/off/dim)
-
Intrusion detection using IR and micro-switches.
Intrusion messages passed by
-
coaxial cable
-
power cable
-
wireless
-
Video and audio streaming by
-
coaxial cable
-
twisted pair ethernet
-
wireless
Data rates
1000x800 256 RGB @ 30 fps | 7.2 Mbps |
MPEG-1 encoding 325x140 @ 30fps | 1.5 Mbps |
HDTV 1920x1080 @ 30fps | 80 Mbps |
Audio CD 16 bit 44.1k samples per second | 1.35 Mbps |
MP3 (typical quality) | 0.13 Mbps |
Making audio available on the internet
-
My audio amplifier takes input from a CD player, a turntable,
the TV audio and a tuner
-
After pre-amplification it is sent to normal loudspeakers,
but also to the soundcard of a PC
-
The digital signal processor (soundcard) converts this
to a digital signal which I can save to file, use to burn
CDs - or send to other network devices
Internet loudspeaker
Speaker server code
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#define SIZE 1024
char buf[SIZE];
#define SPEAKER_PORT 2013
void copy_to_speaker(int speaker_in) {
int pfd[2];
int pid;
int nread;
if (pipe(pfd) == -1) {
perror("pipe failed");
exit(1);
}
if ((pid = fork()) < 0) {
perror("fork failed");
exit(2);
}
if (pid == 0) {
close(pfd[1]);
dup2(pfd[0], 0);
close(pfd[0]);
execlp("sox", "sox",
"-t", "au", "-",
"-t", "ossdsp",
"/dev/dsp",
NULL);
perror("play failed");
exit(3);
} else {
close(pfd[0]);
while ((nread = read(speaker_in, buf, SIZE)) > 0) {
write(pfd[1], buf, nread);
}
close(pfd[1]);
}
}
int main(int argc,
char *argv[]) {
int sockfd, client_sockfd;
int nread, len;
struct sockaddr_in serv_addr,
client_addr;
/* create endpoint */
if ((sockfd =
socket(AF_INET,
SOCK_STREAM, 0))
< 0) {
perror(NULL);
exit(2);
}
/* bind address */
serv_addr.sin_family =
AF_INET;
serv_addr.sin_addr.s_addr =
htonl(INADDR_ANY);
serv_addr.sin_port =
htons(SPEAKER_PORT);
if (bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0) {
perror(NULL);
exit(3);
}
/* specify queue */
listen(sockfd, 5);
for (;;) {
len = sizeof(client_addr);
client_sockfd =
accept(sockfd,
(struct sockaddr *) &client_addr,
&len);
if (client_sockfd == -1) {
perror(NULL);
continue;
}
/* transfer data */
copy_to_speaker(client_sockfd);
close(client_sockfd);
}
}
Sound source code
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/stat.h>
#include <fcntl.h>
#define SIZE 1024
char buf[SIZE];
#define SPEAKER_PORT 2013
void send_to_speaker(int speaker_port) {
int pfd[2];
int pid;
int nread;
if (pipe(pfd) == -1) {
perror("pipe failed");
exit(1);
}
if ((pid = fork()) < 0) {
perror("fork failed");
exit(2);
}
if (pid == 0) {
close(pfd[0]);
dup2(pfd[1], 1);
close(pfd[1]);
execlp("rec", "rec",
"-s", "w",
"-c", "2",
"-r", "44100",
"-t", "wav", "-",
NULL);
perror("play failed");
exit(3);
} else {
close(pfd[1]);
while ((nread = read(pfd[0], buf, SIZE)) > 0) {
write(speaker_port, buf, nread);
}
close(pfd[0]);
}
}
int main(int argc,
char *argv[]) {
int sockfd;
int audio_file;
int nread;
struct sockaddr_in serv_addr;
if (argc != 2) {
fprintf(stderr,
"usage: %s IPaddr\n",
argv[0]);
exit(1);
}
/* create endpoint */
if ((sockfd =
socket(AF_INET,
SOCK_STREAM, 0))
< 0) {
perror(NULL);
exit(2);
}
/* connect to server */
serv_addr.sin_family =
AF_INET;
serv_addr.sin_addr.s_addr =
inet_addr(argv[1]);
serv_addr.sin_port =
htons(SPEAKER_PORT);
if (connect(sockfd,
(struct sockaddr *) &serv_addr,
sizeof(serv_addr))
< 0) {
perror(NULL);
exit(3);
}
/* transfer data */
send_to_speaker(sockfd);
/*
fprintf(stderr, "connected\n");
while ((nread = read(audio_file, buf, SIZE)) > 0) {
fprintf(stderr, "Writing %d\n", nread);
write(sockfd, buf, nread);
}
close(sockfd);
close(audio_file);
*/
exit(0);
}
Speaker cost
-
Assuming a PC already exists with soundcard to capture audio
-
Add a WiFi PCI wireless card: A$80 for D-Link card
-
PC in speaker: strip down an old PC. A$200? Must be new enough
to have PCI bus. A 400M disk is big enough to install a
stripped down Linux without effort
-
Add a WiFi PCI wireless card to the speaker
-
Power amplifiers for car systems start at A$100 - pick up a
secondhand one for A$40
-
Then you have to find a speaker with enough space for a PC
motherboard :-(
-
How will WiFi cope in the same box as a power amplifier and
an 80 watt bass speaker? Will shielding be adequate?
-
Open questions:
-
what is a realistic minimum cost?
-
Can uncompressed data be sent?
-
Commercial WiFi audio system available from Yamaha MusicCAST
- speakers are A$1500
Jan Newmarch <jan@newmarch.name>
Last modified: Tue Apr 6 21:08:45 EST 2004
Copyright © Jan Newmarch, Monash University, 2007
This work is licensed under a
Creative Commons License
The moral right of Jan Newmarch to be identified as the author of this page has been asserted.