atmel:smsrelaycontroller

Introduction

This project details how to connect Opto-Isolated Relay Board to an AVR development board and control it via Text message (SMS)

[#Beginning of Shooting Data Section]
Nikon COOLPIX3100
Focal Length: 5.8mm
White Balance: Auto
Digital Zoom Ratio: 1.00
2005/02/27 17:28:43
Exposure Mode: Programmed Auto
AF Mode: AF-S
Saturation comp: 0
JPEG (8-bit) Normal
Metering Mode: Multi-Pattern
Tone Comp: Auto
Sharpening: Auto
Image Size:  640 x 480
1/60.1 sec - F/2.8
Flash Sync Mode: Red Eye Reduction
Noise Reduction: OFF
Color
Exposure Comp.: 0 EV
ConverterLens: None
Sensitivity: Auto
...

BASCOM :-) Source Code

Hardware Description
Atmel AVR Microcontroller Development System
This kit was kindly provided to me by the friendly people over at http://www.btinternet.com/~e2one/avrbrd/
8×24 LCD Display
Details of how to wire up a 8×24 display to the development board can be found at http://www.btinternet.com/~e2one/avrbrd/ (see the 8×24 LCD Project). If you use a smaller display then you will have to modifying the code to suit.
Relay board
Opto-Isolated Relay Board, includes 4 channels for remote control of Mains appliances and circuits. Ideal for home control and industrial applications. Each channel is controlled by a TTL input and can easily be controlled by a microcontroller or control system.
et-opto_relay4_manual.pdf
relaycable.jpg Relay cable
Cable to wire the AVR board to the relay board
A mobile phone
I used a NOKIA 7110 but any phone that has a built in modem should be ok.
A DLR-3 cable
A phone connector wired to a DB9-F
If you don't have one or you can't afford to buy it then there are some good solutions for making your own.

As the ATMEL AT90S2313 only has 2k of code space the demo version of BASCOM can be used without hitting any of its restrictions.
Block diagram of the basic components used in the SMS Relay project.

A great site for the wiring of all things RS232 can found at http://www.lammertbies.nl/comm/cable/RS-232.html

9 Pin Connector on a DTE device (Phone connection)

Pin Number Direction of signal:
1 Carrier Detect (CD) (from DCE) Incoming signal from a modem
2 Received Data (RD) Incoming Data from a DCE
3 Transmitted Data (TD) Outgoing Data to a DCE
4 Data Terminal Ready (DTR) Outgoing handshaking signal
5 Signal Ground Common reference voltage
6 Data Set Ready (DSR) Incoming handshaking signal
7 Request To Send (RTS) Outgoing flow control signal
8 Clear To Send (CTS) Incoming flow control signal
9 Ring Indicator (RI) (from DCE) Incoming signal from a modem

Nokia 7110 DLR-3

Pin Signal Specs
1 V In 0..8.5V, 0..850mA
2 Chrg Control PWM, 32..37 Hz, 1..99%
3 XMic / Device Selector
4 SGnd / DLR-3 VCC 3.3 V
5 XEar / DLR-3 RTS
6 MBus 9600bps
7 FBus Rx / Modem 9600 - 230.400 bps
< 0.8V : '0'
> 2.0V : '1'
8 FBus Tx / Modem 9600 - 230.400 bps
< 0.8V : '0' @ max. 4mA > 1.7V : '1' @ max. 4mA
9 LGnd

The standard cable that is supplied with the AVR development kit uses a 3 pin configuration for RS232 data. It is wired as a DTE with built in loop back handshaking.

AVR RS232 DB9 wiring The DLR-3 cable expects partial handshaking from a DCE. The problem is the AVR board does not implement any hardware handshaking and is wired as a DTE.

To overcome this problem we will build a new cable. This will be wired so that the AVR board is seen as DCE, additionally it will also have a hardwired active DTR signal.

AVR board IDC Connector Function
1 5 Signal ground
2 3 Tx → Rx
3 2 Rx → Tx
4 4 Vcc → DTR

[#Beginning of Shooting Data Section]
Nikon COOLPIX3100
Focal Length: 10.2mm
White Balance: Auto
Digital Zoom Ratio: 1.00
2005/02/19 14:02:22
Exposure Mode: Programmed Auto
AF Mode: AF-C
Saturation comp: 0
JPEG (8-bit) Normal
Metering Mode: Multi-Pattern
Tone Comp: Auto
Sharpening: Auto
Image Size:  640 x 480
1/89.9 sec - F/3.6
Flash Sync Mode: Red Eye Reduction
Noise Reduction: OFF
Color
Exposure Comp.: 0 EV
ConverterLens: None
Sensitivity: Auto
...

The purpose of this null modem cable is to make the phone think there is a DCE device listening

It's a bit annoying that the Schematic for the development board does not match those on the board. Each pin is swapped for the wiring of the LCD. relaycable.jpg

Schematic for the AVR board does not align with the actual hardware.

So to wire a suitable cable the following mapping can be used

LCD Board 6 Pin IDC
1 Vcc
3 Out0 - PB2
5 Out1 - PB3
12 Out2 - PB4
13 Out3 - PB7
8 Gnd
  • atmel/smsrelaycontroller.txt
  • Last modified: 2012/07/09 11:45
  • by minerva9