How do I use a JN5169 ZigBee to return temperature?

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I use a JN5169 ZigBee to return temperature?

1,354 Views
msuhaibs
Contributor II

Hello,

I am currently attempting to create a system whereby I can use a ZigBEE JN5169 Microcontroller to return temperature, using its built-in temperature measuring capabilities.

I need the temperature readings to then be sent to a raspberry pi which has a JN5169 USB Dongle for ZigBee attached to it. The Information should then be able to be viewed on the raspberry pi.

 

What I have done so far:

  • The Chip is currently attached to a DR1048 Sensor Board which is connected to my PC via USB. I have already run a “light sensor” bin file (demo provided by hive) on the devices flash memory and it does print values in Hexa Decimal to the NXP Beyond Studio IDE.
  • I have a Raspberry Pi 3 with the USB Dongle attached to it.

 

Can someone tell me where I can find the relevant information to form the connection between the JN5169 microcontroller and the raspberry pi (USB Dongle)?

Also, how would I go about writing the code (in C I believe) for returning the temperature?

Many Thanks,    

7 Replies

862 Views
msuhaibs
Contributor II

Hi Alexis, 

I went through the JN-AN-1220 documentation, ZigBee 3.0 Sensors, documentation, and I did'nt find anything sugesting as to why the .bin file is printing said infomration instead of temperature...

I belive my problem of right now is that of interepreting the output, rather than reciving the information in time intervals.

 

What does the output I am reciving in the IDE terminal mean?

Thanks,

0 Kudos

862 Views
nguyenanhgiau10
Contributor IV

HI Suhaib,

All information for debugging, you can find in Makefile. E.g:

 TRACE ?=0
ifeq ($(TRACE), 1)
#CFLAGS += -DDBG_ENABLE
#CFLAGS += -DDEBUG_921600
#CFLAGS += -DDEBUG_EZMODE
#CFLAGS += -DDEBUG_ZCL
#CFLAGS += -DDEBUG_CLD_ONOFF
#CFLAGS += -DDEBUG_APP_BUTTON
#CFLAGS += -DDEBUG_APP_OTA
#CFLAGS += -DDEBUG_START_UP
CFLAGS += -DDEBUG_SENSOR_NODE
#CFLAGS += -DDEBUG_SENSOR_TASK
#CFLAGS += -DDEBUG_SCAN
#CFLAGS += -DDEBUG_JOIN
CFLAGS += -DDEBUG_COMMISSION
#CFLAGS += -DDEBUG_SENSOR_STATE
CFLAGS += -DDEBUG_SLEEP_HANDLER
#CFLAGS += -DDEBUG_LIGHT_SENSOR
#CFLAGS += -DDEBUG_POLL_HANDLER
#CFLAGS += -DDEBUG_PROCESS_BUTTONS
#CFLAGS += -DDEBUG_ZCL_PROCESSING
#CFLAGS += -DDEBUG_REPORT
#CFLAGS += -DDEBUG_NWK_EVENT_HANDLER
#CFLAGS += -DDEBUG_APP_NTAG
#CFLAGS += -DDEBUG_APP_ICODE
#CFLAGS += -DDEBUG_EVENT_HANDLER
CFLAGS += -DDEBUG_BDB
#CFLAGS += -DTRACE_OTA_DEBUG
#CFLAGS += -DDEBUG_BLINK_LED
endif

Uncomment to enable and otherwise.

0 Kudos

862 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Dear Suhaib,

Please check in the App_LightTemperatureOcupancySensor.c the following function:

pastedImage_1.png

There you can find the temperature, check if your code enter this function. Also you'll need to add the following lines to the makefile:

CFLAGS += -DDEBUG_LIGHT_TEMP_OCC_SENSOR
APPSRC += App_LightTemperatureOccupancySensor.c ‍‍

This to enable this print in the debug console. 

The message you mention is only the MCU status. In this case the handler is from the sleep mode. The MCU only is going to sleep at time intervals.

But I don't think that you're sending any message to your coordinator yet. Please check in the JN-AN-1220-ZigBee-3-0-Sensors the finding and binding section, after binding the nodes, the temperature will be reported to the node at a certain interval. After that you will need to locate where the package is received in the control bridge example.

You'll need to download the JN-AN-1216, this project is the control bridge. There, after you bind the coordinator and the end device you'll start receiving the messages in the coordinator console.

I hope this helps you.

Best Regards,

Alexis Andalon

0 Kudos

862 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Hi Suhaib,

To answer your first question, the USB dongle opens a VirtualCOM port in the host device. So you only need that the raspberry Pi recognize this kind of device and a serial terminal.

Also of how to implement the temperature measurement, please check the JN_AN1220 and check the 

LightTemperatureOccupancySensor, this has an endpoint with temperature measurement, you can base your application in this project. ZigBee 3.0 | NXP 

Best Regards,

Alexis Andalon

862 Views
msuhaibs
Contributor II

Thank you for your reply Alexis.

 

I have understood your comment on forming the connection between the chip and the Pi.

 

I have gone ahead and download the JN-AN-1220 file and saved the file:

 

"LightTemperatureOccupancySensor_NtagIcode_JN5169_DR1175.bin"

 

to the chips flash memory via command line (JN51xxProgrammer.exe -s COM19 -f LightTemperatureOccupancySensor_NtagIcode_JN5169_DR1175.bin).

 

When I then run it and view the output on the Beyond Studio IDE terminal, I get:

 

APP Sleep Handler: Task Timers = 2
APP Sleep Handler: u8TimerTick
APP Sleep Handler: Activity Count = 4
APP Sleep Handler: u8TimerBlink
APP Sleep Handler: u8TimerPowerOnCount

 

Could you please as to how I can work on this to return temperature?

 

Thanks

0 Kudos

862 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Hi Suhaib,

Please check the in the JN-AN-1220 documentation, ZigBee 3.0 Sensors, the section: 

  • Binding Nodes
  • Finding and Binding

This will help you receive the information in time intervals.

Best Regards,

Alexis Andalon

862 Views
msuhaibs
Contributor II

Hi Alexis, 

 

I went through the JN-AN-1220 documentation, ZigBee 3.0 Sensors, documentation, and I didn’t find anything suggesting as to why the .bin file is printing said information instead of temperature...

 

I believe my problem of right now is that of interpreting the output, rather than receiving the information in time intervals.

 

What does the output I am receiving in the IDE terminal mean? Is it encrypted? Do I need a key to decrypt it?

 

Kind Regards

0 Kudos