Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Connecting a AM1632 Multiplexer to CR1000


Jitesh Sep 28, 2010 11:16 AM

Good Day Everyone.

Quiet a helpful forum this is!

I'm a newbie on the site and starting working on these devices very recently.


I need to connect 30 10HS Moisture sensors to a CR1000. As you know thats impossible since it only has 16 Channels hence I want to use the AM1632 Multiplexer.

I've tried so many different modifications to my code but cant get the sensors to work of the multiplexer.


See my Code below:

******************************************************

' CR 1000

Dim LCount_4
Public Batt_Volt
Public Flag(1)
Public Panel_temp
Public TenHSmV(30)
Public VWC(30)

Units Batt_Volt=Volts

const high = true
const low = false


DataTable(Table1,True,-1)
DataInterval(0,30,Min,10)
Sample (1,Batt_Volt,FP2)
Sample (1,Panel_temp,FP2)
Average (30,TenHSmV(),FP2,False)

EndTable

'Main Program
BeginProg

Scan(30,Sec,0,0)
Battery(Batt_Volt)
PanelTemp (Panel_temp,250)
SW12 (1)
Delay (0,10,mSec)


If IfTime (0,1,min)Then flag(1)=high
If Flag(1)= high Then

PortSet(4,1)
Delay(0,150,mSec)
LCount_4=1

SubScan(0,mSec,16)

PulsePort(5,10000)

VoltSE(TenHSmV(),16,mV2500,1,1,0,_60Hz,1.0,0.0)

LCount_4=LCount_4+3

NextSubScan

For LCount_4=1 to 48

VWC(LCount_4)=2.97e-9*TenHSmV()^3-7.37e-6*TenHSmV()^2+6.69e-3*TenHSmV()-1.92

Next

PortSet(4,0)
Flag(1)= low
EndIf

SW12 (0)


CallTable(Table1)

NextScan
EndProg

***************************************************

My Wiring Diagram:

C4 of Logger to RES of AM1632
C5 of Logger to CLK of AM1632
12V of Logger to 12V of AM1632
G of Logger to GND of AM1632
Screen of Logger to Screen of AM1632(to link the grounds)


And then there is the COM ODDS and COM EVENS which confuses me:

I have:
COM ODD H to 1H of Logger
COM ODD L to 1L of Logger
COM Even H to 2H of Logger
COM Even L to C6................


(This Wiring and Program I got from CR1000 Manual)

However its still not working and I'm not sure why??

Please can someone assist me!!

Thanking you in Advance


jra Sep 28, 2010 08:46 PM

Jitesh,

I'd recommend you use ShortCut to get the basic voltage measurements working. Once you're getting good readings and you know you have things wired correctly then apply the polynomial using CRBasic.

In ShortCut first add a Device to get the AM16/32. Then add the 30 Single ended Voltage measurements.

Let us know if you run into any other problems.
Janet


ChipsNSalsa Sep 29, 2010 12:04 AM

You can actually download some sensor files for Short Cut from the Decagon web site that will add the support you're looking for, but based on your code it looks like you may already have done that. Here's some CRBasic code generated by Short Cut for 32 10HSs on an AM16/32.

'CR1000
'Created by Short Cut (2.9)

'Declare Variables and Units
Dim LCount_4
Public BattV
Public PTemp_C
Public VWC(32)

Units BattV=Volts
Units PTemp_C=Deg C

'Define Data Tables
DataTable(Table2,True,-1)
DataInterval(0,1440,Min,10)
Minimum(1,BattV,FP2,False,False)
EndTable

'Main Program
BeginProg
Scan(1,Min,1,0)
'Default Datalogger Battery Voltage measurement BattV
Battery(BattV)
'Default Wiring Panel Temperature measurement PTemp_C
PanelTemp(PTemp_C,_60Hz)
'Turn AM16/32 Multiplexer On
PortSet(2,1)
Delay(0,150,mSec)
LCount_4=1
SubScan(0,uSec,16)
'Switch to next AM16/32 Multiplexer channel
PulsePort(1,10000)
'10HS Soil Moisture Sensor measurement VWC() on the AM16/32 Multiplexer
VoltSE(VWC(LCount_4),2,mV2500,1,1,0,_60Hz,0.001,0)
LCount_4=LCount_4+2
NextSubScan
For LCount_4=1 To 32
VWC(LCount_4)=5.84e-7*VWC(LCount_4)^2-2.01e-4*VWC(LCount_4)-5.82e-2
Next
'Turn AM16/32 Multiplexer Off
PortSet(2,0)
Delay(0,150,mSec)
'Call Data Tables and Store Data
CallTable(Table2)
NextScan
EndProg

* Last updated by: ChipsNSalsa on 9/28/2010 @ 6:10 PM *


Jitesh Sep 29, 2010 06:27 AM

Hi There


Thank you for your replies and advise.
Ok the good news is that I created a program using Short cut as you said.... See below:

*******************************

'CR1000
'Created by Short Cut (2.8)

'Declare Variables and Units
Dim LCount_4
Public BattV
Public TenHsmV(30)
Public PTemp

Units BattV=Volts
Units TenHsmV=mV

'Define Data Tables
DataTable(Table1,True,-1)
DataInterval(0,60,Min,10)
Average(1,BattV,FP2,False)
Average (1,Ptemp,FP2,False)
Average (30,TenHSmV,FP2,False)


EndTable

'Main Program
BeginProg
Scan(30,Sec,1,0)
'Default Datalogger Battery Voltage measurement BattV
Battery(BattV)
PanelTemp (PTemp,250)

'Turn AM16/32 Multiplexer On
PortSet(1,1)
Delay(0,150,mSec)
LCount_4=1
SubScan(0,uSec,10)
'Switch to next AM16/32 Multiplexer channel
PulsePort(2,10000)
'Generic Single Ended Voltage measurements TenHsmV() on the AM16/32 Multiplexer:
VoltSE(TenHsmV(LCount_4),3,mV2500,1,True,0,_60Hz,1,0)
LCount_4=LCount_4+3
NextSubScan
'Turn AM16/32 Multiplexer Off
PortSet(1,0)
Delay(0,150,mSec)
'Call Data Tables and Store Data
CallTable(Table1)
NextScan
EndProg


****************************************

It is working fine and I am getting the expected results on each channel.

My Wiring:

C1 to RES
C2 to CLK

ODD H to GND
ODD L to 1H
EVEN H to 1L
EVEN L to 2H


**********

Now my problem...I have calibrated all 30 sensors and have different polynomials for each one... How do I put that in my code....


These are my polynomials:


GWC1 = (TenHSmV1*0.0592)-27.425
GWC2 = (TenHSmV2*0.0987)-48.264
GWC3 = (TenHSmV3*0.0423)-17.694
GWC4 = (TenHSmV4*0.0663)-31.632
GWC5 = (TenHSmV5*0.0735)-35.853
GWC6 = (TenHSmV6*0.0781)-37.692
GWC7 = (TenHSmV7*0.059)-27.839
GWC8 = (TenHSmV8*0.0768)-38.695
GWC9 = (TenHSmV9*0.0997)-52.76
GWC10 = (TenHSmV10*0.0597)-27.74
GWC11 = (TenHSmV11*0.0824)-41.291
GWC12 = (TenHSmV12*0.057)-26.514
GWC13 = (TenHSmV13*0.067)-32.041
GWC14 = (TenHSmV14*0.0788)-39.521
GWC15 = (TenHSmV15*0.0812)-40.253
GWC16 = (TenHSmV16*0.0765)-37.321
GWC17 = (TenHSmV17*0.091)-45.561
GWC18 = (TenHSmV18*0.0627)-29.723
GWC19 = (TenHSmV19*0.0642)-31.286
GWC20 = (TenHSmV20*0.0769)-37.582
GWC21 = (TenHSmV21*0.0555)-25.279
GWC22 = (TenHSmV22*0.0476)-21.214
GWC23 = (TenHSmV23*0.0942)-45.072
GWC24 = (TenHSmV24*0.0992)-48.8
GWC25 = (TenHSmV25*0.1146)-57.415
GWC26 = (TenHSmV26*0.0879)-43.047
GWC27 = (TenHSmV27*0.1098)-53.188
GWC28 = (TenHSmV28*0.0835)-39.961
GWC29 = (TenHSmV29*0.0904)-43.773
GWC30 = (TenHSmV30*0.0815)-39.281


Thanks


jra Sep 29, 2010 03:52 PM

In CRBasic, declare a new public variable array:
public GWC(30)

Then enter your expressions just as you have them except put parenthesis around the number at the end of GWC and TenHSmV.
Change this: GWC1 = (TenHSmV1*0.0592)-27.425
to: GWC(1) = (TenHSmV(1)*0.0592)-27.425

You could also do something similar in ShortCut, under Calculations & Control | Calculations | User Entered. But it is a little cleaner in CRBasic. In ShortCut you don't declare the variables ahead of time. Your 'user entered expressions' would look like this, parenthesis just around the TenHSmV numbers:
GWC1 = (TenHSmV(1)*0.0592)-27.425

Let us know if you have other questions.
Janet


Jitesh Sep 30, 2010 06:52 AM

Hi,

Thank you so much for that piece of info, tried it and it works perfectly..

I've got only one more question but before that please see my code below and let me know if there are any errors. ( I dont think so though)

********************************************

'Declare Variables and Units
Dim LCount_4
Public BattV
Public TenHsmV(30)
Public PTemp
Public GWC(30)

Units BattV=Volts
Units TenHsmV=mV

'Define Data Tables
DataTable(Table1,True,-1)
DataInterval(0,60,Min,10)
Average(1,BattV,FP2,False)
Average (1,Ptemp,FP2,False)
Average (30,TenHSmV,FP2,False)
Average (30,GWC,FP2,False)

EndTable

'Main Program
BeginProg
Scan(30,Sec,1,0)
'Default Datalogger Battery Voltage measurement BattV
Battery(BattV)
PanelTemp (PTemp,250)

'Turn AM16/32 Multiplexer On
PortSet(1,1)
Delay(0,150,mSec)
LCount_4=1
SubScan(0,uSec,10)
'Switch to next AM16/32 Multiplexer channel
PulsePort(2,10000)
'Generic Single Ended Voltage measurements TenHsmV() on the AM16/32 Multiplexer:
VoltSE(TenHsmV(LCount_4),3,mV2500,1,True,0,_60Hz,1,0)
LCount_4=LCount_4+3
NextSubScan
For LCount_4=1 To 30

GWC(1) = (TenHsmV(1)*0.0592)-27.425
GWC(2) = (TenHsmV(2)*0.0987)-48.264
GWC(3) = (TenHsmV(3)*0.0423)-17.694
GWC(4) = (TenHsmV(4)*0.0663)-31.632
GWC(5) = (TenHsmV(5)*0.0735)-35.853
GWC(6) = (TenHsmV(6)*0.0781)-37.692
GWC(7) = (TenHsmV(7)*0.059)-27.839
GWC(8) = (TenHsmV(8)*0.0768)-38.695
GWC(9) = (TenHsmV(9)*0.0997)-52.76
GWC(10) = (TenHsmV(10)*0.0597)-27.74
GWC(11) = (TenHsmV(11)*0.0824)-41.291
GWC(12) = (TenHsmV(12)*0.057)-26.514
GWC(13) = (TenHsmV(13)*0.067)-32.041
GWC(14) = (TenHsmV(14)*0.0788)-39.521
GWC(15) = (TenHsmV(15)*0.0812)-40.253
GWC(16) = (TenHsmV(16)*0.0765)-37.321
GWC(17) = (TenHSmV(17)*0.091)-45.561
GWC(18) = (TenHSmV(18)*0.0627)-29.723
GWC(19) = (TenHSmV(19)*0.0642)-31.286
GWC(20) = (TenHSmV(20)*0.0769)-37.582
GWC(21) = (TenHSmV(21)*0.0555)-25.279
GWC(22) = (TenHSmV(22)*0.0476)-21.214
GWC(23) = (TenHSmV(23)*0.0942)-45.072
GWC(24) = (TenHSmV(24)*0.0992)-48.8
GWC(25) = (TenHSmV(25)*0.1146)-57.415
GWC(26) = (TenHSmV(26)*0.0879)-43.047
GWC(27) = (TenHSmV(27)*0.1098)-53.188
GWC(28) = (TenHSmV(28)*0.0835)-39.961
GWC(29) = (TenHSmV(29)*0.0904)-43.773
GWC(30) = (TenHSmV(30)*0.0815)-39.281

Next
'Turn AM16/32 Multiplexer Off
PortSet(1,0)
Delay(0,150,mSec)
'Call Data Tables and Store Data
CallTable(Table1)
NextScan
EndProg

****************************************

Ok now my last question.
When I was creating my code in Short Cut, I added AM1632 as my Device and then when I selected Single Ended Voltage Sensors, I got a prompt asking " How many single ended voltage sensors do you want to add (There is room for 48 Adjacent Channels)"

My Question, why is there only room for 48 Sensors. Shouldnt it be 64 as 16 x 4 = 64.

I also noticed when I was wiring that depending on how you configure the COM EVEN and ODD, the channels are not all adjacent to each other.

For Example:
Sensor 1 - 1L (Multiplexer)
Sensor 2 - 2H
Sensor 3 - 2L
Sensor 4 - 3L
Sensor 5 - 4H


What happend to 1H, 3H, 5H, ...... etc. If you do connect a sensor to those channels, you dont get any reading, I also noticed it missed all the High odd numbers and I assume it has to do with the COM Ports.

I have it as:

COM ODD H - GND
COM ODD L - 1H
COM EVEN H - 1L
COM EVEN L - 2H

Does this make sense and is it meant to work like that!

Looking forward to your response!


jra Sep 30, 2010 03:19 PM

In your code you do not need the for/next loop around your calculations.

why is there only room for 48 Sensors.
Each of your SE sensors has 3 wires, Signal, Ground and Shield. The shields can share a terminal on the AM16/32. The Grounds can also share, they go into an ODD H. The Signals each go into an ODD L or EVEN H. Sketching things out that gives you 48 sensors.

What happend to 1H, 3H, 5H, ...... etc.
Those are COM ODD H - GND
So, your sensor Grounds should be going to those channels.

Hope that helps.
Janet


ChipsNSalsa Sep 30, 2010 04:28 PM

Removed.

* Last updated by: ChipsNSalsa on 9/30/2010 @ 12:17 PM *


ChipsNSalsa Sep 30, 2010 04:57 PM

Removed.

* Last updated by: ChipsNSalsa on 9/30/2010 @ 12:18 PM *


ChipsNSalsa Sep 30, 2010 06:16 PM

I just took a quick look at the 10HS manual (http://www.decagon.com/assets/Manuals/10HSv2.pdf) and it looks like they can in fact be powered with 3 to 15 volts. Given that, I'm not sure why Decagon wanted the Short Cut support the way they did. If you had the white wire from all 30 of them attached to the switched 12 volt terminal of the datalogger you could power them up, measure four on each mux set, and power them down. Assuming your equation takes the raw millivolt reading and calculates volumetric water content from it, the program would look like this:

'CR1000

'Declare Variables and Units
Dim LCount
Public BattV
Public GWC(30)
Public a(30)={0.0592,0.0987,0.0423,0.0663,0.0735,0.0781,0.059,0.0768,0.0997,0.0597,
0.0824,0.057,0.067,0.0788,0.0812,0.0765,0.091,0.0627,0.0642,0.0769,
0.0555,0.0476,0.0942,0.0992,0.1146,0.0879,0.1098,0.0835,0.0904,0.0815}
Public b(30)={27.425,48.264,17.694,31.632,35.853,37.692,27.839,38.695,52.76,27.74,
41.291,26.514,32.041,39.521,40.253,37.321,45.561,29.723,31.286,37.582,
25.279,21.214,45.072,48.8,57.415,43.047,53.188,39.961,43.773,39.281}

Units BattV=Volts
Units GWC=fractional percent

'Define Data Tables
DataTable(Table2,True,-1)
DataInterval(0,1440,Min,10)
Minimum(1,BattV,FP2,False,False)
EndTable

'Main Program
BeginProg
Scan(1,Min,1,0)
'Datalogger Battery Voltage measurement BattV
Battery(BattV)
'Power up the 10HSs
PortSet(9,1)
'Turn AM16/32 Multiplexer On
PortSet(2,1)
Delay(0,150,mSec)
LCount=1
'Measure the first 28 10HSs
SubScan(0,uSec,7)
'Switch to next AM16/32 Multiplexer channel
PulsePort(1,10000)
'Measure 4 10HSs at a time
VoltSe(GWC(LCount),4,mV2500,1,1,0,_60Hz,1,0)
LCount=LCount+4
NextSubScan
'Switch to next AM16/32 Multiplexer channel
PulsePort(1,10000)
'Measure the last 2 10HSs
VoltSe(GWC(LCount),2,mV2500,1,1,0,_60Hz,1,0)
'Turn AM16/32 Multiplexer Off
PortSet(2,0)
'Power down the 10HS sensors
PortSet(9,0)
'Calculate GWC
For LCount=1 To 30
GWC(LCount)=(GWC(LCount)*a(LCount))-b(LCount)
Next
'Call Data Tables and Store Data
CallTable(Table2)
NextScan
EndProg

The wiring would look like this:

-Wiring for CR1000-
AM16/32 Multiplexer (4x16 mode)
1H: COM ODD H
1L: COM ODD L
Ground: COM Ground
2H: COM EVEN H
2L: COM EVEN L
C2: RES
C1: CLK
G: GND
12V: 12V

-Wiring for AM16/32 Multiplexer (4x16 mode)-

10HS Soil Moisture Sensor (1)
1H: Red
Ground: Bare
CR1000 SW-12: White

10HS Soil Moisture Sensor (2)
1L: Red
Ground: Bare
CR1000 SW-12: White

10HS Soil Moisture Sensor (3)
2H: Red
Ground: Bare
CR1000 SW-12: White

10HS Soil Moisture Sensor (4)
2L: Red
Ground: Bare
CR1000 SW-12: White

and so on for the other 26 10HSs on subsequent mux sets.

* Last updated by: ChipsNSalsa on 9/30/2010 @ 2:40 PM *


Jitesh Oct 7, 2010 08:46 AM

Hi There

Thank you for all your assistance regarding the multiplexer.
I have it connected on the fields now and it is working perfectly!.

Couldnt have done it with your help..

Thanks Guys!

Log in or register to post/reply in the forum.