Hi all,
I would first like to congratulate the IMP team for their awesome product. This thing makes internet communication very easy.
I am trying to emulate the kaylee project (Imp+DMX) with the tinkerkit DMX shield for the arduino:
http://www.tinkerkit.com/dmx-master-shield/
(schematic): https://www.dropbox.com/s/trshtgif8bshnkd/dmx_shield_Rev4.pdf
I have changed the solder pads on the dmx shield to accept uart configuration (basically switch all 4 jump resistors to the other pads - http://www.deskontrol.net/blog/using-tinkerkit-dmx-shield-with-deskontrol-dmx-library/).
So once I changed the pads, I set the imp pin 1(tx) to the tx pin on the shield (pin 2), and imp pin 2 (rx) to rx pin on shield(pin1). At this point I do not get any DMX signal (I know because the power supply I am using will set all lights to 100% when no DMX, then drop them all to programmed levels if DMX comes through). I have tested the shield with the arduino and it works fine, so I know the shield is ok.
Here is the imp code (basically the kaylee code):
`//////////////////////////////////////
// Kaylee controlling lighting devices via DMX-512
// configure Serial UART
// dmx512 uses 8 data bits, 1 start bit, 2 stop bits, no parity bits, no flow control
//hardware.uart12.configure(250000, 8, PARITY_NONE, 2, NO_CTSRTS);
// pin 5 is a GPIO used to select between receive and transmit modes on the RS-485 translator
// externally pulled down (100k)
// set high to transmit
hardware.pin5.configure(DIGITAL_OUT);
hardware.pin5.write(1);
// build up a static 512-device DMX frame
local outBlob = blob(1024);
// populate the blob with null data
for (local i = 0; i < 512; i++) {
outBlob.writen(0x00, ‘b’);
}
function setLevel(addr, level) {
// send DMX512 command to set device at "addr"
outBlob.seek(addr);
outBlob.writen(level, ‘b’);
// enable transmitter
hardware.pin5.write(1);
// manually send out the break and mark-after-break
hardware.pin1.configure(DIGITAL_OUT);
// break
hardware.pin1.write(0);
imp.sleep(0.0001);
/*
hardware.pin1.write(1);
imp.sleep(0.00001);
*/
hardware.uart12.configure(250000, 8, PARITY_NONE, 2, NO_CTSRTS);
hardware.uart12.write(outBlob);
}
function refreshLevels() {
// manually send out the break and mark-after-break
hardware.pin1.configure(DIGITAL_OUT);
// break
hardware.pin1.write(0);
imp.sleep(0.0001);
hardware.uart12.configure(250000, 8, PARITY_NONE, 2, NO_CTSRTS);
hardware.uart12.write(outBlob);
}
function set(value) {
try {
local command = split(value, ",");
red = command[0].tointeger();
green = command[1].tointeger();
blue = command[2].tointeger();
server.log(format("red: 0x%02x green: 0x%02x blue: 0x%02x", red, green, blue));
} catch (err) {
server.error("Invalid Input");
}
setLevel(1, 0); //set these to 0 to test dmx without having to have input in planner
setLevel(2, 0);
setLevel(3, 0);
}
imp.configure(“Kaylee DMX512 Controller”,[],[]); //removed inputport
setLevel(1,0x00);
setLevel(2,0x00);
setLevel(3,0xff);
function refresh() {
//server.log(“Refreshing DMX devices”);
refreshLevels();
imp.wakeup(0.2, refresh);
}
refresh();
/////////////////////////////`
I have jumped the solder pads for DE and RE enable back to the original configuration on the DMX shield because I am not worried about receiving DMX signal right now. In fact I am not using the imp pin 5 at all since the solder pads define that it is receiving (RE-EN to GND, and DE-EN to Vcc). The shield and imp are both powered by a 5V regulated power supply, I have even tied the grounds together, but it still doesn’t work.
I guess I am wondering if the kaylee code should work, and if I am missing something. I appreciate any help anyone can give me. This should have been a simple project, however this is proving to not me.
Thanks