# DAISY-4 - One channel relay board

<div class="text-success lead">
The DAISY-4 module allows Terra and FOX G20 boards to control larger loads and devices like AC or DC Motors, electromagnets, solenoids, and incandescent light bulbs.
</div>

@include='daisy_eol'

<img src="./DAISY-4.jpg" width="320px"/ >

##Wirings

Up to 8 Daisy-4 modules can be wired using an unique flat cable. In that case you can make  the flat cable with more IDC sockets by yourself.

This is the usable connectors where to plug this board using the factory default Linux image:

| FOX | Terra | Notes           |
|-----|-------|-----------------|
| D2  | D11   | Up to 8 modules |
| D5  | D12   | Up to 8 modules |


On the FOX Board G20 is requested a [Daisy-1](/DAISY-1) adapter to wire this boards.

## On-field wirings

This is a very simple example of how to wire an external load to the Daisy-4 module.

<img src="./daisy4wiring.jpg"/>

## Dip-switch set up

A dip switch enables you to select on which GPIO line the relay will be drives. 

<img src="./daisy-4-dip.jpg">

Usually only one DIP must be placed "ON".   

## Code example in Python

The following code examples illustrate how to manage the Daisy-4 module
in Python. They work with a Daisy-11 module plugged on D5 connector 
and the dip switch 1 moved to the "ON" position.

Turn ON a Relay

* @pg='python/daisy4/relayon.py' 

Turn OFF a Relay

* @pg='python/daisy4/relayoff.py'

To launch it install the code playground directory following this article: @article='playground' then move into playground directory:

<pre class="minicom">
debarm:~/playground/python/daisy4# python relayon.py
debarm:~/playground/python/daisy4# python relayoff.py
</pre>

The main part of this code is the class <b>Daisy4()</b> that gets as parameter
the Daisy connector (i.e. D2, D5, etc) and the dip switch in ON position 
(DIP1, DIP2 .. DIP8).

<pre class="prettyprint">
myrelay = daisy.Daisy4('D5','DIP1')
myrelay.on()
myrelay.off()
</pre>


<div class="alert">
The relay mounted on this board can control external devices that work at ~120 VAC or ~220 VAC. 
<br/>
<br/>
This is considered <b>HIGH VOLTAGE</b>, which as many know, can be lethal so NEVER work on this 
when it is plugged in. Make sure all connections are how they should be, and verify that they 
are fully insulated and won't short each other out, or you could cause a fire. 
<br/>
<br/>
Also, be aware of what is going on around you, be alert, and never 
work on with high voltage if you feel you can't devote enough concentration to what you are doing. 
And lastly, if you ever have to service the connections inside this device, ALWAYS unplug it before doing so.
<br/>
<br/>
Acme Systems is not responsible for any electric hazard or damage caused by using this module.
</div>

##Schematic

* [Schematic in pdf format](/download/schematics/schematic_daisy4.pdf)
