My first serious Arduino project: Ethernet Relay Controller – Day 3

So today marks day 3 in building up my project. I managed to figure out how to send UDP data through Ethernet Shield and send Humidity/Temperature readings through network in UDP.

I decided instead of jumping straight to Relay Switch Controller shield (Which I’ll have to build a half-assed one), I’ll create a server to make sure that I know how to do this.

I struggled with C# a bit. But I only struggled because I thought in a VERY complicated perspective which I ended up done things in a very VERY simpler ways.

So, what happened now?

Well, I didn’t change anything from Arduino side except for replacing and adding few lines.

So the Arduino code changed from this:
Udp.beginPacket(server, Udp.remotePort());
Udp.write("Humidity: ");
Udp.write("\tTemperature: ");

To this:
Udp.beginPacket(server, 8888);

Let me explain the change:
I had to change (Or replace) the Udp.remotePort() to 8888 because my server is listening on that port, not any port.
And I had to change the data transferred from:

“Humidity: HH.HH\tTemperature: TT.TT”
Where HH.HH is the humidity value, \t is TAB, and TT.TT is temperature value


Where HH.HH is the humidity value, \t is TAB, TT.TT is temperature value, and XXXXXXXX is the node’s name

I had to do this because I wanted to name each node (To differentiate between them) and to be able to use String.Split() to make things easier server-side.

I used C# to write the server because, well, it’s easier for me to do a quickie server and for future upgrades.

Here’s a video that auto-refresh the readings.

Next step will either involve playing with more sensors and applying it in real world (As in, moving it to the roof for actual readings). Or, actually start digging the Relay Switch Controller shield part.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.