Reading Temperature with Nur API –> Nordic UHF readers

Forums Forums General Discussions Reading Temperature with Nur API –> Nordic UHF readers

This topic contains 2 replies, has 2 voices, and was last updated by  t 6 months, 1 week ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1424

    t
    Community Member
    • ★★★★

    Im working on developing app in java, where the Nordic UHF with NUR API scanner is used to fetch the temperature readings from Sensor temperature Dog Bone with RFMicron Magnus®S3 IC on it.

    Im accessing , memory location but i dont think those values making any sense.Can you please help me or point me to any code snippet for achieving correct values with Temp Sensor Dogbone+Nordic UHF Scanner with NUR API..

    Thanks

    0
    #1425

    Greg Pitner
    RFMicron Team Member
    • ★★★★

    Hello,

    Below is C# code to read temperature using the Nur API, assuming the reader is a handheld model. Java is probably fairly similar, although I don’t have much experience with it. If you need more specific help, I recommend contacting tech support directly.

    Greg

    =================

    using System;
    using System.Linq;
    using System.Collections.Generic;
    using System.Text;
    using NurApiDotNet;
    using NordicId;
    namespace SimpleNordic
    {
    class Program
    {
    static void Main(string[] args)
    {
    NurApi hApi = new NurApi();
    hApi.ConnectIntegratedReader(); // Connect to internal reader module
    hApi.Region = NurApi.REGIONID_FCC; // Set frequency band to FCC (North American region)
    hApi.TxLevel = 5; // Set power level; 0=max, 19=min
    // Build a Select command using the CustomExchange method to activate the Magnus-3 temperature engine.
    // This approach makes it possible to insert a pause in between the transmission of the Select commmand
    // and the rest of the inventory round — increasing the accuracy of the temperature measurement.
    NurApi.CustomExchangeParams TempSelect = new NurApi.CustomExchangeParams();
    TempSelect.bitBuffer = new byte[NurApi.MAX_BITSTR_BITS / 8];
    int txLen = 0;
    txLen = NurApi.BitBufferAddValue(TempSelect.bitBuffer, 0xA, 4, txLen); // Command, Select (1010)
    txLen = NurApi.BitBufferAddValue(TempSelect.bitBuffer, 0x0, 3, txLen); // Target, S0 (000)
    txLen = NurApi.BitBufferAddValue(TempSelect.bitBuffer, 0x1, 3, txLen); // Action, matching assert SL (001)
    txLen = NurApi.BitBufferAddValue(TempSelect.bitBuffer, 0x3, 2, txLen); // MemBank, User (11)
    txLen = NurApi.BitBufferAddEBV32(TempSelect.bitBuffer, 0xE0, txLen); // Pointer, 0xE0
    txLen = NurApi.BitBufferAddValue(TempSelect.bitBuffer, 0x0, 8, txLen); // Length, 0 bits
    txLen = NurApi.BitBufferAddValue(TempSelect.bitBuffer, 0x0, 1, txLen); // Truncate, disable
    TempSelect.txLen = (ushort)txLen;
    TempSelect.asWrite = 1; TempSelect.txOnly = 1; TempSelect.noTxCRC = 0;
    TempSelect.rxLen = 0; TempSelect.rxTimeout = 20; TempSelect.appendHandle = 0;
    TempSelect.xorRN16 = 0; TempSelect.noRxCRC = 0; TempSelect.rxLenUnknown = 0;
    TempSelect.txCRC5 = 0; TempSelect.rxStripHandle = 0;

    NurApi.InventoryExParams InventoryParams = new NurApi.InventoryExParams();
    InventoryParams.inventorySelState = 0; // These definitions set RFID inventory parameters
    InventoryParams.inventoryTarget = 0;
    InventoryParams.Q = 0;
    InventoryParams.rounds = 5;
    InventoryParams.session = NurApi.SESSION_S0;
    NurApi.TagStorage tagStorage = new NurApi.TagStorage();
    hApi.InventoryRead(true, NurApi.NUR_IR_EPCDATA, NurApi.BANK_PASSWD, 0xE, 1); // Give location of temp code
    for (int cycle = 1; cycle <= 20; cycle++)
    {
    try
    {
    hApi.Inventory(1, 1, 0); // Run a pre-inventory to force a frequency hop
    hApi.ClearTagsEx();
    hApi.SetExtendedCarrier(true); // Turn on continuous wave (CW)
    hApi.CustomExchange(0, false, TempSelect); // Transmit Select command
    System.Threading.Thread.Sleep(3); // Pause for 3 ms while sending CW
    Console.WriteLine(“Read attempt ” + cycle);
    hApi.InventoryEx(ref InventoryParams, new NurApi.InventoryExFilter[0]); // Read tags
    tagStorage = hApi.FetchTags(true); // Get read results from buffer
    for (int i = 0; i < tagStorage.Count; i++)
    {
    Console.WriteLine(“EPC: ” + tagStorage[i].GetEpcString().ToUpper());
    int temperatureCode = (int)tagStorage[i].irData[0] * 256 + (int)tagStorage[i].irData[1];
    if (temperatureCode > 1000 && temperatureCode < 3500) // Use plausible values only
    Console.WriteLine(” Temperature Code: ” + temperatureCode);
    }
    }
    catch { }
    hApi.SetExtendedCarrier(false);
    hApi.ClearTagsEx(); // Clear contents of tag result buffer
    }
    hApi.Disconnect();
    Console.ReadLine();
    }
    }
    }

    0
    #1426

    t
    Community Member
    • ★★★★

    That helps, Thanks alot Greg!.

     

    0
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

Axzon (formerly RFMicron)

3700 N. Capital of Texas Hwy
Suite 570
Austin, TX 78746
Tel: (512) 535-4647
Axzon.com