Bitcloud WSNDemo more sensors data

Go To Last Post
15 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,
I am adding more sensors to Bitcloud WNSDemo, the Visualization program can only display three sensor's data, Temperature, light and battery voltage. Does any possible to display more data by using this program? or is there any free program can do the same job? thanks.

Last Edited: Fri. Oct 16, 2015 - 12:49 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There is no way to add more sensors and I'm not aware of any other alternatives. That app is supposed to be a demo. Is it really useful in some final application?

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thank you very much Alex,

the other question,
I am running WSNDemo on ATZB-X-233_pro, the board has two USART, one works for WSNDemo Monitor, How can I use the other USART as a debug port by using function like printf ();?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There is no really easy way to do that. You can try to use BitCloud UART driver, but it is convoluted for this purpose.

I usually create a very simple debug module that might looks something like this:

#include 
#include 
#include "sysTypes.h"
#include "debug.h"

/*************************************************************************//**
*****************************************************************************/
void dbg_init(void)
{
  uint32_t brr = ((uint32_t)F_CPU * 2) / (16 * 115200) - 1;

  PORTC.DIRSET = (1 << 3);
  PORTC.OUTSET = (1 << 3);
  PORTC.DIRCLR = (1 << 2);

  USARTC0.BAUDCTRLA = (brr & 0xff);
  USARTC0.BAUDCTRLB = (brr >> 8) & 0x0f;
  USARTC0.CTRLB = USART_CLK2X_bm | USART_RXEN_bm | USART_TXEN_bm;
  USARTC0.CTRLC = (uint8_t)USART_CHSIZE_8BIT_gc | USART_PMODE_DISABLED_gc;
}

/*************************************************************************//**
*****************************************************************************/
void dbg_putc(char byte)
{
  while (!(USARTC0.STATUS & USART_DREIF_bm));
  USARTC0.DATA = byte;
}

/*************************************************************************//**
*****************************************************************************/
void dbg_log(char *fmt, ...)
{
  va_list arg;
  char buf[100];
  int i = 0;

  va_start(arg, fmt);
  vsnprintf(buf, sizeof(buf), fmt, arg);
  while (buf[i])
    dbg_putc(buf[i++]);
  va_end(arg);
}

You will obviously have to change port settings.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It works perfect, thank you very much.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm not aware of a method to get more sensor data displayed next to the node symbols in the graphical display. It is however possible to get the data into WSNdemo and show it in the data fields at the left. You will have to click on a node and its data will display.
There is an XML file which defines the data format for WSNdemo. Open the existing one and have a look at it. You can then add your own data fields.
Depending on what coordinator you have connected to your PC, you might have to change its program as well to be able to receive the extra data. I'm normally using the RZusb stick and I have this scheme working showing lots of data from an energy measurement sub-system.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thank you Raybased
get it work. that is what I am looking for.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Alex,
I modified the code to read xmega256a3 (atzb-x-233-xpro) analog inputs and can not get it work. here is the code


void adcCallback(void)
{
adcAmountCnt++;
adcTimeoutCnt++;
if ((adcControl.adcData > (adcExpectation + ADC_AMOUNT_DISPERSION)) ||
(adcControl.adcData < (adcExpectation - ADC_AMOUNT_DISPERSION)))
{
adcExpectation = adcControl.adcData;
adcAmountCnt = 0;
}

if (MAX_AMOUNT_COUNTER == adcAmountCnt)
{
adcAmountCnt = 0;
adcExpectation = 0;
adcTimeoutCnt = 0;
bspPostTask(BSP_ADC);
return;
}

if (MAX_COUNTER_2_TIMEOUT == adcTimeoutCnt)
{
adcAmountCnt = 0;
adcExpectation = 0;
adcTimeoutCnt = 0;
bspPostTask(BSP_ADC);
return;
}

adcState = BUSY;
readBspAdc(adcControl.adcCallback, adcControl.adcChannel);
}

result_t openBspAdc(void)
{
adcExpectation = 0;
adcAmountCnt = 0;
adcTimeoutCnt = 0;
if (IDLE == adcState)
{
adcDescriptor.tty = ADC_HW_CHANNEL_A3;
adcDescriptor.resolution = RESOLUTION_12_BIT;
adcDescriptor.sampleRate = ADC_31250SPS;
adcDescriptor.voltageReference = INTERNAL_1V;
adcDescriptor.bufferPointer = &(adcControl.adcData);
adcDescriptor.selectionsAmount = 1;
adcDescriptor.callback = adcCallback;
adcState = BUSY;
int test=HAL_OpenAdc(&adcDescriptor);
return BC_SUCCESS;
}
return BC_FAIL;
}

result_t closeBspAdc(void)
{
if (IDLE == adcState)
return BC_FAIL;
adcState = IDLE;
HAL_CloseAdc(&adcDescriptor);
return BC_SUCCESS;
}
result_t readBspAdc( void (*cb)(uint16_t data),uint8_t channel)
{
openBspAdc();
if (BUSY != adcState)
return BC_FAIL;
adcState = DATA;
adcControl.adcChannel = channel;
adcControl.adcCallback = cb;
HAL_ReadAdc(&adcDescriptor,channel);
closeBspAdc();
return BC_SUCCESS;
}

it stops at


HAL_ReadAdc(&adcDescriptor,channel);

it seems the adcDescriptor something wrong, but i can not find it.

please help, thank you much.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Use ADC registers directly. I'm not dealing with non-networking stuff of BitCloud, there must be an end to that nonsense.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Alex,

on ATZB-X-233_pro how can I use
BSP_ReadUid() get the module's MAC address, according to datasheet it is located in signature row.

or is there any way to get that MAC address?

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why do you need BSP_ReadUid()? Just read it from the signature row directly.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you very much Alex,
I am using studio 4.19, when I read signature I only get a few numbers, like this

0x1E 0x98 0x42 (JTAG ID is 0x6984203F)

not the MAC address, would you please give me more information how to read it? thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't know if AS4 knows about signature row on Xmega devices. Read the datasheet about Non-volatile Memory Controller.

Also read about nvm_read_byte() and NVM_CMD_READ_USER_SIG_ROW_gc parameter.

I don't have an example, but I'm sure you can google one.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Alex,
I had successfully read the mac address byte, but still have some confuse by the sequence of the byte I got from user signature row.

the user signature row file read from studio4.19 like this (the first few lines

:100000000213666FF6A01C250400205A6967626916
:100010007420586D656761202B20524632333300BF
:1000200000000000000000003133323831000000D1
:1000300000004130392D313733310B00C10007004A
:10004000000000000000000000009A8BFFFFFFFF8F
:10005000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB0

I use the follow code to read Mac address

  union _MAC_
	  {
	  ExtAddr_t extAddr;
	  uint8_t  macdata[MAC_LAST_BYTE-MAC_FIRST_BYTE+1];
	  } MacInSignatureRow;
    for ( uint8_t i=MAC_FIRST_BYTE;i<=MAC_LAST_BYTE;i++)
    MacInSignatureRow.macdata[MAC_LAST_BYTE-i]=halReadRowSignature(READ_USER_SIG_ROW_CMD, i);

the sequence is reversed if I did not use

[MAC_LAST_BYTE-i]

so I am wondering which byte is most significant byte in user signature row? byte number 2 or byte number 9?

that is which of follow sequence is right for mac address
byte2:byte3........byte9
or
byte9:byte8........byte2?

Thanks

Tom

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In this case MAC address is 00-04-25-1C-A0-F6-6F-66. Atmel manufacturer ID is 00-04-25.

So it is stored as LSB first (little-endian). Your code will be correct without reversing on Xmega, since Xmegas are little-endian devices.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.