MKL28Z what voltage level to register positive logic 1?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MKL28Z what voltage level to register positive logic 1?

983 Views
mci
Contributor III

Hello,

I've look at the MKL28Z datasheet and reference manual but I could not find a direct statement that says exactly what input voltage to GPIO will register a solid positive logic 1 to the MCU?   I'm not sure if I should just take any googled generic voltage level for Vdd = 3.3V or can I?

For positive logic:

Is 0 - 0.5V  =  logic 0?      >1.65 V = logic 1?

Please advise.

Thanks for the help.

MI

Labels (1)
8 Replies

727 Views
mci
Contributor III

Hi Javier,

No problem.

Our HW engineer will do the study by adding TDS (e.g. salt) to the water being measured, playing with different resistor values on both sides (TDS sensor & level probes interface circuit) & hopefully comes up with the right combination that will settle the maximum TDS @ 30 ppm  which will be right for the level circuit to turn on & detect water.   I already prepared the FW to be used for this study/measurement that will display TDS PPM vs. voltage combination & how it behaves at the water detect probe side, positive 1 or 0 value.

  As it is, pure dionized water is non-conductive, water will not be detected but "dirty" will be conductive.

Thanks for all your help.

MI

0 Kudos

727 Views
nxf54945
NXP Employee
NXP Employee

Dear M I,

I am glad to hear that your project goes well.

Unfortunately, I cannot help you to define the resistor values because they are linked to your custom hardware, which has specifications that I can neither test nor guarantee on my side as I do not have the same environment as you do. Sorry for the inconveniences this might cause you.

If you need any help about our products, please let us know and we will be glad to assist you.

We wish you good luck with your application.

Best regards,

Javier

0 Kudos

727 Views
mci
Contributor III

Hi Javier,

I'm well & I hope you are too.   Thanks for your information.

Just for background:

Our HW engineer took an existing TDS sensor circuit that compares the signals between 2-prong probes & we have interfaced this to an ADC-capable port-pin of MKL28Z.   2 inputs to 1 analog voltage output which becomes input to the ADC module in MKL28Z.   That's a SEPARATE interface I assigned to an ADC input pin of MKL28Z.

Another separate interface circuit for water level sensing has a simple PNP transistor circuit that is 3.3V supplied & bias resistor for transistor to turn on or off, close or open, when water is detected at the base.   The output goes to a GPIO digital input of the MKL28Z that I assigned.

Although the 2 are completely separate circuits and going into 2 separate MCU pins, the TDS Electrical Conductivity (EC) or PPM analog voltage signal IN THE WATER sets the correct voltage level as input to the PNP transistor water level sensor circuit to turn it on so water is detected.     One effects the other.

TDS polynomial is y = f(x), where y = TDS PPM & x = analog voltage & noting that Vana = Vdigi = same voltage whether analog or digital.

If there is no water, there is no TDS EC/PPM.   Water level sensor PNP transistor remains off.    No voltage or 0V at the GPIO input of the MCU so logic "0" or no water.

If there is water, depending on the TDS EC/PPM in the water (read from separate TDS circuit ADC), the water level sensor circuit PNP transistor will turn on at the right bias voltage to turn it on, to deliver a voltage signal at the GPIO pin & if that voltage is >= 2.31V, the MCU internal HW will detect that as a logic "1", water is there.

Our HW sensor ckts are set.  We just need to tweak the bias resistors in both 2 sensors given the target TDS PPM @ 30 maximum, that will ensure the level sensor PNP transistor will turn on & deliver >=2.31V on its input pin connection to the MCU.

Your comments are welcome.

Thanks for all your help.

MI

0 Kudos

727 Views
nxf54945
NXP Employee
NXP Employee

Dear M I,

I hope you are doing well.

Based on my understanding of your application, I would suggest one of the following strategies:

  • If you only need to detect the presence of water based on the solution’s electric potential, you can use a comparator (open loop OpAmp configuration) to “compare” the analog signal with a reference and generate a digital signal (false = 0 V and true = 3.3 V) that indicates if water was sensed or not. This solution is easy and practical, and it might save you clipping and clamping circuits.
  • In case you need to analyze or keep track of the solution’s electric potential, I would recommend using the ADC on its differential configuration to read the voltage between your solution and your reference. This implementation saves you external hardware and allows you to program your MCU to perform different routines depending on your readings.

I hope this information helps. Please let us know if you have any doubts or concerns and we will be glad to assist you.

 

Best regards,

Javier

0 Kudos

727 Views
mci
Contributor III

Hi again, Javier,

This is just FYI - but comments are welcome.

The water level sensor probe where I asked the question for is digital input to the MCU.   Per talk, we agreed, the voltage to trigger positive logic 1 (water is detected) should be at least 2.31V.   This the voltage to ground in the water.

However, the separate TDS sensor circuit has probes (2 in parallel) that touch the water which are inputted an OPAMP.  The OPAMP (loopback delay) does the voltage stabilization by comparing the 2 inputs and outputs 1 analog voltage level which is assigned to a configured ADC input to the MCU.

Basically, I will just have to watch / log the ADC input voltage, display that value, and at the same time, see when the digital input from the water level sensor changes from 0 to 1 (static).    Once that is achieved, then the TDS PPM/EC is derived from that ADC voltage reading just to confirm if what TDS PPM value achieved that analog/digital voltage to make digital level probe to trigger a "1".

Sorry if the above is convoluted.    We have to run these measurements because we need to set the product for only maximum PPM value that will achieve 2.31+ volts.    The tweaking/adjustments would be in either the TDS sensor feedback resistor or the water level sensor circuit PNP bias resistor or both.

Thanks again for the help.

MI

0 Kudos

727 Views
nxf54945
NXP Employee
NXP Employee

Hello M I,

 

I am glad to hear that the information came handy.

You are correct, under your application conditions logical 0 would be 0 V - 1.16 V and logical 1 would be 2.31 V - 3.3 V; however, the range in between (1.16 V - 2.31 V) is a grey zone in which we do not know nor guarantee how the pin will interpret the input. Therefore, I suggest avoiding this region in digital inputs.

You could use a high-input-impedance comparator to push your signal into valid voltage levels, or the KL28 ADC to read an analog signal and decide via software which values should be considered as true/false.

 

Best regards,

Javier

727 Views
mci
Contributor III

Hi Javier,

Thanks for this info.   I saw that also on the MKL28Z datasheet but I was not very sure that the answer because of some old post I found on this forum dated a few years ago (sorry, I lost the link to it) where someone asked a similar question & gave a similar table.  Someone else who seemed to be a hardware electrical guy pointed out to not so much rely on such multiplication factor depending on the input signal considering if the voltage signal has a variable frequency or analog.

That is the case with me because although I'm setting-up the input pin as GPIO digital line, I'm relying on the EC (electrical conductivity) of water that will touch a probe that is assigned to that pin.   Depending on the ion particles in PPM (parts per million) content of the water,  if measuring TDS (total dissolved solids),  I'm relying on what voltage across from probe tip to grounded tank would be.     I look at that as "digital" ( not "analog") voltage value so I asked that question even though I deduced it before from the table.

We are using 3.3V for Vdd of MKL28V  so these would be my values for positive logic.    Is this correct based on that datasheet specification?   The goal is to detect if water is there or not.

0V to 1.16V = logic 0 , means no water

2.31V to 3.3V = logic 1, means water is detected

(hysteresis range: 0.06xVdd)  Any values in between these voltage ranges will not cause the input to the MCU to change, from logic 0 to 1 or from logic 1 to 0.

Thanks again for the help.

MI

0 Kudos

727 Views
nxf54945
NXP Employee
NXP Employee

Hello M I,

 

I hope you are doing well.

 

The logical level ranges depend on the supply voltage you are feeding your MCU with. I found this information on Table 5 (section 2.2.1 of the MKL28Z512Vxx7 datasheet Rev. 2.1).

 

I took the liberty of summarizing it into the following table:

 

VDD Range

Logical 0

Logical 1

1.71 V ≤ VDD ≤ 2.7 V

[0.0 V, 0.30*VDD]

[0.75*VDD, VDD]

2.7 V ≤ VDD ≤ 3.6 V

[0.0 V, 0.35*VDD]

[0.7*VDD, VDD]

 

I hope this information helps. Please let me know if you have any doubts or concerns about your application and I will bre glad to assist you.

 

Best regards,

Javier