Author Topic: imR1 Relay Module control (via Web Page and HTTP GET) using a PT66EI and SBC66EC  (Read 1943 times)

dennis_h

  • Newbie
  • *
  • Posts: 3
    • View Profile
Relay Module installed in the iMOD1 port is controlled on X8 Port.
Set ox8 to digital output > http://"IP address of SBC"?cx8=od
Send On ( value =1) http://"IP address of SBC"?ox8=1
Send Off ( value =0) http://"IP address of SBC"?ox8=0

I noticed that setting the digital output automatically sets the port to High.
Sending  http://"IP address of SBC"?cx8=od&x8=0 resolves that problem.

This works with Version 2.03(beta) firmware. I had some problems with earlier versions not being able to make any ports go high.
« Last Edit: January 15, 2014, 03:36:30 PM by modtro2 »

modtro2

  • Administrator
  • Hero Member
  • *****
  • Posts: 564
    • View Profile
Re: imR1 Relay Module control using a PT66EI and SBC66EC
« Reply #1 on: January 15, 2014, 03:34:23 PM »
Hello Dennis

Versions prior to V2.03 Beta didn't support commands via HTTP POST and HTTP GET. The new V2.03 should get officially released in the coming days (still in Beta stage).

For information, you mentioned in a previous email that you have a PT66EI with an im1R 1 Relay iMod module mounted in iMod port 1 of the PT66EI. As shown in these pictures.


For using HTTP GET commands to control this relay, you currently have to get the SBC66 Port connected to the relay, and then use the commands as you gave in your post. This is quite simple for the PT66EI, seeing that the SBC66 Port is clearly marked on the PT66EI, and the iMod port used for the relay is marked on the im1R iMod module.

Regarding the digital output that is automatically set, when configuring a port for the first time, it is a good idea first writing the initial value you want it to have, and then configuring it as an output:
Code: [Select]
http://"IP address of SBC"?x8=0&cx8=od
This will first set X8 to 0, and then configure it as an output.

When writing the firmware in C, the new V2.03 includes code for supporting the PT66EI, PT66ECI and PT66DIN6 prototype boards with iMod modules. All you have to do is include some defines in your code, and all iMod ports are available via define functions. You don't have to try and map what Netcruzer port (X6, X8...) is mapped to what iMod port.

To configure an iMod port pin as an input or output, the ConfDirPin functions are provided. For example:
imod1_ConfDirPin3(INPUT_PIN);        //Configure iMod port 1, pin 3 as an output
imod2_ConfDirPin2(OUTPUT_PIN);    //Configure iMod port 2, pin 2 is an output

To write or read to/from an iMod port pin, the WritePin and ReadPin functions are provided. For example:
imod1_ReadPin2();        //Read iMod port 1 pin 2
imod2_WritePin5(1);    //Set iMod port 2 pin 5

To enable or disable pull-up and pull-down resistors on iMod port pins, the ConfPullupPin and ConfPulldownPin functions are provided. For example:
imod2_ConfPulldownPin2(0);    //Disable pull-down resistors on iMod 2 pin 2
imod1_ConfPullupPin4(1);        //Enable pull-up resistors on iMod 1 pin 4

There is an example project for the PT66DIN6:
http://www.netcruzer.com/nz/v203/doc/html/pt66din6_debug_demo_2main_8c-example.html

modtro2

  • Administrator
  • Hero Member
  • *****
  • Posts: 564
    • View Profile
Hi Dennis

For a future version of firmware, will be introducing new Webserver Commands for configuring, reading and writing to iMod port.

The "ci[0-9]p[0-9]=cfgVal" command will configure an iMod port. For example, to configure iMod 1, port 2 as an Digital Output:
ci1p2=od

The "oi[0-9]p[0-9]=[0,n]" command will write to an iMod port. For example to write 1 to iMod 2, Port 4 (sets it to 3.3V):
oi2p4=1