Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20794 Discussions

thermometer with MAX V device

Altera_Forum
Honored Contributor II
1,237 Views

Hello, 

 

I'm making a thermometer controlled by a MAX V (5M160ZE64C5) device for a student project,  

here in Belgium. 

As this is my first contact with electronics I have a lot of questions concerning the whole project. 

 

First, what sensor should I get?  

It seems that the lm35 analog temperature sensor is quite popular. But I can't find any diagram explaining how to convert the tension it measures into a binary vector the MAX V device would be able to interpret.  

 

Or is there any other digital sensor that would be more appropriate for the MAX V device? 

 

Thank you for your attention. It would save me a lot of time if I could get some help about this. 

 

Best, 

 

Boris 

 

PS: Sorry for my English.
0 Kudos
7 Replies
Altera_Forum
Honored Contributor II
505 Views

Boris, look at these digital temperature sensors from Analog Devices; 

 

http://www.analog.com/en/analog-to-digital-converters/temperature-to-digital-converters/products/index.html
0 Kudos
Altera_Forum
Honored Contributor II
505 Views

Hello gj_leeson. 

 

First thank you for your answer. After having looked at the different sensors from AD, I think that the TMP03/04 would be best suited for the job. 

 

Indeed, the idea is to build a basic thermometer which generates an alert when the temperature is too high in a greenhouse. So I just need a basic sensor. And I only have 160 LE in the chips so it seems to be hard to manage 1 or 2 wire communication busses (common case in other temperature sensors apparently). 

 

Since it would be also helpful to be able to put the sensor into water (there is an aquaponic system in the GHouse) Do you think it would be ok to waterproof it? 

 

Moreover, I'm not sure to understand the difference between TMP03 and TMP04. In the datasheet it says: 

 

"The digital output of the TMP04 is CMOS/TTL compatible, and is easily interfaced to the serial inputs of most popular microprocessors. The open-collector output of the TMP03 is capable of sinking 5 mA. The TMP03 is best suited for systems requiring isolated circuits utilizing optocouplers or isolation transformers." 

 

I don't know which one I should go for. 

Could you give me a hint about that?  

 

Best, 

 

Boris
0 Kudos
Altera_Forum
Honored Contributor II
505 Views

Hi Boris, 

 

Stick with the TMP04 and you shouldn't have any interfacing issues. Yes, it's fine to waterproof the sensor, just don't thermally insulate it too much. You presumably want it to respond to temperature changes in a reasonably quick fashion.
0 Kudos
Altera_Forum
Honored Contributor II
505 Views

Hey gj_leeson, 

 

I have been writing the VHDL file that calculates the temperature from the sensor's signal and I am facing a problem. 

 

The output of the TMP04 is a square wave which has a high period T1 and a low period T2 

The temperature is given by: 

 

t=235-(400*T1/T2) 

 

which can be rewrited as: 

 

t=235-(400*cntT1/cntT2) where cntT1 and cntT2 are the values given by two counters. 

 

While there doesn't seem to be any problem to write the code. The simple operation which consist to calculate (400*cntT1)/cntT2 seems to require too many LEs. 

 

With a clock frequency at 90kHz (as suggested in the datasheet) I already need 537 LEs just to calculate the temperature. And I only have 160 LEs in the chip. 

 

I tried to lower the clock frequency but it doesn't help much. 

 

Do you have any suggestion? 

 

Best, 

 

Boris
0 Kudos
Altera_Forum
Honored Contributor II
505 Views

The parallel divide operation is consumin too much resources. A design with a bit serial divider might fit the MAX V device.

0 Kudos
Altera_Forum
Honored Contributor II
505 Views

Boris, 

 

I confess, I didn't pay close enough attention to the TMP04. It requires that you calculate the temperature, which is where you're having problems. You should use something like the ADT7302 which has an internal A/D converter. You can then just read out the temperature in digital form, no calculation required.
0 Kudos
Altera_Forum
Honored Contributor II
505 Views

Hi gj_leeson, 

 

As you suggested I changed the TMP04 for a ADT7302. If I understand the datasheet correctly, this sensor uses a SPI-like data link. 

 

I looked on the internet for VHDL codes dealing with SPI but what I found was too big for the MAXV, so I wrote my own. 

 

I'm using one clock to trigger both the sensor and the MAXV. 

the chipselect line is set to '0' as soon as the first "rising_egde" of clk happens and is kept like this in order to get continuous 16bits temperature measures. 

 

After having tested it with testbenches, it seems to work. But I want to be sure my approach is correct. 

 

-is that right to activate the chipselect line as soon the first rising_edge of clk happens?  

-Is it ok to use one external clock for both components? 

-Is there anything important I missed concerning SPI-like data links? 

 

Best, 

 

Boris
0 Kudos
Reply