# 4 Channel Switcher / LED stripe controller, Interplay Medium™ dendrite module (for ESP8266)

This is IM denrite module (remote wifi network device) created for [Interplay Medium™](https://interplaymedium.org) project.

![Interplay Medium 4 Channel Switcher Dendrite](https://repository.interplaymedium.org/4_Channel_Switcher/IMG_2191.jpg)

## Pinouts 

![ESP8266 Pinout](https://repository.interplaymedium.org/RGBW%20Controller/esppinout_.png)
![ESP8266 Programming](https://repository.interplaymedium.org/RGBW%20Controller/usbprogram_.png)

For SSR be sure to add MOSFETs and maybe current limiting resistors appropriately. Complete wiring scheme will be added later. 

## Bidirectional MOSFET level shifter

To drive an addressable RGB strip along with ESP8266, you need to synchronize logical levels. 
I usually use a simple MOSFET solution for single-channel shifting, hovever for multi-channel management, I would recommend using a simple Logic Gate IC like 74HC08 (like in my HW design) or a level shifter such as TXB0104.

![Bidirectional MOSFET level shifter](https://repository.interplaymedium.org/Serial_RGB/bidirectonal-mosfet-level-shifter.png)

## Preparing the building environment

Make sure that you have the environment installed as described at

1. [makeEspArduino.mk](https://github.com/plerup/makeEspArduino.git)
2. [esp8266 Arduino SDK](https://github.com/esp8266/Arduino)

3. In the *make* script, change path for each variable approprately: 
    MAKE_FILE=....
    ESP_SDK_ROOT=....

## Change your IM AXOD microserver or AP (router) WIFI login and password

create the file 
    vim ../info

assign SSID and PASSWORD of your local IM AXOD microserver or Access Point in there

    WIFI_SSID="ssid"
    WIFI_PASS="ssid password"

You can change it later whenewer you want using HTTP interface

## Building 

initial building and flashing firmware at once 
 
    ./make 4_Channel_Switcher upload

after that you can build the binary and uload it using remote HTTP interface

    ./make 4_Channel_Switcher  
    curl im_switch_MACLAST4DIGITS/update -F image=@4_Channel_Switcher.bin

## Usage 

By default dendrite unit can be reached on "`im_switch_[last 4 digits of MAC address]`" 

Change the name of unit by

    curl im_switch_[last 4 digits of MAC address]?host=NEWNAME

Turn on each even switches 

    curl im_switch_[last 4 digits of MAC address]?switch=0101

Other options

    curl im_switch_MACLAST4DIGITS/help

## Todo 

The development of this firmware is in progress. Here is a brief list of upcoming changes: 

* add interface features (save, reset....)
* state return in 2 variants  
    txt (default)  
    JSON  
    http UI  
* add commands  
    dimm and soft state changing  
    rgbwdef -- save default values in EEPROM, which is returning on reset command  
  
* switching AP/slave, AP by defuault
    remote access setup (host name, AP/slave, SSID, passw)  
    save in EEPROM  

## License

Copyright © 2016 Dmitry Shalnov [interplaymedium.org]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this files except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.


