[Application Examples]Implement Embedded Web Server using WIZNet products

Introduction

Users can control remotely their embedded products using Web Server. WIZNet modules are used as Web Server to control products remotely. This post introduces various examples how to implement embedded products using WIZNet modules.

 

Examples

Using Arduino as a simple Web Server along with Ethernet shield

connection-320x202Ethernet shield along with Arduino board users can turn it into a simple web server which can be accessed by anyone on the internet.

 

 

 


How to monitor analog input using W5500-EVB Web Server

web_server-320x202In this tutorial, we will introduce a web server example code. From this code, you can learn how to read the input value of potentiometer which is mounted on W5500-EVB

 

 

 


DIY Webserver with Arduino Mega 2560

1.DIY-Webserver-with-Arduino-Mega-2560-320x202
This project is a simple webpage using the Arduino mega2560 and Ethernet shield.

 

 

 


How to: Connect your Arduino to the Internet as a Web Server

0.Connect-your-Arduino-to-the-Internet-as-a-Web-Server-320x202
This project is a servo and LED those are controlled via a Webpage. The control page is accessible from both the private and public networks.

 

 

 


Arduino temperature web server

Ethernet2_thumb1-320x202
This is a simple temperature web server that show the temperature normally. but it will be changed as a warning page when temperature is high.

 

 


WebServer for tracking devices

arduino-track-2-320x202This project started as an idea to remotely monitor author’s dog to know its real time position. Due to some problem, the author decided to start the prototype first, and later would implement the perfect one for his dog.

 

 


RoboSapienServer

RoboSapienServer-320x202This post introduces Robot that was transformed into web controlled Robot.

 

 

 

 


Tutorial: Controlling Servo / Webcam via webserver, Wiz820io and Garagino

asdasd-320x202This project is a server with Garagino and Wiznet Ethernet module, and thus an HTML page that displays the buttons that control the servos connected to the Pan / Tilt.

 

 

 

 


An Arduino Room Monitoring Web Server

090-300x202This tutorial is showing how to turn an arduino into a room monitoring system. An PIR board and a LDR is connected to the Arduino. The arduino is visualizing the measured data via a webserver

 

 


Web Server with Two Temperature Gauges

webserver-320x202This project consists of two temperatures that are measured by the Arduino using two MCP9700 temperature sensors. An Arduino Uno and Ethernet shield are set up as a web server that hosts a web page to display the two temperatures on two gauges.

Advertisements

[Application Examples]Implementing MQTT with WIZnet Products on Embedded System

All these links have been posted on http://wiznetmuseum.com under approval by owners.

We summarized them to help developers with real examples.

What is MQTT?

MQTT is one of popular protocols for a machine-to-machine (M2M)/”Internet of Things” connectivity protocol. It was designed as an extremely lightweight publish/subscribe messaging transport.

For more details, please refer to below links.

 

 

Examples created by users on wiznetmuseum.com

Arduino KAKU MQTT client

  • This post is about example how to connect MQTT Client (Arduion & Arduino Ethernet shield) to 433MHZ wireless module. The MQTT client controls the wireless device.

MQTT Sensor Station

  • This is an example of MQTT Client made of Arduino and Ethernet compatible board. It is used as weather station by having MQTT Broker and MQTT Client at the garden and office.

Electricity Meter Usage over MQTT

  • This project gets electricity meter reading with photocell and sends to a  MQTT server.

MQTT Caller Display – Hacking the BT Caller Display 50 Serial Port

  • This project uses a BT Caller Display 50 connected via an opto-isolating bridge to an arduino with an ethernet shield. When an incoming call is received, the telephone number is transmitted via MQTT to a python client on any computer.

STM32 Nucleo and MQTT Protocol on Arduino ethernet shield

  • This post shows MQTT service with STM32 Nucleo and Arduino Ethernet Shield. It includes reference for W5100 and W5500 that is useful for STM32 users.

MQTT, Arduino, Old Ammeters and Bandwidth Monitoring

  • This system monitors the current internet speed usage and display it on the ammeter.

Arduino, MQTT, OpenHAB and the Ultimate Room Control Panel

  • Create a Ultimate Room Control Panel based on Arduino / Ethernet shield, MQTT and OpenHAB

Using MQTT with Home Assistant

  • Home assistant is an Open-source home automation platform which operates based on Python 3. It is possible to control and monitor all of home appliances with simple settings. Home assistant recently supports MQTT and this posting provides source code and how to monitor changes of the brightness of photo resistor using Arduino and Ehternet Shield.

Primus + MQTT + Arduino == Internet of Things!

  • This content consists of Arudino + Arduino Ethernet shield(W5100) + MQTT Project. Just simple example of MQTT project.

Real-Time Web Interface to MQTT using Socket.io and Node.js

  • This is a real time web interface to MQTT. Author describes the project step by step in details and that will make so much easier for any of you to follow.

Building Smarter Planet Solutions with MQTT and IBM WebSphere MQ Telemetry

  • The ‘Building Smarter Planet Solutions with MQTT and IBM WebSphere MQ Telemetry’ is a kind of book. in this book, with the introduction of MQTT and IBM WebSphere MQ Telemetry as the title. and show how to develop using it.

Arduino, mqtt, web socket, home automation

  • This project explains how to use MQTT & Websocket on Arduino due & Ethernet shield for home automation.

How to implement embedded Mqtt Client using W5500 IC

  • Porting the Paho Embedded MQTT Client into W5500 + STM32F103VC Custom board

OPENHAB, MQTT, ARDUINO AND ESP8266

  • This tutorial is the example on how to implement Home Automation system using MQTT and OpenHAB. And it also introduces as many examples as possible to be implemented by Ethernet based on Arduino Ethernet shield as well as WiFi module based on ESP8266.

Gadgetkeeper – Arduino blink LED with MQTT

  • This tutorial shows how to control LED with MQTT used Arduino Ethernet Shield. This uses Gadgetkeeper development platform(http://gadgetkeeper.com/) which provides a complete application design, runtime, and intelligence environment allowing the rapid creation of IoT solutions to connect your sensors, devices, and equipment (“Things”) with people and systems.

 

Hack it ! Attack it ! Why and how Hardwired TCP/IP by WIZnet chips (W5500, W7500) makes small MCU systems “unattackable”

W7500 Cortex M0 core is drinking coffee

In the last days and weeks (or 13 years) I was often asked how the chips from WIZnet help to make Systems more stable, better performing and ! more secure.
Here we talk about small MCU with only a few MHz clock speed and FLASH + RAM in kByte size.
“How can that be unattackable ?”“How do you make sure the (real-time) application stay stable ?” and so on.

Here I collected all my e-mail Q&A and post it for you as a compressed text.
I hope you will understand more the background info about:
Hardwired TCP/IP Engine vs. Software Stack.

Performance (2002, 2006, 2008, 2015):

Already starting in 2002, and ongoing, I investigated performance and stability on small 8bit MCUs like 8051 and AVR and how to make them IoT ready.
The only solution to handle all the Internet protocol and on top applications on small MCUs is to offload most (or all) protocol processing out of the MCU => Hardwired TCP/IP = WIZnet’s Chips and Modules.
WIZnet offer 2in1 (hw TCP/IP + MAC) and 3in1 (hw TCP/IP + MAC + PHY) Ethernet controller chips. Additionally WIZnet also offer SoC chips, 4in1 (MCU + hw TCP/IP + MAC + PHY).
In 2002 I used the first chip generation W3100A (2in1) and later here I refer to the latest 3rd Generation W5500 (3in1) chip.

Using hw TCP/IP chips, the bottleneck is only and always the MCU and the MCU’s I/F to the WIZnet Ethernet-Controller.
The limiting factor is the memcopy or xread and xwrite speed for the (external) parallel I/F, or the speed of the SPI I/F.
My investigations in 2002 ended in a small article about “washing-machines to Internet” for the Elektor in March 2003 and proved the 8051 (8MHz) to perform in the lower Mbps throughput range already, an later an AVR performed 8Mbps in 2006.

In 2008 Tom Cantrell from USA made an very detailed investigation & report on the performance and stability boost enabled by the 2008 released W5300 (3in1) chip.
His approach was a bigger MCU (on our W5300-EVB = 200MHz ARM9, 64M RAM + 64M Flash) and an embedded Linux with Software Stack as well as using Hardwired TCP/IP Stack.
With more and more parallel applications launched, in the OS, the Ethernet performance of the software Stack inside the OS goes down dramatically.
=> simple fact: any (real-time) applications is disturbed.
But the exact same Platform and same OS with same Applications prove the outstanding performance advantages of Hardwired TCP/IP.
The Throughput was (is) always above 75Mbps. Any real-time application would be uninterrupted.
Please be assured a Raspberry-Pi II with 1GHz MCU can pump 111MBps into the 100baseTX Ethernet, unimpressed, yes, but try this with several application launched parallel => performance goes dramatically down.
You would be happy to have stable 75Mbps and some less Interrupts for your other tasks.
Here a picture from Tom’s 2008 Circuit Cellar #218 article:

W5300 Hardwired vs. Software Stack
W5300 Hardwired vs. Software Stack

Tom concluded:

W5300 boosts performance and stability
W5300 boosts performance and stability

2015:

And now in 2015 with our latest 4in1 SoC (48MHz Cortex M0 + Hardwired TCP/IP + Ethernet) we can present the most best Internet Protocol performing ARM Cortex M0 MCU of the world, as we think.
Roy “embeddist”, one of our chip design engineers did tests on the “Attack” part of this performance Story.

(1) Firewall SoC with TCP/IP Offload Engine

(2) Network performance of W7500 SoC with TCP/IP Offload engine – using DMA

Even a double speed and 5 time more memory ARM Cortex M3 MCU, with much more complex core, can not perform as good as our small & simple (Hardware supported) M0 MCU – W7500:

W7500, the unattackable
W7500, the unattackable “Firewall” SoC for the IoT

Here his findings:
Roy’s Blog about the W7500 performance compared to the M3. Just click on the Pictures:

W7500 Cortex M0 vs M3 performance under Attack
W7500 Cortex M0 vs M3 performance under Attack

And using DMA is boosting the performance to even 45 Mbps ! on that small M0 !

W7500 performance using DMA
W7500 performance using DMA .. 45Mbps

Our small ARM Cortex M0 in the W7500 SoC just outperform the bigger M3 by factor 3 to 10 so easy and does not allow any “Attack” to disturb it’s main Target application.
With offloaded = Hardwired TCP/IP Protocol there is no Interrupt, so the performance stay high, a real time application would stay stable.

Stability – Security – Unattackable – Unhackable

To tell the same story with even bigger words I like to go into some more details.
Regarding “unattackable” and “security” I like to add some detailed info here.
The TCP/IP offload Engine (ToE) is pure silicon gate logic, no MCU or FPGA or any code from Flash or ROM mask is executed inside that ToE chip.
As all the IP (Layer 3) and UDP + TCP (Layer 4) protocol is executed by gate logic, so, it’s very very fast and unattackable on that level already.
The TCP/IP engine exist 8 time parallel. The status and data of up to 8 connection can be handled at same time – really parallel. By the way, any special IP- or MAC-Layer protocol can be implemented anyway in software as there is a direct access pass-through the Socket 0 engine.
In Hardware, all protocol handshaking, automatic answer processing, packet check sum and extracting data is fully handled by the ToE without interrupt for the on top (or your) MCU (our our W7500 M0 core).

Here the TCP handshaking from Server point of view is like a telephone call – and all that is a pure hardware status machine:

TCP/IP Server Status Machine
TCP/IP Server Status Machine

From CLOSE to INIT:
+ switch your telephone on

From INIT to LISTEN:
+  wait a call coming => become Server

Receive a SYN:
+ phone is ringing

Answer with a SYN – ACK:
+ press green button and say: “Hello ?”

Receive ACK:
+ hear: “I like to talk to you”

Then you are ESTABLISHED
+ exchange data by send and receive chat

Additionally to the Status machine and protocol (ToE) engine we have 32k of dual ported RAM in all our Chips to store send and receive (at same time) the raw application data. So the raw data is in that external 32k memory and not in the MCU’s memory before you memcopy it for handling, of cause.
=> So, there is no Operating System or any Interrupt machine needed on your MCU to make Internet applications like Web-server, Gateway or other Application. And our chip (or ToE) is acting with high performance and is just external memory (separated address area) to the MCU. All timing critical part is handled by the ToE. The MCU can do the (real-time) Application part with priority.

And even if there is a virus or bad data in the raw data memory ?
Who can execute code in external RAM ? There is no OS and this RAM is no code memory.

On top security (Layer 5 – 7), other story:

We implemented TLS 1.2 (transport layer security) using STM32F103 and F205 (for reference) the last two years with strong crypto algorithms together with 3rd party help. That 3rd party is Escrypt (embedded crypto) and Steen-Haarbach (system consultant) and the full implementation is automotive graded MISRA standard C code.
Incl. a small demo web-server (https) the TLS client and server together (+ 3 certificates) needed just ~ 50k of Flash and a few 3k to 5k of RAM memory (dynamically). That implementation is done in a most slim way and without any OS or interrupt call.
We (and our partners) can license this implementation to any customer. Porting to other MCU is supported by Steen-Harbach.

All that together is what we call “unattackable” because the Hardwired TCP/IP can not be “hacked” or passed by any virus or “attacked” by a DDOS attack. And the Key exchange for encrypted data is secured against man in the middle the best way.

Why? In the higher level application there is no Interrupt system and no OS, so no external code can be executed. And, in the MCU, the crypto and TLS also work without interrupt. If you like you use secured memory or crypto smart card co-processor to make it even physically much more un-hackable. You can level up as you like.

  • There is no way to hack or attack an OS that is not there.
  • You can not unintended execute a Virus in external RAM memory, specially without OS.
  • The performance is always very good, as no Interrupts. Even under attack.
  • The source code is very small and can be easy certified or audited as there is no (or if, a very small) OS.
    => There is dramatic cost difference if you like to have a audit on many 100,000 lines, or just a few hundred lines of C code w/o Interrupt system!

“Attack” Scenarios:

  • 1.) the W5500 (ToE) or W7500 application is a Client (like Browser)
    • a) that’s never ever any problem. Even if the Ethernet itself with it’s max performance of ~ 111 Mbps is flooded on the Physical Layer, there is always a few kbps left to send out the SYN and make the connection. But if your network is that occupied (flooded) on PHY Level already, you have a different and much bigger problem.
    • b) I don’t know …
  • 2.) the W5500 (ToE) or W7500 application is the Server = one or more Socket in LISTEN status:
    • a) the socket connection is ESTABLISHED by a client and stay connected, then:
      No one can break that connection down – as long as it stay ESTABLISHED , don’t close from either side.
      But even if it’s closed it can be ESTABLISHED again as long as a socket can go into LISTEN status again.
    • b) flooding attack goes to the open Socket before the (by your application) intended connection.
      • 1.) if the SYN flooding goes to any random port numbers or any ARP or Ping, then no problem.
        Your LISTEN Socket stay or can be closed & re-initialized at any time, very fast.
      • 2.) if the flooding open exactly that specific application port with a SYN then your trapped – in some way.

But your not really trapped here:
As told before the W5500 (ToE) supports up to 8 sockets at same time parallel. If all 8 sockets are connected = ESTABLISHED (by a very specific attack as 2.b.2.), then no other client can access any more, until one of the sockets is closed and re-init to LISTEN again. But any next first client SYN (maybe attack) will connect again….
Yes, your application Socket is not available most of the time = DDoS success, but:
If there is a specific SYN flood attack on your specific application Socket you (the MCU) need to be fast to close them again and again and again to make it LISTEN for your intended Service – or avoid System Overflow. That’s very little load on the MCU with the ToE does it all, but a lot (sometimes too much) for an OS.
Compare again the two options:

  • MCU + operating system (embedded PC ..) = Software Stack.
  • MCU + W5500 (ToE) = together like the W7500 = Hardwired Stack.

The ToE is very very fast in switching and processing socket status, it’s ‘only’ Gate-Logic, so your MCU just need to assist or control that, from time to time, not timing critical.
That Scenario 2.b.2. is also the case with every embedded PC (Raspberry Pi, Beaglebone…) or even a big server in a Data-center – doing that all in Software with a lot of interrupts and memory to store all the status data … even worse.
=> it’s overrun by Interrupts and eventually out of memory = overflow.
The 8 parallel Sockets in our (ToE) are real parallel ! + supported by internal 32k of dual ported RAM for read and write from both directions at the same time.

Our Hardwired TCP/IP engine (ToE) is ~ 200 times faster in answering and analyzing Packets then a fast Intel Core i7 PC (2 GHz, 8GByte). We tested this 8 processor PC (Core i7) while coding the TLS on the small STM32F103 MCU (~ 50MHz, 20k RAM memory, 128k Flash) just by accident as a communication partner. The i7 was too slow !
Yes, the i7 can send data with ~ 200 or 300 Mbps to the GBit Ethernet but need time to process interrupts with every single packet that comes along. To answer a single PING, SYN, ARP, …  packet  or drop it as useless, the i7 (with Windows 7 pro) is not as fast as the W5500 or any other ToE chip directly.
Even worse if the (embedded) PC need to check all ESTABLISHED TCP connections and close them faster as they pop open in an attack – just to make one of them LISTEN again. No chance.
=>
Even in an worst case attack (and specially in that scenario) maybe directly to your application Socket (Port) a small MCU + W5500 or W5300 (ToE) or the W7500 outperform any OS on any big CPU or MCU.

At least your (real-time) application stay un-attacked and fully available.

I invite you to give that a try:
Hack a non OS Application (maybe the Web-server on the WIZ550web module) using WIZnet’s ToE chips.
Or, bring such an OS less application totally down by DDOS Attack.

best regards,
Joachim Wülbeck
Product Manager Europe / Field Application Engineer
WIZnet Europe GmbH

W5500CoB the W5500 Connector on Board Module used with Espruino Pico – BreadBoard setup

Espruino Pico and W5500CoB

After setting up the Break-out-Board W5500BoB (-> Blog) last week I set up the ‘sister’ W5500CoB (-> Wiki) Module from ESoPe here.
This Connector on Board Module is 1:1 compatible for the MCU I/F (8 pin 100mil Pin-Headers) but it includes the RJ45 connector on Board.
So there is also the W5500 chip on the Module and I connected it by SPI again with the same Espruino Pico:

  • W5500CoB module (W5500 + xtal + passives + RJ45 connector)
  • Espruino Pico (STM32F401 MCU … JavaScript engine)

This is how the BreadBoard look like:

W5500CoB with Espruino Pico
W5500CoB with Espruino Pico

Here also the detailed Schematic (PDF) in a BlockDiagram style:

SPI connection of W5500CoB and Espruino Pico
SPI connection of W5500CoB and Espruino Pico

2015-05-06_W5500CoB_MCU_001 (same as PDF file here for download)

I think all other Info is in the former Blog entry (W5500BoB), so I don’t need to double all info here again.

Best regards, Joachim

W5500BoB the W5500 Break-out-Board with RJ45 and Espruino Pico – Part 1 – Hardware

I started using our new 3rd Party Module W5500BoB (Break-out-Board for the W5500 chip) made by ESoPe together with the small Espruino Pico MCU Board.
So there is this Hardware:

  • W5500BoB module (W5500 + xtal + passives)
  • Espruino Pico (STM32F401 MCU … JavaScript engine)
  • RJ45 MagJack by Cetus (same as on the WIZ550io Module)

I connected all this on a BreadBoard:

W5500BoB on BreadBoard
Picture: Espruino Pico + W5500BoB + RJ45

The detailed Schematic in a BlockDiagram style look like this:

Espruino Pico + W5500BoB + RJ45
Block Diagram / Schematic: Espruino Pico + W5500BoB + RJ45

The USB connector type A on the Espruino Pico is (normaly) used to plug it into a computer directly, so I used a USB extension cable to power my setup and to have the serial (virtual COM port) connection.
The Espruino Pico can be controlled by serial commands = Java Script language very easy, so it’s perfect for a short test. Our original WIZ550io Module (W5500 inside) is supported directly.

The new W5500BoB is ‘only’ the W5500 chip + xtal and passive components, so any MCU Board and any RJ45 (also PoE types) can be connected without a single extra part needed.
You can see in my picture that I did not add anything. Also the LED current limitation Rs and the 50ohm termination is included on the W5500BoB module.

The RJ45 here is the same Cetus J1B1211CCD we used on the WIZ550io, WIZ550S2E and W5500-EVB already. It’s fully industrial temp. range qualified and we offer in our Store and by our distributors for a very good price.

The setup is working perfectly well already.
In Part 2 (in a few days) I will describe how to make an Internet (Test) Application working on the Espruino Pico.

Regards, Joachim

WIZ550web interacting with professional homeautomation KNX bus

Prerequisite – Why KNX

I’ve been renewing a part of my house and as I always wanted to have some home automation – the decision was set. It was not easy and I was quite long considering what to take. There were so many wireless and wired solutions available. I did not want to go for wireless – at least not as primary system. I already used some remote controlled plugs – but I’m sick of changing empty batteries. Sometimes messages got lost, so I had to press the buttons twice. So the decision was set to take some bus system. There are a couple of vendors that provide actuators and sensors. There are also some free implementations available, like Freebus, which directly couple to the bus – so you can build your own devices.

For me there were some criteria important: reliable function of basics, no battery changes, interaction with my Fhem home server possible. The reliability was most important for me. Basic functions like switching light on and off, should always work. A worst case scenario, which I was thinking of, was: I’m in a bright house in the evening on the way to bed, and then the home server got messed up by some update or reconfiguration and I cannot switch my bedroom light on, and the other part of the house off! So my decision was, all the parts for basic functions have to be “off the shelf”. All the additonal functions (automatic light switching, automatic blind control, etc) don’t need the same level of reliability (Even i did not require that in the beginning, I reached a quite high level in the end). Even I like to hack or build stuff on my own – I want to have the possiblity to just “buy” spare parts if something breaks.

I thought this would be a good base. KNX is based on the EIB (European Installation Bus) and uses usually Green wires similar to telephone cables 2 x 2 x 0.8 mm2. Two of the wires are used for the bus communication and can also power devices with 29V. The other pair can be used for an auxiliary power source in case your device needs more power, or the bus communication is disturbing.

So finally my home got (at least partially) touch panels in the rooms for light, blind and heating control as KNX sensors. The lamps are controlled by KNX actuators directly from the mains distribution.

Based on that system I’m now able to implement fancy home automation stuff.

automated light – motion sensors control with server

My wife often complains that I do not shut the light off. But when I want to return soon, I let it on. So I decided to go for an automated solution with motion detectors- thanks to KNX it’s an easy task. You just set the actuator to stairway mode with. In that mode the light will go automatically off after, e.g., 90 seconds. As I have dimming actuators it’s even possible to set some warning time, so 20 seconds before the light will go off it will dim to 50% – so even something goes wrong I can still use the remaining light to switch back to 100%. So the configuration of actuator was an easy task, but when I wanted to order PIR sensors for the KNX bus, I almost fell of my chair. 100EUR each – and I wanted to have around 10! That’s why I thought here I go for my own development. I found on ebay some PIR sensor modules for around 1 EUR (!) each from China . As I was not in a hurry I ordered and around 3 weeks later they arrived. evb-pir

Right after the modules arrived I took one and connected it to one GPIO of a WIZ550web-EVB. The output of the PIR module is 3V so it can go to the GPIO of the module directly. This is good, as I don’t want to use an EVB for my “production” use and just the module itself. The WIZnet module has a preinstalled demo web page, which makes it possible to directly access the inputs and outputs. So after powering up I was immediately able to see that the Webpage showed Input D8 was high for some seconds,  when I was moving around.

First I thought there was an instability during boot. Whenever I pressed the Reset button on the board, the module did not come up and was waiting in the bootloader! But as I figured out this is not a bug but a feature. D8 has a second meaning during boot – in case you mess up the application code, you can pull D8 high during reset and the module will wait in the bootloader! This was not so good in my case, as soon as I moved my hand in direction of the Reset pin, the PIR module raised the level of D8 to high! To circumvent this for development, I just moved to another Input pin. (As look ahead to part2: I recompiled the bootloader and removed this feature, as i wanted to use all input pins without limitation – in case something really goes wrong during development, I can easily reflash the module via serial line – but if D8 is high during boot while in production use my application will “hang”)

Eibd on home server

Fine now I have a website with a virtual LED showing motion. I have an Alix-D3D board (this could be an Raspberry or something else today) hosting my FHEM server. To communicate with the KNX bus I need some Modem. I ordered a TUL from busware.de which can be connected via USB. The TUL is not standalone you still need an eibd on the system to communicate with the bus. There are also some gateways on the market that have already implemented it, but they cost more.  Eibd can also be a gateway to the ethernet. This is handled by multicasts, so the KNX bus is then available also as let’s say “virtual bus” on the ethernet also. IP devices can join that multicast group and get also all messages same as they were on the physical TP bus. gateway(look ahead: I will use that gateway function later)

Anyway, for my first try I don’t use that gateway functionality.But as the Eibd is running on that system it is possible to directly execute the “group(s)write” command on the command line and send a group message to the KNX bus.

Now I wrote a small script that is getting the output of WIZ550-web via php (php5-curl) every second. If D8 is “1” then ‘ON’ is sent to the actuator. This worked out of the box, but I’m not happy with it. I absolutely don’t like the polling every second. Even it’s my LAN that can easily manage that little data, it hurts my engineers heart if unneccessary data is constantly transmitted with http overhead every second. It’s a little bit like a dripping watertap. So as I had formerly seen, Eibd can be setup as a Gateway, so it’s possible to send directly a multicast to switch on the light…

Part2: Talk “Directly” to KNX devices via Gateway.

com-waysMy next idea was to write my own Firmware for the WIZ550web. systemAs the Eibd is transferring the KNX bus data to the ethernet, the module shall directly communicate with the KNX bus. So no more polling every second, just one packet for switching on the light.

Another goal for me is receiving multicasts on the module to get feedback. I wanted to control the module also. The module needs some information if it is currently night – because at night I don’t want to have a bright bed room in case the cat walks through…

(Look ahead: In part 3 I’ll also use this to control my projector and my power amplifier)

So first I had to install the toolchain and get the source code of WIZ550web.

Toolchain – Compiler and Eclipse

The following two articles describe how to install the Toolchain on a Linux System:

https://wizneteu.wordpress.com/2015/03/19/install-eclipse-and-compiler-for-stm32-with-w5500-on-linux/

https://wizneteu.wordpress.com/2015/03/19/flashing-stm32-via-serial-line-on-linux-stm32flash/

Import Source code to Eclipse

The following article is describing how to import an repository to eclipse. It also shows how to fork a repository. For further processing I suggest you sign up for a free github account, then fork the repository directly on github.com.Bildschirmfoto vom 2015-03-31 16:16:24 When you fork it to your account you are able to commit your changes to your repository so others can also participate. I have a branch “freebus” beside my “master” branch. That’s what you need to use when you are in eclipse.

https://wizneteu.wordpress.com/2015/03/19/import-github-project-of-the-webserver-wiz550web-to-eclipse/

https://github.com/7tobias/WIZ550web

Here you can see a picture of the Git Repository view of Eclipse:

eclipse-git

 

Currently I use a small python script to catch the multicast packets that are already on the bus, and I replay them with my module. It would be even nice to configure the module via the ETS software but that’s something for the future. For the beginning I’m fine with it how it is currently.

The module is checking the status of the input pins, as soon as there is a rising edge on a watched pin my multicast is sent out and the light is on…

Using the plain module

powerregulator web-wpowerAs I don’t need the complete EVB for my “production use” I bought some 3V voltage regulators. I added some jumper cables, so I can connect the power source directly to the module. As i don’t have any parts beside the power regulation I skip a special EVB; all PIR outputs are connected directly to the input pins of the module. In the picture on the right side you see only one PIR.

 

Part3: Control of Projector, Projection Blind and AVR Power Amplifier

My next step is using a second module to control my home cinema in my living room.

I have:

  • Projection blind
  • Projector Epson
  • AVR Denon power amplifier

Projection blind control

My blind is motor driven and has a RF remote control. So I soldered just some cables in parallel to the buttons of my remote control. These are attached to the relays of the EVB. When I want to roll up or down, I just have to close the circuit via the relay for a certain time, e.g., 0.3 seconds similar to what a human would do.

Projector Epson

My Projector has a RS232 port. It’s possible to control many things on that port and ask for error codes. But my primary use case is just to switch it off and on. All the other settings stay currently the same. So just have to wait for “:” as command prompt then I can send “PWR ON” or “PWR OFF” with 9600 bps on the serial line and the projector is starting or shutting down. If I ask with “PWR?”, I can get “PWR=01” or “PWR=00” as answer. I ask this every couple of seconds, as I also want to send feedback to the KNX Bus in case someone is switching on my Projector manually – so my touch panel is showing always the correct state.

AVR Power Amplifier

The Denon AVR is in one thing ahead of the Projector. Every time some setting is changed (input, volume, power, etc) this information is directly sent to the serial line. So I do not need to ask the AVR regularly for changes. That’s quite nice. Beside that the protocol is documented and not very complex. Basically I need power on and off the main zone. I also need to select the input source, and I want to control the volume of the main zone.

 

Conclusion

This setup is working well. I do not regret that I went for this solution combining KNX with my self made addons. I’d go for it again if I had to choose. There is still plenty of room for enhancements. I’ll report when there is something new.

Import Github project of the Webserver WIZ550web to Eclipse

In the load-two articles I Showed how to install the toolchain and how to flash the binary with stm32flash. This article will show how to import the project into eclipse with git Directly from Github. Git is a very powerful version managment system. GitHub is a platform implementing a git server with more nice tools for collaborating. If you do not know it yet, give it a try – you will be amazed how easy collaborative work will be.

So first we have to decide Which repository we will use. The primary repository can be found under https://github.com/Wiznet/WIZ550web. But at the time of writing this article there were some small errors as the case of some letters in file names were different. So on this case sensitve operating systems lead to compile errors. To circumvent this I forked the project and you can therefore clone my repository https://github.com/7tobias/WIZ550web

In case you want to publish your work so to others it would be even better to fork one of the mentioned repositories into your own github account. Then you can push your changes to your own github repository. You should give it a try, it’s very easy – and as public repositories are free, it does not even cost you money.

In the Following I’ll clone my own repsository I forked in github before.

First start eclipse and just go to the “File” menu and choose “Import …”. There you have to select “Git” / “Projects from Git”. In the next dialog you have to choose “Clone URI”.

 

Screenshot from 2015-03-18 15:25:55 Screenshot from 2015-03-18 15:24:19

In the next dialog enter the URI – host and repository path will be filled out automatically. In case you forked the repository to your own github account, you should enter your username and password into this dialog to be able to push your changes later.

The remaining steps are of basically “Next”, “Next”…, and “Finish”

Screenshot from 2015-03-18 15:26:17 Screenshot from 2015-03-18 15:27:15 Screenshot from 2015-03-18 15:27:27

Now you have to click on “Workbench” to see the following window. Now, you are ready and can build the project.

Screenshot from 2015-03-19 09:42:13

by TW