LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FPGA + multiple temp sensors

Hey everyone

 

Currently for my summer internship project I am developing a software for measuring temperature from multiple sensors. I am using sbRio from the evaluation kit and the sensors DS18B20+.

 

As for now, almost everything is finished. The program is cut into 3 parts:

1 . FPGA - where all communication with the sensor is done, reading ROM number, matching the ROM and of course, taking the data needed in RT (conversion to celsius degrees)

2. Real Time - Here I am doing all the stuff connected with taking the data from FPGA and translating it into Celsius degrees. There are ofc queues and stream networks to communicate in the vi and to the UI.vi

3. UI - sends commands to RT, receives data from RT and shows it on the screen.

 

The problem is that with 3 sensors all process is taking very long time (around 1-1,5seconds). The reason can be the way I'm measuring temperature from all sensors at once. In the RT  I'm matching all ID's that I store in the configuration file, and with Match ROM command I'm doing the loop as many times as I have sensors. So if I have 2 sensors, I take the first index (ID + name), check it's presence and match rom with that, then the second.. etc.  I know this process is not optimal, but I wasn't able to figure anything better.

 

Currently I am looking for any ways to improve the code, because the time that it takes is not satisfying for me at all. I tried to measure temp from all sensors at once in different way, but it didn't work out. 

 

Have u got any ideas how can I improve this? And also  - what kind of way of saving data to files would you recommend?

 

If pictures will be needed (or code), I can post them tomorrow when I will be at work.

 

 I know that this is not so complicated project at all but almost everything was kinda new for me 😉

 

 

0 Kudos
Message 1 of 6
(3,328 Views)

First off- why complicate such a simple project with FPGA? It doesn't add anything in this instance- usually you use FPGA where you need the speed or deterministic performance.

 

You haven't provided any code, which makes it difficult to answer the question. If all the sensors are on the same bus, then obviously trying to measure from them all at once will cause problems, so interrogate them sequentially. If they're on separate buses, no problem. Remove anything from the main loop you can- so only retrieve the IDs once at the start, not every time you want to read a temperature. It may be a limitation of the bus or the sensors- what do the specs say?

0 Kudos
Message 2 of 6
(3,307 Views)

I guees that they wanted me to just see how all the FPGA works. Cause like I said, It's all new for me. That's probably why they wanted me to use FPGA.

 

The sensors are on the same bus. I will try to post my code tomorrow when I will get back to the place. I will also look at the specs of devices.

0 Kudos
Message 3 of 6
(3,276 Views)

Delete this post

0 Kudos
Message 4 of 6
(3,198 Views)

So here's my code.

 

I moved the values that I read at the beginning outside the main loop in RT like you suggested. I also did change a bit of the code because before I could Pause it, change it, read ROM etc. But I decided it is not necessary. Still, I can't get faster than 1 second with only 2 sensors.

0 Kudos
Message 5 of 6
(3,180 Views)

Dear niwgnip.

 

I have some suggestions which can improve your program. You said that you wanted to perform all measurements at once. Have you tried to make parallel measurements in FPGA module? Additionally, you should consider some changes in your Real-Time VI.

First, you should connect error wire of “Create Network Stream” in Temperature Value loop.

Second, please change all tunnels of error wires to shift registers.

Next, there is no need for Wait until next ms Multiple in your Action Loop. This VI should be used for synchronization of activates. In this case your queue is controlling the execution of the loops.

You should reconsider a change the order of the loops. Right now you cannot predict the execution order. You should control the flow using error wires. If you connect “Action Loop” with “FPGA monitor“ by the error wire you will control the flow and there will be no need for using Locals Variable (you should avoid using them if it is possible). Please reconsider also creating one loop instead FPGA monitor loop and Temperature Value. 

Additionally, you should avoid putting any controls on the front panel of the Real-Time and FPGA VIs, try to control whole process using only UI.

Next time, if it is possible can you add the project file as well?

 

Best Regards,

JedP

Applications Engineer
National Instruments
0 Kudos
Message 6 of 6
(3,034 Views)