We’ve written lot about the ESP8266 lately, but people keep finding more awesome uses for this inexpensive module. [Martin] decided that using the ESP8266 with an external microcontroller was overkill, and decided to implement his project entirely on the module with a built-in web server.
[Martin] started out with the ESP8266 web server firmware developed by [sprite_tm]. This firmware provides a basic web server that supports multiple connections and simple CGI scripts right on the module. The web server firmware opens up a ton of possibilities with CGI scripting. When booting up in AP mode, you can even connect the ESP8266 to another access point right from the your browser.
[Martin] decided to connect a DHT22 temperature/humidity sensor to the module as a proof of concept. He used a DHT22 library written for the ESP8266 to read data from the sensor, and wrote a CGI script to display the data on a web page. [Martin] also added buttons to control a GPIO pin as a proof of concept. He posted his source code and a binary (see the end of his post) so you can try out his application and mod it for your own project.
We’re no strangers to home automation projects around here, but it’s not often that you see one described in this much detail. [Paul] designed a custom home automation system with four teammates for an undergraduate thesis project.
The system is broken into two main components; the server and the peripherals. The team designed their peripherals from early prototypes of an upcoming ArduIMU v4 measurement unit. They removed all of the default sensors to keep costs down and reduce assembly time. The units can them be hooked up to various peripherals such as temperature sensors, mains relays, RGB color strips, etc.
The central management of the system is performed using a web-based user interface. The web server runs on Java, and interacts with the peripherals wirelessly. Basic messages can be sent back and forth to either read the state of the peripherals or to change the state. As far as the user is concerned, these messages appear as simple triggers and actions. This makes it very simple to program the peripherals using if, then, else logic.
The main project page is a very brief summary of what appears to be a very well documented project. The team has made available their 182 page final report (pdf), which goes into the nitty-gritty details of the project. Also, be sure to watch the demonstration video below. Continue reading “Home Automation with a Custom Wireless Sensor Network”
For anyone who gets a late-night craving for anything out of the refrigerator and needs some help in the willpower department, [Claudio] may have the project for you. He has just finished work on a project that sends out an alarm when the refrigerator door opens, alerting others that you’re on the prowl for munchies.
The device uses a light sensor connected to an OpenPicus IoT kit that contains a FlyportPRO Wi-Fi module. When the refrigerator door is opened, the device sends out an email message via a web server, which can be sent to whomever you choose. All of the project’s code and instructions are available on the project site as well.
The project is pretty clever in that no actual interfacing with the refrigerator is required, beyond running a power cable through the seal of the door (although [Claudio] notes that the device will run on a lithium battery as an option). The web server itself can be set up to send out alarms during any timeframe as well, allowing a user to customize his or her nighttime snacking window. If you’re looking for a less subtle approach, we’d recommend the fridge speakers with a volume setting of 11.
Plenty of folks have used their Raspberry Pi as a web server. [Steve] however is the first 8 node load balanced pi cluster server we’ve run into. While we have seen pi clusters before, they’ve never been pressed into service as a public facing web server. [Steve] has created a really nice informative website about the Raspberry Pi, and Linux in general. As his page views have increased, he’s had to add nodes to the server. Currently [Steve] sees about 45,000 page views per month.
At first glance it would seem that the load balance system would be the weak link in the chain. However, [Steve] did realize that he needed more than an Pi to handle this task. He built the load balancer using an old PC with 512MB of RAM and a 2.7GHz x86 CPU. The most important thing about the balancer is dual network interfaces, one side facing the internet, the other facing the Pi cluster. The balancer isn’t a router though. Only HTTP requests are forwarded. The Pi nodes themselves live on their own sub net. Steve has run some basic testing with siege, however nothing beats a real world test. We figured a couple of links in from Hackaday would be enough to acid test the system.
One of the benefits of writing for Hackaday is the ability to command at will a legion of readers to descend on unsuspecting web servers. Most of the time a server can handle the load of thousands of connections. On the rare occasion, though, a server is turned into a pile of slag and dross to the satisfaction of us here at Hackaday and to the ire of admins everywhere.
Checking to see if your server is still running or not isn’t terribly interesting, though. [Eric] thought it would be cool to have a proper physical visualization of how busy his server is, and ended up using a blink(1) USB-controllable LED to display his current server load.
The blink(1) is a small, USB controlled RGB LED that can be used as a universal indicator light. [Eric] had the idea of plugging it in to one of his servers and having the brightness of the LED change in response to the load on the server. He did this with a Python script that queries the Google Analytics API and returns a value from 0 to 255 in response to how popular his server was in the last 10 minutes.
Of course, there’s always a chance Hackaday could Slashdot his server. In that case, the blink(1) glows a steady red, alerting [Eric] to his popularity.
Last month we posted a tutorial from Hub City Labs on making your own PCBs at home. At the time, Hub City was hosting their hackerspace web site on a tiny vps graciously provided by a member. As you might expect, the throngs of Hackaday readers turned Hub City Labs’ server into a pile of molten slag and made their admin’s hair a little more gray. Their web site is up again, and Hub City provided a tutorial on protecting your server from the ravages of being Slashdotted, Farked, Reddited, and even Hackaday’d.
The solution for the first few hours was to transfer Hub City Labs’ site to an Amazon EC2 instance. Since then, they’ve moved over to a Debian EC2 instance that is able to handle half a million pageviews an hour for a WordPress site.
This amazing capability required a good bit of optimizations. A WordPress installation is set to run cron tasks on every page load; not good if you’re going to see thousands of hits every minute. The guys added define(‘DISABLE_WP_CRON’, true) to their wp-config.php file and set all the background tasks – checking to see if a page should be updated – to a fixed schedule every minute or so. Along with an increase in the WordPress cache, these optimizations increased the number of pageviews an hour from 1500 to 60000.
To get up to half a million pageviews an hour, the EC2 instance was loaded up with Varnish, a front-end cache that really speeds things up.
The result – 375 million pageviews for $15 a month – is more than Hub City Labs will probably ever need. The nature of hackerspace web sites, though – light load until Hackaday, Slashdot, or Reddit figure out you did something cool – means hosting on an expandable EC2 instance is probably the way to go.
Need a tiny web server? [Rob] over on the 43oh forums made an Ethernet booster pack for the very popular TI MSP430 microcontroller. If that’s not enough, [Rob] also put together an all-in-one solution with a MSP430 and Ethernet controller that can be powered by a battery. Along with the web server that fits in just 5k of flash, we’re going to say [Rob] has a very good solution for remote sensing and data logging.
For his Ethernet-enabled 430, [Rob] chose to use the WIZnet W5200 Ethernet controller. This chip communicates with the 430 via and SPI interface and has a hardware TCP/IP stack that supports TCP, UDP, and PPPoE, offloading all the low-level stuff off of the 430 and onto the Ethernet controller.
After the break there are a pair of videos of [Rob] showing off his tiny web server. A few neat features include a full memory dump of the 430, as well as a reading the states of all the pins via an HTML page. If you’re looking for a way to collect data over Ethernet, we don’t think you could do better than [Rob]’s tiny 430-based web server. Also, if you’d like to control a few devices over the Internet, [Rob] included a few optoisolators for lights or appliances.
The code is available on the 43oh forum page, but [Rob] says he’ll clean that up and put it in a Git.
Continue reading “Lightweight web server using the MSP430″