Posts

Showing posts from January 21, 2018

Blink from a webpage

Image
In the previous tutorial we set up a simple web server and responded to incoming HTTP requests with a static web page, this time we're going to have some interaction between the web page and the device. We'll set up a simple web page with a button and when you click that button we'll toggle the LED on the ESP8266.

In the setup function we're going to add some additional handlers for incoming URIs.

Instead of serving up a simple 'Hello World' text response, this time we're pointing the root URI towards the servePage function, in which we'll create a more detailed HTML response.

We've added a second handler for the /args URI and pointed it towards the handleArgs function, this will be used to process the incoming data.

Finally we've added an onNotFound handler, this should respond to all other URIs and direct the browser back towards the root homepage.

The servePage function still only creates a simple response for the client, but this time is is…

TNT Blocks

Image
I've clearly started something now and I was asked to make some TNT blocks, these blocks are predominantly red which leaves some issues for laser cutting. I could have used a red wood but the engraved areas would be a darker red, not the white colour required for the label. The solution was to mask a sheet of poplar and then paint key areas of it red, I used an airbrush to ensure that the colour didn't bleed under the masking. This gives me 3-4 different colours to use, all of the detailing was done with line artwork so that it stood out as a strong black.



Setting up a webserver

Image
The previous tutorial showed how to create a wifi access point but the ESP8266 didn't do anything once a station was connected. In this tutorial, we build upon the previous access point to serve a simple HTML web page in response to a request from a connected station.

The ESP8266 Webserver library implements a basic web server that allows the ESP to respond to incoming HTTP requests without needing to worry about the low level details of the response. Include the library at the top of the sketch with the line

Next we need to declare a new Web Server object using the HTTP port number, 80. This is the default port that a browser will use.

The ESP web server needs to be continually polled to see if anything is trying to connect to the device. This is done with a single call, placed inside the main loop code for the device

Now we have set up a web server to respond to HTTP requests we need to tell it what to respond with. These last few lines create a function that replies to a r…

Minecraft Oak Blocks

Image
While I was in a minecrafty mood, I thought I'd take a look at some of the other blocks to see what could work on the laser. These oak blocks came out ok,  I let the grain of the wood do the hard work as the detailing. It amuses me somewhat that they're made from illomba faced poplar ply instead of real oak. The lettering is done with negative engraving and the font could be a little thicker to make it stand out more.

Setting up an Access Point

Image
In the previous tutorial we covered the very basic function of most micro controllers, blinking an LED, but the whole reason we're interested in the ESP devices is their ability to establish a WiFi connection. There is a library for this and it's very easy to set up. 
The ESP8266 WiFi library has the ability to operate in a range of modes. It can act as a station where it would connect to an existing Wifi network, it can become an access point where it creates it's own wifi network and it lets devices connect directly to it. Finally it can operate in a mixture of both modes which is useful for forming mesh networks
The internet of things is a brave new world where people are putting all kinds of things online, even simple things like lightbulbs can be hacked and turned against the owner, because of this I've written all of my software in access point mode. I'm sure simple common sense could secure these devices on your local network but it's one less thing f…

Minecraft Tokens

Image
These little tokens are made to look like the chests from Minecraft. I made a whole batch for someone as part of an incentive system, each token collected allows 5 minutes of play on Minecraft.