Network Programming

If you want a book on network programming, there are a few classic choices. [Comer’s] TCP/IP books are a great reference but sometimes is too low level. “Unix Networking Programming” by [Stevens] is the usual choice, but it is getting a little long in the tooth, as well. Now we have “Beej’s Guide to Network Programming Using Internet Sockets.” While the title doesn’t exactly roll off the tongue, the content is right on and fresh. Best part? You can read it now in your browser or in PDF format.

All the topics you’d expect are there in ten chapters. Of course, there’s the obligatory description of what a socket is and the types of sockets you commonly encounter. Then there’s coverage of addressing and portability. There’s even a section on IPV6.

Continue reading “Network Programming”

A black and white image of the Sun and Earth with a series of lines radiating out from the sun and bisecting rings circumscribed around it. On the Earth are three dots with the text "Active Server" on one exposed to the Sun and two dots representing "Inactive Server"s on the dark side.

Solar Protocol Envisions A Solar-Powered Web

The transition to low carbon energy is an important part of mitigating climate change, and the faster we can manage, the better. One project looking at how we could reduce the energy requirements of the web to more quickly adopt renewable energy is Solar Protocol.

Instead of routing requests to the fastest server when a user pulls up a website, Solar Protocol routes the request to the server currently generating the greatest amount of solar power. Once a user is on a website, the experience is energy-responsive. Website style and image resolution can range based on the power left in the active server’s batteries, including an image free low power mode.

Another benefit to the project’s energy efficiency approach is a focus on only the essential parts of a page and not any of the tracking or other privacy-endangering superfluous features present on many other websites. They go into much more depth in the Solar Protocol Manifesto. As a community project, Solar Protocol is still looking for more stewards since the network can go down if an insufficient number of servers are generating electricity.

For more details on the project that inspired Solar Protocol, check out this low-tech website.

Internet Of Washing Machines Solves An Annoyance

[Laurence Tratt]’s washing machine blew up, so he sprung for a brand new model with all the bells and whistles. Of course, these days, that means it has an Internet connection and an API. While we’re not quite convinced our washing machine actually needs such a thing, at least [Laurence] is making the most of it by creating an interface to the washer’s API that provides a handy countdown on the computer.

Honestly, there was one other option. The washer’s phone app — that sounds funny when you say it out loud — will notify you when the clothes are done. But it doesn’t provide a countdown, and it seems to regularly log you off, which means you don’t get the notifications anymore. You can see the minimal interface in the video below.

The exact combination of curl, jq, and pizauth probably won’t help you unless you have the same washer. On the other hand, it is a good example of how to hit some alien API and work out the details. Any API that uses OAuth2 and JSON won’t look too different. Speaking of OAuth2, that’s the purpose of the pizauth program — which, it turns out, [Laurence] is the author of.

Of course, you can refit an old washing machine to do this, too. We are more likely to steal the machine’s motor than to want to talk to it but to each their own!

Continue reading “Internet Of Washing Machines Solves An Annoyance”

Screenshot of Wireshark, showing that source and destination port for ArtNet packets are the same

ArtNet Not Going Through? Your Switch Might Be Protecting You

Cool technology often comes at a cost, and it’s not always that this cost is justified. For instance, [Rainfay] tells us about how the the ArtNet protocol’s odd design choices are causing incompatibility with certain Ethernet switches. ArtNet is a protocol for lighting control over DMX-512 – simply put, it allows you to blink a whole ton of LEDs, even literally. Unlike DMX-512 which can use different physical mediums, ArtNet uses Ethernet, taking form of the usual kind of network packets – and it does seem to do a great job about that, if it weren’t for this one thing.

For some reason, ArtNet connections are required to use the same destination and source port – unlike the usual network traffic, where the destination port is protocol-dependent and the source port is randomized. This behaviour violates RFCs, and not just in an abstract manner – such behaviour is indicative of certain kinds of attacks, that switches on the smart side are able and are supposed to prevent. As a result, ArtNet traffic actually triggers some protections on switches at the fancier end, specifically, so-called BLAT protection.

In short, if your ArtNet stream is mysteriously not going through and your switch is on the fancier side, [Rainfay] says you might need to disable some security mechanisms. Sadly, as she points out, this problem isn’t even a direct consequence of some inherent property of ArtNet, but merely a consequence of a bizarre design choice. Once you’re done disabling protections, however, do check out some ArtNet projects for inspiration – it’s a genuinely useful protocol supported in a ton of fancy software, and it might be that you want to use it in the firmware of your RGB strip controller board!

Building A NAS That Really Looks Like A NAS

Building your own network attached storage (NAS) for personal use isn’t all that difficult. A single board computer, a hard disk and a power supply in an enclosure is all the hardware you need. Then, choose from one of several open source NAS software solutions and you’re up and running. [tobychui] decided to notch things up by designing a NAS that really looks like a NAS. It’s tailored to his specific requirements and looks like a professional product to boot. The design features dual 3.5 inch HDD bays, a small footprint, is low cost, compatible with a variety of single board computers, and can handle high data transfer speeds by using RAM and SD card for buffering.

Not only has he done a great job with the hardware design, but he’s also developed a companion software for the NAS. “ArozOS” is a web desktop operating system that provides full-fledged desktop experience within a browser. ArozOS has a great user interface and features a lot of networking, file, disk management and security functions. He has also developed a launcher application to enable over-the-air (OTA) software updates.

Assembling the device will need some planning and preparation, even though most of the hardware is off the shelf. You will need a SATA to USB 2.0 adapter, a SBC (Orange Pi Zero, Raspberry Pi 4, Orange Pi Zero 2, etc) , three buck converters — one each to provide 12 V to the two hard disks and a third to provide 5 V to the SBC. You’ll also need a 12 V / 6 A or 24 V / 3 A external power brick, or a USB-C 65 W GaN charger with a triggering module to set the desired voltage and current.

There is also one custom power distribution board which is essentially a carrier board to mount the buck converters and connectors for power and USB data. For the 3D prints, [tobychui] recommends printing at the highest resolution for a nice finish.

The off the shelf SATA to USB adapter will need to be taken apart before it can be fixed to the 3D printed SATA adapter plate and might pose the most challenge during construction, but the rest of the assembly is fairly straightforward. Once assembly is complete, [tobychui] walks you through installation of the ArozOZ software, mounting the drives and making them accessible over the network.

Have you got your data backup act in order ? If not, it’s still not too late to make it a new Year’s resolution. And if you need help figuring things out, check out New Year Habits – What Do You Do For Data Storage?

Continue reading “Building A NAS That Really Looks Like A NAS”

It’s Ethernet, From An SPI Interface

Over the years as microcontrollers have become fast enough to do the heavy lifting, we have become used to 10 megabit Ethernet being bit-banged from interfaces it was never meant to emerge from. We think however that we’ve never seen one driven from an SPI interface, so this one from [Ivan] may be a first. With a cleverly designed transceiver using logic chips, it even offers a chance to understand something about the timing of an Ethernet interface, too.

The differential logic signals derived from a simple Ethernet transceiver can be read by an SPI bus, but for the lack of a clock line. The challenge was then to construct a circuit the would construct the required clock pulses from the state changes on the data line. This would become a monostable with XOR gate, and a shift register to handle the clock during the preamble phase.

The resulting circuitry fits neatly on a shield for the ST Nucleo 64 board, where while it might not be the obvious choice for an Ethernet shield it certainly does the job.

If unexpected Ethernet is your thing, how about the i2s peripheral on an ESP8266?

Magnetic jack version of the bit-bang ethernet peripheral for Raspberry Pi Pico

Bit-Banging Bidirectional Ethernet On A Pi Pico

These days, even really cheap microcontroller boards have options that will give you Ethernet or WiFi access. But what if you have a Raspberry Pi Pico board and you really want to MacGyver yourself a network connection? You could do worse than check out this project by [holysnippet] that gives you a bit-banged bidirectional Ethernet port using only scrap passive components and software.

This project is similar to one we shared back in August by [kingyo], but differs in that what [holysnippet] has achieved is a fully-functional (albeit only around 7 Mbps) Ethernet port, rather than a simple UDP transmit device. The Ethernet connection itself is handled by the lwip stack. Connection to the RJ45 socket can be made from any of the Pi Pico pins, provided TX_NEG is followed directly by TX_POS, but the really hacky part is in the hardware.

schematic of Pi Pico bit-banged ethernet peripheral
Schematic showing the empirically-determined passive component values required.

Rather than developing hardware that would protect the Pico, this design admits that it “shamefully relies on the Pico’s input protection devices” to limit the Ethernet voltages to 3.3 V.

You’ll need an isolation transformer from some old Ethernet-enabled gear (either standalone or as part of a magnetic jack), but then it’s only resistors and capacitors from there. There are warnings not to connect this to PoE networks for obvious reasons, and the component layout needs to keep in mind the ~20 MHz frequencies involved, but to get this working at all feels like quite a feat.

Normally, there’d be no reason to go to these lengths, but it’s always educational to see if it can be done and, with the current component shortages, this is another trick to keep up your sleeve for emergencies!

Putting ports where they shouldn’t belong is not a new idea, of course.  Back in the day we even shared an inadvisable ATTINY implementation of bit-banged Ethernet with no protection at all.

Thanks to [biemster] for the tip-off