Quantcast
Channel: WIzWiki : Wiznet Community

Ethernet gateway node design in the energy metering system

$
0
0

Reprinted from Elecfanshttp://www.elecfans.com/tongxin/123/20140428341269_a.html

AuthorBocon Robert

 

Background
Energy Monitoring System: refers to architecture and large of public buildings to install classification of consumption metering device, it is using the remote transmission of data by means of timely collection of energy consumption and achieve energy focused on building an online monitoring and dynamic analysis capabilities collectively, systems and software systems.

 

Core technology to optimize energy consumption monitoring is that, while optimizing the premise that accurate measurement of energy consumption and optimize the process of measuring energy consumption. Thus the “meter” in the traditional sense such a simple dataset evolved into “online data aggregation and control”, which the network has put forward higher requirements.

 

Firstly, it requires a speed for two-way Internet. Secondly, it requires flexible network architecture. Thirdly requires the network to accommodate enough nodes.

The figure is shown a typical network diagram:

1

 

For each building or independent internal WPAN can use wireless, PLC or Ethernet and wireless hybrid network approach. WPAN internal structure as shown below:

 

 

The following diagram acquisition node with the evolution of energy acquisition and control approach also has many forms, from the beginning of the public buildings and factories in the three type of the meter, to the following figure for home, office use collection receptacle and wireless lighting control, the increasingly more.

 

 

 

 

 

 

 

 


Weatherize Your WizFi250

$
0
0

This post will explain how to get instant weather update for a specific city (i.e. Seoul) provided by OpenWeatherMap. With JSON (supplied by OpenWeatherMap), XML and an Ethernet module, we operated WIZnet’s WizFi250.

First, check the API content at OpenWeatherMap.

Calls by city name. API respond with a list of results that matchs a searching word. In JSON : api.openweathermap.org/data/2.5/weather?q=London,uk In XML : api.openweathermap.org/data/2.5/weather?q=London&mode=xml http://openweathermap.org/current

Then, following the provided instructions above, bring forth Seoul’s weather data in JSON and XML format on a PC. A screenshot of the Network Packet during this process is down below for reference.

openweathermap

The parts highlighted in red above are data sent from a PC. We plan to eliminate the unnecessary parts and input the data below using Request Data.

At this step, \r(Carriage return, 0x0d), \n(Line Feed, 0x0a) must be input exactly and the transmitted data size (72 Byte, 81 Byte) should be paid special attention as well.

* JSON
GET /data/2.5/weather?q=Seoul HTTP/1.1\r\n
Host: api.openweathermap.org\r\n\r\n
(72 Byte)
* XML
GET /data/2.5/weather?q=Seoul&mode=xml HTTP/1.1\r\n
Host: api.openweathermap.org\r\n\r\n
(81 Byte)

Now that the initial setup is complete we will operate WizFi250. First, establish Association at AP.
AT+WSET=0,Team Wiki
[OK] AT+WSEC=0,,12345678
[OK] AT+WNET=1
[OK] AT+WJOIN
Joining : Team Wiki
Successfully joined : Team Wiki
[Link-Up Event] IP Addr : 192.168.101.33
Gateway : 192.168.101.1
[OK]

Bring forth OpenWeatherMap API server’s IP address.
AT+FDNS=api.openweathermap.org,3000
128.199.164.95
[OK]

Connect with OpenWeatherMap API server.
AT+SCON=O,TCN,128.199.164.95,80,,0
[OK] [CONNECT 0]

Send JSON Request Data to OpenWeatherMap API server.
AT+SSEND=0,,,72
[0,,,72] (여기에서 위에 설명된 72 Byte를 전송하면 된다.)
[OK]

Then, OpenWeatherMap API server will respond with a JSON Reply like below.
{0,128.199.164.95,80,857}HTTP/1.1 200 OK
Server: nginx
Date: Wed, 06 Aug 2014 00:06:49 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Source: redis
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, POST
221
{"coord":{"lon":126.98,"lat":37.57},"sys":{"type":3,"id":8519,"message":0.033,"country":"KR","sunrise":1407184771,"sunset":1407234998},"weather":[{"id":721,"main":"Haze","description":"haze","icon":"50n"},{"id":500,"main":"Rain","description":"light rain","icon":"10n"},{"id":701,"main":"Mist","description":"mist","icon":"50n"}],"base":"cmc stations","main":{"temp":297.26,"pressure":1005,"humidity":83,"temp_min":295.15,"temp_max":298.15},"wind":{"speed":1,"deg":140},"clouds":{"all":40},"dt":1407277800,"id":1835848,"name":"Seoul","cod":200}
0

If once reception is complete and the connection is still ongoing, end the connection with OpenWeatherMap API server.
AT+SMGMT=ALL
[DISCONNECT 0] [OK]

Now, analyze the JSON data received above and use the desired weather data (Seoul’s temperature, humidity, wind speed, etc.) Enjoy!
Below is in the case of when you receive the data in XML format. However, WizFi250’s fundamental rules of operation are similar to JSON so it should be straightforward.
AT+SCON=O,TCN,128.199.164.95,80,,0
[OK] [CONNECT 0] AT+SSEND=0,,,81
[0,,,81] (여기에서 위에 설명된 81 Byte를 전송한다.)
[OK] {0,128.199.164.95,80,969}HTTP/1.1 200 OK
Server: nginx
Date: Tue, 05 Aug 2014 23:59:54 GMT
Content-Type: text/xml; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Source: back
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, POST
29a

<current>
<city id="1835848" name="Seoul">
<coord lon="126.98" lat="37.57">
<country>KR</country>
<sun set="2014-08-06T10:35:34" rise="2014-08-05T20:40:21">
</sun></coord></city>
<temperature value="297.38" unit="kelvin" min="296.15" max="298.15">
<humidity value="83" unit="%">
<pressure value="1006" unit="hPa">
<wind>
<speed value="1" name="Calm">
<direction value="170" name="South" code="S">
</direction></speed></wind>
<clouds value="75" name="broken clouds">
<visibility>
<precipitation mode="no">
<weather value="haze" number="721" icon="50n">
<lastupdate value="2014-08-05T23:30:00">
</lastupdate></weather></precipitation></visibility></clouds></pressure></humidity></temperature></current>

0
AT+SMGMT=ALL
[DISCONNECT 0] [OK]

[YouTube] Simple Arduino Server Tutorial

$
0
0


In this simple arduino tutorial you’ll learn how to use an arduino and the Ethernet shield to create a webserver.

Go to YouTube

WIZ550S2E Set-Up Directions

$
0
0

WIZnet supports all various Serial to Ethernet module set-up methods. We also provide Configuration Tool programs and AT commands so that you can set up easily and quickly through the network. To utilize AT command, it can be set up directly from the serial equipment so there is absolutely no need for a PC.

WIZ550S2E supports both methods of set-up. Particularly in the case of using the Configuration Tool program, the foundation is in JAVA so not only Windows but Linux, MAC OS and other systems can also set up and operate it.

wiz550s2e_config

WIZ550S2E Configuration Tool

AT command’s command frame is easy to understand and simple to use. Every command set starts with “AT” and anything else that doesn’t start with “AT” will get an error. All the command words and parameters are ASCII characters, so if the user wishes to input “AT+NSTAT” the letters ‘A’, ‘T’, ‘+’, ‘N’, ‘S’, ‘T’, ‘A’, ‘T’ and CR(0x0D), LF(0x0A) must be input sequentially. All commands must also end with CR(0x0D), LF(0x0A).

Here at WIZnet, we offer several WIZ550S2E AT command-related tutorials

Go to WINnet’s WiKi

Introducing WIZnet Shield Product

$
0
0

WIZnet, the leading expert in providing embedded networking solutions, supplies Ethernet communication-related Hardware TCP/IP chips, modules and Wi-Fi modules. During the great influence of the global Open Source Hardware trend, our W5100 was chosen as Arduino’s Ethernet solution in 2008; and we develop as well as supply other various Shield products that offer Ethernet and Wi-Fi Internet capabilities. This post will introduce the various types of Shield products provided here at WIZnet.

1. Arduino Compatible Platform
The first platform that comes to mind with ‘Open Source Hardware’ is most likely Arduino. As stated, the W5100 is already being used for Arduino Ethernet Shield along with for Arduino Ethernet board but WIZnet recently launched new products including WizFi Shield, which are W5500 and W5200 based Ethernet Shields with Wi-Fi capabilities, to inspire even more Open Hardware innovators.

First, there are 3 kinds of Shields with Ethernet capabilities.

ioShield-A

ioShield-A (based on W5500)

W5500-EVB

W5200 Ethernet Shield

 

Next, there are 2 types of Shields with added on Wi-Fi capabilities. Both products can SPI Interface with Arduino Uno board.

WizFi Shield (WizFi210)

WizFi250-EVB

 

2. TI and Renesas Platform Compatible Shield
As the Open Source Hardware trend quickly spread internationally, main MCU vendors also started supplying Open Hardware Platforms- TI MSP430 base LaunchPad Board and Japanese Renesas GR-Kurumi Board are examples of such platforms. Now to add on Ethernet capabilities to these boards, the two below types of Shields can be used.

ioShield-L (LaunchPad)

ioShield-K (GR-Kurumi)

 

Upgrade W5500 Throughput on Nucleo STM32F401RE Using SPI DMA

$
0
0

WIZnet W5500 supports up to 80MHz SPI Clock so users with an MCU that provide a high-speed SPI communication can enjoy maximum ethernet throughput. In this post, I will show how STM32 MCU can achieve the best throughput with W5500.

When using Cortex M3/M4 line’s 32bit processors from STMicro, the ethernet throughput greatly varies upon which SPI communication mode is used. I will compare the difference of throughput between using SPI standard mode and using SPI DMA mode.

Consist of

MCU board : Nucleo STM32F401RE

Ethernet controller : WIZnet WIZ550io(W5500 inside)

Pin connection
The pin connection between the MCU board and WIZnet WIZ550io is shown in the table below.
First, connect the Power line.

Second, connect SPI signals. But, connect SCS pin to GPIOA_Pin12 because I’m going to handle it in Software method.

Third, connect RSTn pin to GPIOA_Pin11 to reset WIZ550io.

Finally, connect RDY pin that signals WIZ550io initialization is complete to GPIOA_Pin1 .

It is not crucial that RSTn pin and RDY pin be connected but it’s best for stability.

pin map

pin_connection_image

How to implement SPI protocol 

SPI protocol to control W5500 is the same in both SPI Standard mode and SPI DMA mode. However, the difference between two modes is whether there is idle time between data on SPI bus.

SPI protocol for W5500 is provided in W5500.c of WIZnet ioLibrary and has the below four functions.

  • WIZCHIP_READ(uint32_t AddrSel)
  • WIZCHIP_WRITE(uint32_t AddrSel, uint8_t wb)
  • WIZCHIP_READ_BUF(uint32_t AddrSel, uint8_t* pBuf, uint16_t len)
  • WIZCHIP_WRITE_BUF(uint32_t AddrSel, uint8_t* pBuf, uint16_t len)

When SPI DMA mode is not used, the inside of the function calls standard SPI read/write function like the below WIZCHIP_READ_BUF() function.

#if !defined (SPI_DMA)
WIZCHIP.IF.SPI._write_byte((AddrSel & 0x00FF0000) >> 16);
WIZCHIP.IF.SPI._write_byte((AddrSel & 0x0000FF00) >> 8);
WIZCHIP.IF.SPI._write_byte((AddrSel & 0x000000FF) >> 0);
for(i = 0; i < len; i++) pBuf[i] = WIZCHIP.IF.SPI._read_byte();

When SPI DMA mode is used, it prepares commands data, which consists of address and opcode, and  calls SPI_DMA_READ() function.

#else
spi_data[0] = (AddrSel & 0x00FF0000) >> 16;
spi_data[1] = (AddrSel & 0x0000FF00) >> 8;
spi_data[2] = (AddrSel & 0x000000FF) >> 0;
SPI_DMA_READ(spi_data, pBuf, len);
#endif

As explained on “How to implement the full duplex communication using the SPI DMA in STM32F2xx or STM32F4xx“, SPI_DMA_READ() and SPI_DMA_WRITE() are composed of the code to use SPI DMA mode.

Performance Comparison between Standard SPI mode & SPI DMA mode 

The source code in the related data below is a sample code for loopback testing. It shows how much difference exists in performance between Standard SPI mode and SPI DMA mode.

Standard SPI mode

In spi_handler.h
#ifndef SPI_DMA
//#define SPI_DMA
#endif

If you make “#define SPI_DMA” line as comment and compile it, then it will operate in standard SPI mode.

If you download the binary file which you got after compilation onto a Nucleo board and do loopback test with AX1.exe which WIZnet provides, then the transmission and reception will each achieve 1.6Mbps like the image below and we can know that the SPI full throughput is up to 3.2Mbps.

spi_nodma_1-75mbps

Here, SPI clock is 24MHz and you can clearly see the idle time between SPI data.

spi_nodma_1_75mbps

 

SPI DMA mode

#ifndef SPI_DMA
#define SPI_DMA
#endif

Like above, make “#define SPI_DMA” line enabled from comment and compile it.

Next, if you download the binary file onto Nucleo, then you can see the throughput of SPI DMA mode. The loopback test performance of transmission and reception is each 4.3Mbps and SPI full throughput is over 8Mbps. If you use your own board that has a high speed external clock instead of Nucleo board, then you can get much faster throughput.

spi_dma_4-4mpbs
Here, you can see SPI communicate happen continuously without any idle time like the image below.

spi_dma_4_3mbps

written by James YS Kim

[Tutorial] WIZ550S2E + RS-422/485 Device Connection

$
0
0

How to connect RS-422/485 Device with WIZ550S2E module

WIZnetMakerspace.com

$
0
0

makerspace Museum

We are proud to announce the launching of WIZnetMakerspace.com !

WIZnetMakerspace.com is a growing collection of user created UCC/UCA videos from all over the world (using WIZnet products, of course)- from easy-peasy DIY projects to remarkable tutorials to off the wall videos. Browse through, enjoy the unique and sometimes bizarre ideas, and get your creative juices flowing. We hope to inspire you to take part in creating your own UCC/UCA!


Configuration WizFi250 using Smartphone

$
0
0

Methods for setting up WizFi250 with a smartphone can be roughly divided into 2 ways.

A. Using a Web browser to access WizFi250 internal web server

B.  An external MCU utilizing the AT Command to control WizFi250 and directly communicate with a smartphone app
Pros and cons of those two methods will be discussed below.

A. Using a Web browser to access WizFi250 internal web server

<Pros>

1. No concerns with problems that could occur from using an external MCU to set-up WizFi250 (SSID, Key, etc.)

2. Uses a Web browser in HTTP format so all equipment with a Web browser can be set-up easily

<Cons>

  1. Provides a general and very basic set-up menu that is not optimum for users
  2. Inconvenience of having to access WizFi250, enter in the password, and pass through other set-up processes

 

B. An external MCU utilizing the AT Command to control WizFi250 and directly communicate with a smartphone app

<Pros>

  1. Screen composition and other controls can be optimized (Ex: Automate WizFi250 AP to access and input common information on its own and only require necessary items to be input manually)
  2. Not only the WizFi250 but also the MCU can be set up the same way

<Cons>

  1. A separate Application needs to be developed for each system used for the WizFi250 set-up (Android, IOS, Windows, etc.)

Now, we will delve deeper into the details of the process.

Of course, the directions below are simply a reenacted example so there may be some necessary changes.

A. Using a Web browser to access WizFi250 internal web serverWizFi250-Config-3

 

(1) To set-up WizFi250, click <Pin 42, Function Button> and <WizFi250 Set-up Mode> will initiate.

Here, WizFi250 will switch to Soft AP Mode and run the internal Web Server

Set AP Mode & Web Server Launch
[OK] WizFi250 Version 1.0.1.8 (WIZnet Co.Ltd)
[Link-Up Event] IP Addr : 192.168.12.1
Gateway : 192.168.12.1

(2) After accessing WizFi250 Soft AP through the smartphone and WizFi250 Web Server through a Web browser, set up the SSID, Key, etc.

A more detailed explanation for setting up through a Web browser is provided in the link below.

http://wizwiki.net/wiki/doku.php?id=products:wizfi250:wizfi250pg:web_config
B. An external MCU utilizing the AT Command to control WizFi250 and directly communicate with a smartphone appWizFi250-Config-4
(1) To set-up the Device, click the Button and <WizFi250 & MCU Set-up Mode> will initiate.

(2) Here, use the MCU to do the AT Command and set-up WizFi 250 to <Soft AP & TCP Server Mode>.
AT+WSET=1,My_WizFi250_AP_Mode
[OK] AT+WSEC=1,WPA2,12345678
[OK] AT+WNET=0,192.168.12.105,255.255.255.0,192.168.12.1
[OK] AT+WJOIN
[Link-Up Event] IP Addr : 192.168.12.105
Gateway : 192.168.12.1
[OK] AT+SCON=O,TSN,,,5000,0
[OK]

(3) Access the promised SSID with the smartphone app, and the set up TCP Server from above. Then, the input <WizFi250 and MCU Set Point> from the smartphone app will be delivered through WizFi250 to the MCU.

TCP Client Base composed smartphone app’s TCP communication data can be assumed as below.

(TX) "Get-WiFi"
(RX) "OldSSID,OldKey,....."
(TX) "Set-WiFi NewSSID,NewKey,....."
(RX) "OK"
(TX) "Set-MCU option1,option2,....."
(RX) "OK"

(4) The MCU will save the necessary set points (option1, …), and apply the WizFi250-related set points (SSID, Key, …) through the AT Command to WizFi250.

Written by Steve

[YouTube] Arduino + Ethernet Shield Traffic Light (do I have internet?)

$
0
0


Whenever it rains in the city, there are always areas that lose internet connectivity, and my office is one of them. This traffic light sends out ICMP pings to see if it is connected and changes lights appropriately.

go to YouTube





Latest Images