18 August 2018
I really wish I had more photos of this. I made a sign for a bar that we ran at Vale, we set up a bar right in the middle of the quarry (hence the crates
for moving beer). All good pubs need a sign and ours was no exception. The lettering and outline were coloured using paints, the areas were masked before cutting to allow a neat paint job.
The picture itself was transferred to the wood from a colour printout. There are lots of online tutorial that suggest all sorts of glue to use. The gist is that you print out onto a sheet, cover the whole thing in glue and stick it ink side down onto the wood. Once it has dried, you then wet the paper and slowly rub it off of the ink. The trouble is there is a very fine balance between not rubbing enough paper off and rubbing the ink off. In this case the blemishes work well with the style.
by firstname.lastname@example.org (Martin Raynsford) at 18 August 2018 08:33 AM
16 August 2018
I have a lot of green plastic crates but I wanted something a little more rustic for events. I re purposed some pallets I acquired from the local industrial estate and turned them into these simple boxes. I put some small feet on the bottom that allow them to stack inside each other and they don't immediately slip off the trolley when you move them around. Not laser cut but I do rather enjoy my new mitre saw and it makes chopping planks so much easier.
by email@example.com (Martin Raynsford) at 16 August 2018 10:05 PM
14 August 2018
The culmination of knobs
, bubble rods
were these two new panels to go into the machine at vale.The first panel has all the input devices, when each lever is flipped or slider moved then all the LED's built into the board change colour, the rods change flash rates and the dials also move. Nothing specific just general interaction to indicate that something has changed. The second board is very much like my Stranger Things
messaging systems. The board has 50 leds built into it and they have been shuffled to display letters at random (even I don't know which LED is which letter). You can connect to the board via wifi and use it to send messages back from the machine to the players. It was used last event but I wasn't there to see if it was successful, I hope it went ok.
by firstname.lastname@example.org (Martin Raynsford) at 14 August 2018 06:22 PM
12 August 2018
I made a collection of dial and switches for Vale at the start of the year. I've done similar things before
but this time they're all functional. The plan was to put them all onto a board and allow people to actually interact with the infernal machine this year.
by email@example.com (Martin Raynsford) at 12 August 2018 09:29 PM
11 August 2018
I've had these 15mm bubble rods from Kitronik
for quite a long time, I thought they would look good when side lit. I used a single neopixel on each end of the rod and illuminated both ends with the same colour. The colours slowly fade on/off and at different frequencies. 22mm copper pipe fittings make perfect end caps and the the laser cut adaptors to go between the two.
by firstname.lastname@example.org (Martin Raynsford) at 11 August 2018 07:31 PM
10 August 2018
These demonic seals were cut in ye olde MDF for that genuinely realistic appeal. The disks were painted with metallic acrylic before engraving so it was easy to wipe the dust off. These seals were going to be used as decoration on the vale machine (and were made way back in May)
by email@example.com (Martin Raynsford) at 10 August 2018 06:47 PM
Just a sample for a coaster, I masked the acrylic with vinyl transfer tape before engraving to ensure that I got a good clean cut. I didn't realise it was a coaster otherwise I would have rounded the edges and engraved it on the reverse so that the engraving was on the underside and less prone to damage during use.
by firstname.lastname@example.org (Martin Raynsford) at 10 August 2018 09:39 AM
09 August 2018
This chits were made for the LRP Game, Age of Aether
. I believe the top disk is copper, silver or gold and the larger bottom disk is red, green or blue to denote different groups and weightings. I would normally paint a sheet before cutting but because the exact combinations required were unknown I left them all blank.
by email@example.com (Martin Raynsford) at 09 August 2018 07:25 PM
13 July 2018
In one aspect of Vale I'm making tech
to keep the node system functional, from the player side of things I'm trying to find ways to hit as many nodes as possible and collect all the stuff. While you're waiting at a node it would be really useful to know how long it had been since the node last spawned. There is a 6 hour window for 3 spawns so it's going to be roughly every 2 hours. I thought it would be handy to drop these counters near the node so anyone can update the time then, if you arrive 10 minutes after the previous drop it's worth going on to the next node.
They're based on this wound counter
design but two concentric rings allows me to set the hour and the minutes separately.
by firstname.lastname@example.org (Martin Raynsford) at 13 July 2018 09:13 PM
09 July 2018
I'm deep into fulfilment for my kickstarter puzzles. Roughly 600 puzzles to make in total and I'm turning over about 50 a day which is pretty good progress. Obviously it's leaving me a little bit of time to blog this month which is why I'm catching up on posts.
The high quality BR grade plywood from Kitronik
is really worth the extra money. 1 in 10 sheets has the tiniest of knots but because each ply is only 0.5mm thick it still cuts through cleanly. All the inner layers are equally high standard. If your working on a project that needs better materials this is the stuff to go for.
by email@example.com (Martin Raynsford) at 09 July 2018 07:11 PM
07 July 2018
The fathers day lorry
is very similar to most of the cars we've already done but to really make it feel like a proper truck is needed some mud guards over the wheels. It would be hard to laser cut something directly to go over them but thanks to the vacuum former I can laser cut some moulds and make some plastic arches to go over them instead. Now the arches can be covered with sugar paste to match the rest of the cake.
by firstname.lastname@example.org (Martin Raynsford) at 07 July 2018 07:58 PM
06 July 2018
This item wasn't actually designed or drawn by me, I did help out though. Eli was tasked with designing a Roman shield based on his trip to the Lunt Roman Fort
. He chose to make a horseman shield which is rounded to protect the horses legs. He drew the whole thing in inkscape, picked the colours and we took it to the laser. The wings were actually drawn 7 years ago
so it was nice just to be able to drag the files out of my archives and use them again. The shield boss was made from vacuum formed plastic.
by email@example.com (Martin Raynsford) at 06 July 2018 06:02 PM
05 July 2018
A quick laser cut from way back in May, this cake topper was to celebrate Daniels Confirmation (obviously). The spikes are a little bit fragile and spiky but it only has to go into the cake once right.
by firstname.lastname@example.org (Martin Raynsford) at 05 July 2018 08:05 PM
19 June 2018
Way back in February, Dawn
had the idea of making a cake based lorry in the same style as the Cake cars
we're been doing. It was a great idea but I knew to shift all of the additional weight of a trailer we were going to need four driving wheels and motors. The majority of the weight would be spread over the rear of the trailer so those wheels and axles were put in place with bearings to reduce the rolling resistance. The pivot point was again made with a bearing to ease turning friction. Other minor changes included a reversing beeper and a second set of brake lights on the trailer itself (with curly cable between cab and trailer). The whole thing worked well for this quick demonstration.
The problems came when I loaded the trailer down with any weight. I ran my tests using 10kg of weight which the cab was able to pull but the steering was totally ineffective. All the weight was pushed into the drive wheels making the steering light, the sheer power of the four motors just ploughed the cab on in a straight line. At this point I was lucky with some previous design decisions. Using different motors for left and right wheels allowed me to implement a software differential between the wheels. By making the left turn faster than the right, the whole cab will steer right regardless of what the steering is doing. A little bit of tweaking got the two to line up so that the whole thing turns the right amount based on the user input.
This major problem with the lorry has been back propagated through the cars. It was only a minor issue on the cars but now it's completely gone and the cars drive much better because of it.
Dawn eventually turned the lorry into a Carlsberg van
capable of dispensing beer (from a 5kg keg) hidden in the back and it's probably the best fathers day cake in the world.
by email@example.com (Martin Raynsford) at 19 June 2018 07:16 PM
18 June 2018
My Kickstarter puzzles
all need to be dyed and oiled before I can put the final assembly together. Obviously they can't be stacked up while they're drying so making a drying rack to store all the sheets without touching each other seemed to be a sensible idea. The whole thing was coated with some spray lacquer to stop the burnt edges of the rack marking the sheets. The whole thing works just as intended.
Another tool for the job was made without going anywhere near the laser and it's as simple as a stack of wood. A dozen planks of ply were cut to each hold a single puzzle and it's pieces. The front panel of the puzzle gets glued to the back panel and the whole thing is put on the bottom of the stack. The weight of the boards, stiffness of 12mm ply plus some extra weights from my screw boxes hold all the puzzles perfectly flat while the glue dries. When the puzzle comes out of the top of the stack it's ready for it's paper coating and it can then go in the pile of completed puzzles. Simple but effective.
by firstname.lastname@example.org (Martin Raynsford) at 18 June 2018 08:46 PM
12 June 2018
From Shadows LRP
ran it's first event at the weekend and by all accounts everybody appears to have had a good time (I was really quite keen to attend but sadly couldn't, true story). I did manage to get all of their currency cut in time though. I had previously made
a few sample to demonstrate what was possible and I made a few tweaks on the final set. The colours now run in rainbow order which makes them a bit more cohesive and it allows me to keep the blue fluorescent for a higher value. I also rounded off the corners a lot more, the previous ones were a bit sharp. The tessellating design allowed me to cut whole sheets at a time with minimal wastage and even though there were a few alignment issues with the number engraved on the reverse it was still visible through the window so just about acceptable.
by email@example.com (Martin Raynsford) at 12 June 2018 08:31 PM
09 June 2018
The previous displays
I made for Vale
were pretty straight forward, an arduino nano
was connected to a DS3231
real time clock chip and at the appropriate time they displayed a number on an LED matrix display
. The whole thing was powered from the mains with a 5V PSU. This year they wanted the same thing, but on the nodes, out in the quarry and this mean battery powered and waterproofed, there had to be some fairly significant changes to the system.
Firstly, if you want a battery powered item to last for a whole weekend, LED's are a bit of a no go. They're quite power hungry and illuminating a whole display of them is going to eat through batteries. The other problem with LED's is that they can be hard to read in the sunlight and blinding in the darkness. ePaper displays
however can be read in direct sunlight, can be illuminated with a torch and many only consume electricity to change the image. They seem ideal for an application like this. I opted for these waveshare 2.9 Inch epaper modules
, no particular reason but they fell into a price bracket and are large enough to display a decent number.
The next design choice was to use the arduino pro mini
instead of the nano. The nano has a built in USB->Serial device this chip is always on and always consuming power, the Pro mini uses a separate device to program the controller so it takes less power. The pro mini has several options too, I needed the ATmega328P for the extra RAM and memory but epaper display runs on 3.3V and the 3.3V pro runs at a slower clock speed uses less power than the 5V version so that seemed a sensible choice.
The DS3231 RTC has it's own battery back up and is designed to run at extremely low power for years. The prototype used the same clock from the previous display and it's still accurate after a year. The controller only needs to change the 12 times in a whole day so it'll also be in low power mode most of the time. The ATMega is able to wake itself up from a deep sleep using it's own internal timer but that has a maximum delay of 8 seconds, longer periods of sleep are often achieved by adding those together but there is a better way.
The DS3231 has an alarm mode, you can program with a specific date and time and when the clock gets to that time it will change the state of one of it's output pins. This signal line can be connected to the interrupt line on the ATMega and used to wake the arduino up. This means the controller will only be awake once every two hours to change the display and then it can go back into deep sleep again. Finally, both the pro board and the RTC chip have power LED's on them, by physically removing the LED's on each of them the whole system should be reduced to a very minimal power consumption.
There are many incredibly useful discussions
online about the different things you can do to reduce the power consumption of these board. A deep sleep mode with an LED consumes around 3mA, without the LED that's down to 30uA so 100 times less power. After some simple testing and current measurements, my estimates suggest that, given a screen change every 2 hours, the 3x AAA batteries in each node should now last for around 1000 hours, more than enough to cover the 60 hours they're required to run over the course of a weekend.
As for making them waterproof, well I would say they're water resistant. I would go hosing them down with a pressure washer but when they're mounted under a lip of a box or on the trunk of a tree they should be fine. There is a window of 3mm acrylic in the front of the box, this is sandwiched in 3 layers of birch ply and glued in place the overlaps should stop any ingress there. The box has standard finger joints held with liberal amounts of glue, not ideal, but inside the box these seams were closed with lots of hot glue any leaks directly through the fingers should be stopped by that. The back of the box, where the battery access is, was held on with 4 screws. It's finger joints again but there is a 3mm plate with protrudes into the box which means the inner isn't directly exposed to the joint. This should be ok when the boxes are mounted on that surface.
Next time I'll give a breakdown of the code used to drive the boxes. I had to make a few interesting choices there to make it all fit into the space available.
by firstname.lastname@example.org (Martin Raynsford) at 09 June 2018 08:49 PM
06 June 2018
I ramble about Vale
on the blog
quite a lot, it's kind of hard to explain LARP to someone it's much more about being there than talking about it. I've talked about nodes and games and so on but here is the crux of the whole thing. Vale LRP is played in the vast 170 Acre site of Huntely Wood
, it's a former quarry so it has woods, lakes and some serious slopes. There are two camps for two different sides of a war, the shortest route between the two camps is 1km, the long path between the camps is 2km and you can extend that exponentially if you go down all the side paths.
Out in the Vale are a bunch of different 'nodes'. These strong boxes contain game items that can be collected at various points throughout the day. This is intended to encourage groups from both sides to wander around the site and potentially bump into each other and ultimately fight over the prizes. Each section of the node is locked with a combination padlock and can only be unlocked with the right code.
Last year I made some devices
that release the padlock number at a specific time, these could be loaded with a whole weekend of numbers and alleviated all the manual effort of giving out numbers at the right times. This year the number system was changed to put different numbers on each node and also to give out the numbers at the nodes. This means people have to wait out in the Vale for the numbers to appear rather than waiting in camp and trying to run to the node fastest.
The next post is going to be about the new number displays and the complications that went along with them.
If anybody would like to come along to an event then I would be happy to help set that up. New players get a very reasonable rate and I can easily put together some costume bits for you.
by email@example.com (Martin Raynsford) at 06 June 2018 07:00 PM
05 June 2018
I quite like to be challenged with commissions and this one certainly did that. I was asked to make a black briefcase to hold potion bottles. It also needed some space underneath it to hold cable ties and cards and other things that might need to be attached to the bottles. The whole briefcase had to be black (although I think the brown edges add to the appearance). A red cobra logo was requested for the lid, the red wood was inlaid through the lid so that the logo showed through the lid and could be seen from both sides.
The suitcase could hold 50 potion bottles and the lid closed down tight enough to stop the bottles from rattling around. The handle was built into the racking system for the bottles to ensure that it was strong enough to pick the whole case up. The hinges were laser cut which required me to add some small feet onto the bottom of the case to allow it to stand on end.
by firstname.lastname@example.org (Martin Raynsford) at 05 June 2018 08:39 PM
01 June 2018
Another year on
and I got to make the rune tags for the LRP Hospital again. I like to bring a little variation to the design so this year I gave it some shape as well as the year number.
by email@example.com (Martin Raynsford) at 01 June 2018 09:49 PM
31 May 2018
I believe these stencils were used to airbrush the logo on cub scout blankets. Given that there are lots of cubs and these stencils wouldn't be needed for more than a weekend it made sense to knock up a dozen from thin card instead of mylar.
by firstname.lastname@example.org (Martin Raynsford) at 31 May 2018 10:59 PM
At the time of writing my Kickstarter campaign
has nearly 200 backers which means I need to make about 500 puzzles in June. With those kinds of orders it's worth making some jigs to help speed the process up. First thing for me was this large tape dispenser. Each puzzle gets a covering of vinyl transfer tape to protect it during transit but also to hold all the pieces in place. The roll is 200mm wide and 100m long so it needed something a bit more sturdy than the average tape dispenser. M8 bolts and bearings were salvaged from a very old CNC machine I built (before I bought a laser cutter). It's overkill but at least it's effective.
by email@example.com (Martin Raynsford) at 31 May 2018 05:37 PM
30 May 2018
My kickstarter campaign
received a very welcome boost yesterday when it was reviewed by Mr Puzzle on you tube
. I now have twice as many backers as I did yesterday which is a great boost for me. This also led to a discussion about other space filling curves and ultimately a new puzzle for the collection in the form of the Terdragon curve. I will release this file in due course but it seems only fair to keep it as a kickstarter exclusive for now.
by firstname.lastname@example.org (Martin Raynsford) at 30 May 2018 10:03 AM
22 May 2018
While I'm slowly piecing together all the different projects I've been working on over the last few weeks for blog publication my Kickstarter
for fractal puzzles has been slowly ticking away in the background. It even reached it first stretch goal and I'm now offering the same puzzles with a Mahogany or Oak dye to add a bit of a colour.
It's not too late to join in if you fancy it and if you act quick you'll notice that one of the early bird rewards has become available again due to dropouts.https://www.kickstarter.com/projects/680177334/wooden-fractal-tray-puzzles
by email@example.com (Martin Raynsford) at 22 May 2018 07:01 PM
12 May 2018
A while back I found myself on one of Dinkydoodle Designs cake course where I made a moving BB9 cake
, it taught me a lot about the cake making process and I used a lot of that knowledge in making this new Toothless
Dragon cake. The electronic parts are simply a servo, arduino, neopixels and a sound recorder, all fairly common parts but I learned a lot making/baking my own cake.
A 9 inch round cake was baked
, cut and modified to form the basic shape required. Two crescent shapes were cut and moved up to form horns, the two eye sockets were added to the cheeks to pad them out a bit.
Chocolate Silk sugarpaste
The cake was covered in chocolate ganache
to smooth out the lumps and bumps and firm the design up. Larger dollops of ganache further filled the gaps between the horns and the head.
was used to cover the whole cake. A large rolled sheet was stretched into place, smoothed and trimmed down to the board.
Details were added using rolled up balls of sugarpaste as scales and modelling tools for dimples and nostril details. This part of the cake stops at the top lip so I didn't need to worry about adding a mouth.
The whole cake was sprayed black. I used a water based airbrush paint but I'm informed an ethanol based colour would have gone on better and dried faster. It did suffer from a little beading on the surface but that all kind of added to the dragon skin texture.
The eyes were inserted into the cake at this point, made from white sugarpaste
, they were painted green with a brush to deliberately add converging streaks. The black iris was sprayed on top using a hastily made stencil and the shiny spot made by masking off a tiny square before doing that.
Eye lids were added over the top of the eyeballs and the whole thing touched up with more black spray. There was a little over spatter from my poor painting skills and some black streaks up the eyeballs from the paint brush but they all added to the details on each eye.
A lower jaw, row of teach and tongue were formed onto the moving base plate for the whole cake. An adafruit neopixel stick
was placed into the back of the mouth to illuminate the mouth when it was opened.
A 12 inch board was covered with more sugar paste and effort was made to make it look like paving or a rock formation.
The Toothless head and jaw mechanism were added on top of the board, the mains power supply and Arduino were hidden in a cardboard box under the board, which tidied the whole thing up somewhat.
Hazel absolutely loved it and it went down very well at her party this weekend. The death by chocolate cake is very tasty.
by firstname.lastname@example.org (Martin Raynsford) at 12 May 2018 10:35 PM
10 May 2018
My kickstarter campaign
has now been running a week and has a healthy number of backers, there is still time to grab one of the rewards though and get yourself a puzzle.
If you like my blog then please do share the link on your own social media channels for me. I'm going to have a busy June making puzzles but it's definitely a good way to be busy.https://www.kickstarter.com/projects/680177334/wooden-fractal-tray-puzzles/
by email@example.com (Martin Raynsford) at 10 May 2018 03:52 PM
04 May 2018
I launched my kickstarter yesterday and this morning I awoke to discover it was 100% funded. This is great news so I shall now be making a bulk batch of Fractal Puzzles for people. There's still lots of time to get involved though, I'm even open to stretch goal suggestions if anyone has any ideas.
by firstname.lastname@example.org (Martin Raynsford) at 04 May 2018 08:01 AM
03 May 2018
I have just launched a Kickstarter Project
for the fractal tray puzzles I made many moons ago. These tricky little puzzles are going to be made of BR Grade Birch Plywood and sanded to a fine finish before polishing with Danish oil so they'll look really good. I'm pleased to be offering them in this high quality finish and fingers crossed the campaign will be successful.
For my regular readers with their own lasers who saw this many moons ago, I would ask that you please share the Kickstarter link somewhere so that I stand a chance of success. The more people that see it, the better.
by email@example.com (Martin Raynsford) at 03 May 2018 11:02 AM
30 April 2018
I don't mind admitting I was a little bit unsure about Maker Faire this year. I felt like it came around really quickly and I hadn't actually made that many new things since the previous year. I don't like showing the same stuff off again so I had to wrack my brains about something new to take. Clearly I was having a dumb moment and I ended up taking Dawn to the Faire
and a selection of the cakes
we've been working on. I needn't have worried Dawns work is fairly unique in maker circles and throwing in some moving designs was enough to gain a blue ribbon.
It was great meeting so many blog readers and old friends, thank you all for coming over to say hi. I shall endeavour to post more of the things I'm actually making as soon as I'm able to rather than leaving it all for months. Hi to all the new people just tuning in, hope you don't get too lost down the rabbit hole of previous posts (check out the gallery links at the top of the page).
There's is one thing I won't miss now that this years Maker Faire is over.
"These are our remote controlled cakes"
"Is that really a cake?"
"Is that one a cake too?"
"How about that one?".... and so on.
Finally proof for anyone who asked for it, I did make it out to the Angel of the North by 7am on Sunday morning, a nice simple 10 mile run if anyone fancies it.
by firstname.lastname@example.org (Martin Raynsford) at 30 April 2018 08:11 PM
19 April 2018
The final piece I made for the Vipers LRP event last month was this monument. I've made a similar display case
before so we were trying to improve upon that one. This time the monument could only be opened once all the corresponding rune keys were in place. As the keys were scattered around we thought it would be cool to make them glow when they were inserted into the monument. Some simple LED and microswitch arrangement, side lit the perspex runes. The runes were supposed to be easy to insert and hard to remove. The body was made with ply but painted with a stone effect. I don't believe it fared particularly well in the weather and could have done with a coat of sealant but I shall learn for next time. I even managed to pick up an action shot of this item too.
by email@example.com (Martin Raynsford) at 19 April 2018 09:10 PM
18 April 2018
A quick tray puzzle I was asked to make for a LARP event. I assume once all the events were placed in order some kind of secret was revealed. The arrows ensure that the pieces are put in the right way round and show which direction time travels, the events were jumbled before cutting so that the grain didn't give any clues.
by firstname.lastname@example.org (Martin Raynsford) at 18 April 2018 08:07 PM
16 April 2018
I've come to the conclusion that I just don't need 3 laser cutters and I don't have space or time for them all anyway so I'm going to have to let this one go. It's barely been used, we bought it with Just Add Sharks and then never used it. I haven't used it for 6 months.
It comes with RD works and should be compatible with Lightburn
which is what all the cool kids are raving about. It's also got a really lightweight head so it's super fast. I wish I had more time to play with it.
If you're interested, it's up on ebay, try to snag a bargain.https://www.ebay.co.uk/itm/Kent-Laser-Solo-40W-C02-laser-cutter-600x310mm-RD-Works/282927236074
by email@example.com (Martin Raynsford) at 16 April 2018 11:44 AM
04 April 2018
Over the laser few weeks I had the joy of making some props for a LARP event. The first was 4 large wells/portals which specific inscriptions upon them. This was largely a woodworking project made from an old pallet, the inscription stones were engraved upon the laser and each stone was weathered using a hot air gun to give it a burnt looked. Some plastic sheet and lighting gave it the effect of being filled with water but it also made them waterproof so that actual water could be put inside them.
As the event has now happened I even spotted some photos of the items in action.
by firstname.lastname@example.org (Martin Raynsford) at 04 April 2018 09:41 PM
21 March 2018
Now that I've really got to grips with the ESP8266
I can start to use it in various projects. This one has been on the cards for a very long time and there are already lots of projects doing something similar here's my effort. For anyone still not sure what it is, Stranger Things
(season 1) is a tv series about a missing boy, who at one point, communicates with his mum through the medium of fairy lights. This is just a fun way to spell out messages for people but it's wifi controlled so any old phone can set up the messages to display.
These displays are now available in my store as kits or working items, should you want to build one for yourself or read on for further details.
The project is based around some 12mm WS2811 RGB led's. The 12mm lights have a lot of diffusion are easy to mount in holes and don't have to be spaced evenly apart making them ideal for quick installation in a back board like this. The board is 3mm birch ply with a mixture of engraving and line artwork to still give the appearance of fairy lights. (svg here
The controller is the Wemos D1
, I have run a capacitor between the 3V3 and Gnd to filter out any power supply noise to the ESP8266 (much more important when driving motors). The LEDs connect directly to pin D1 on the device and are driven using the FastLed
library. The whole thing is powered from the USB connection, if you intend to crank the LED's up to full brightness you probably want to consider an appropriate external PSU that can handle the required current ~1.5A. In this demo the lights are set to <1% brightness and they're still perfectly visible.
The HTML input for this project is so simple I decided not to serve a whole web page from SPIFFS
. It's actually just a few lines that can easily be served from a string. Below you can see that it's just a text box and a submit button. The text box is restricted to 49 characters so as not to overload the input buffer on the ESP but this limitation could be easily removed by keeping the data as a string.
The ESP code is also fairly straight forward, the device is configured to start it's own wifi network
with a given SSID and password. It then sets up a webserver
to supply the browser with the input page. Finally it responds to an incoming message
by saving the data and replying back to the browser with the new message
Most of the interesting things happen in the main loop, firstly we use the fastled library function "EVERY_N_MILLISECONDS" to process our code once every 350 milliseconds, this is a non blocking function and leaves the controller free to deal with the webserver and dns for the rest of the time. Every 350 milliseconds we rebuild a string of colours to display to the lights. Firstly we decide if this is an even or an odd loop, the coloured lights should be on all the time but the displayed letter should flash on and off. I've used a simple list of 4 different colours, LED 1, 5, 9 etc will always be red and because the middle row of lights is reversed the pattern isn't blindingly obvious. Every other loop we simple increase the brightness of the letter we're trying to display. This leads to the first problem though, because the middle row of LED's is reversed it's not as simple as saying A=1, B=2.
The solution is to map letters to LED's, the code currently has 2 sets of mapping functions in 2 different methods. The first is to map the letters A,B,C to the numbers 1,2,3. In the ASCII standard
A=65 so it's a simple subtraction but it allows us to map the lower case characters to the same place since a=97. After this first mapping process we end up with the numbers in a standard we're used to. The second is to map those numbers to specific LED's, we could do it with simple subtraction again (because it's only one row that is reversed) but this time I opted to create an array of 27 characters and assign each letter individually. This offers greater flexibility with wiring, with this method I could go up and down with the lights or any random order I chose.
Full Source code here
Improvements could definitely be made in the colouring of the lights, the main loop itself doesn't need to know what colour each pixel is so the colours could all be chosen in the setup function and each loop through the main code simply increasing the brightness of a pixel or decreasing it to turn them 'on/off'.
by email@example.com (Martin Raynsford) at 21 March 2018 02:41 PM
17 March 2018
Everyday Electronics magazine is something I have fond memories of from my childhood. Much of the practical knowledge I have of electronics originated from things I read there or stuff I tried to make (some of it DID work). For many years my parents kept-up a subscription for me until sometime in the late-80s when I outgrew it.
There is quite a lot of info online about EE’s sister publication Practical Electronics (which it would eventually merge with to create Everyday Practical Electronics) but I can’t find a lot written about EE. Recently I saw an edition of EE that recognised as one I originally owned in a second hand shop. At 20p it was an easy decision to take home.
EE always put a bit of effort in to the cover which is one thing that makes them memorable. This one with the dodgy looking vicar and his assistant is perhaps memorable for the wrong reasons. The projects are typical of what I remember – endless variations on simple circuits with oscillators, discreet transistors, 4000-series CMOS and op-amps. Even the cover project isn’t that exciting, though if you were in the market for an electronic wheel of fortune I guess it would do the job. They might have been basic and (whisper) not terribly useful but building them was still a great way to learn practical skills.
The features are quite interesting and remarkably well considered in terms of content. Magazines like EE were the main source of information in the pre-Internet era and you can almost see how the different features mirror popular Internet content today. In “For Your Entertainment” Barry Fox makes some interesting comments on the current state of flat-screen displays before getting side-tracked in to a discussion of Sinclair’s doomed flat CRT project. The government didn’t half invest in some rubbish projects in those days. Some of the features do hint towards the tide of consumer electronics that would spell doom for much of the old hobbyist world. Another glimpse of the future is the side-bar on direct broadcasting by satellite in “Radio World”. The introduction of DBS as a platform for Sky TV was a huge step towards today’s media landscape.
As a child, my favourite regular feature became “Counter Intelligence” by Paul Young. I liked his witty, caustic and grumpy musings on life in the kind of corner electronics shop that was already finding times tough. I remember that dad used to take me to a shop in Leicester staffed by blokes in beige lab-coats stocked with thousands of components in tiny draws. They hardly ever had exactly what you wanted but could usually produce something that would do the job.
The adverts are a real blast from the past. Many of them seemed to run unmodified for years and years. The spiv zapping his light and the odd boy with his crystal set were almost permanent features. I imagine J Bull (Electrical) always doing deals on vast lots of unwanted items and then finding enticing descriptions to sell them off to the unsuspecting.
So, for anyone who, like me, wants to wallow in nostalgia, or just see what the old days were like here is Everyday Electronics August 1981.
by Iain at 17 March 2018 06:21 PM
12 March 2018
During the wifi configuration tutorial I described a method to provide a firmware reset in the case that you forget the user name and password using an additional button (or wire loop). I also lamented the problems of the Wemos D1 board not being able to distinguish between a power cycle and a button reset. Today I'm going to discuss another way to achieve a firmware reset of the device without the requirement for any additional hardware. The method itself is quite simple and we have already used all required parts for the wifi configuration program.
The first thing the device should do when it starts up, is set a flag in the non volatile memory and after a given period of time it should clear this flag again. Now if the device is reset before it has the chance to clear the flag we can tell that the reset button has been pushed twice in quick succession and use that as an indicator that we want to perform a firmware reset.
There are a few items to declare at the start of the program, we'll be using the EEPROM library to write the flag to a memory location that is remembered between boots. The flag is stored as a 4 byte value and should have two different states, these should not be zero because that is the default value for EEPROM, I have chosen 0x55 and 0xAA as they are alternating bit patterns but the actual values are fairly arbitrary. Finally we should declare a memory location to store the value and a length of time to check the value.
There are two helper functions used to access the EEPROM. CheckFlag looks at the memory location for the flag and returns true if the flag is set. WriteFlag puts a new value in the memory location, don't forget to call EEPROM.commit() which is specific to the ESP devices, this is the function that actually writes the data to the memory locations.
In this example we're going to be using the Serial port and built in LED to indicate the state of the device so those should both be set up immediately. For the EEPROM library to work you need to tell it how many bytes of data it is going to be using. This EEPROM.begin step is something I miss all the time with infuriating results. Next comes the actual checking of the flag, if the flag is still set from the previous boot cycle then we know that we need to perform a firmware reset, in this example we note the state by turning on the LED. If we perform a firmware reset we should clear the flag now so as to avoid a double reset situation. If the flag is not set then we should turn it on now.
Finally there is a little delay loop which waits the given time before clearing the flag, I've added this as a blocking delay at the end of setup because I don't like the idea of my main loop performing a redundant check for the rest of it's execution. It could easily be implemented as a non blocking check
in the main loop though.
Now when you download and run the program, if you click the reset button twice within a 3 second period you should see the LED turn on indicating a firmware reset state. As usual the full code is at the bottom.
by firstname.lastname@example.org (Martin Raynsford) at 12 March 2018 12:10 PM
06 March 2018
This is a set of wooden templates and tokens for the game 'Grasslands'
. The game itself looks like a lot of fun and I like the idea you can get started with any old die cast toys. I loved the new mad max
film and this looks like it fits right into that genre.
by email@example.com (Martin Raynsford) at 06 March 2018 09:26 PM
05 March 2018
I had a request about 3 months ago for a set of tak
. The design isn't very complicated so when I actually remember and finally got round to making it this evening I thought I could at least make it look like it took a while to build. I rotated the grain for each tile on the board so it has a slightly different shade for odd/even tiles. The diamonds were cut separately, painted and then inserted on the diagonal. The tak stones themselves were made from 9mm ply which allows them to stand up and a quick capstone was made by stacking 6mm ply. (svg here
by firstname.lastname@example.org (Martin Raynsford) at 05 March 2018 11:51 PM
01 March 2018
I made this hourglass prop for world book day for a Discworld death costume. It's mostly made from 6mm ply but the 'glass' sections are made from 2l fizzy bottles and the 'sand' is rice died blue. It's a little bit sticky because the centre hole is a little bit small but that's actually quite good that someones entire 'life' doesn't pass from the top section to the bottom section instantly.
Hazel decided to go to school dressed as Little Lou and the Woolly Mammoth. All I had to do was make a sew a pocket onto her dress, my wife had the clever inspiration to make the Woolly Mammoth from a knitted poncho and a dozen elastic bands.
by email@example.com (Martin Raynsford) at 01 March 2018 02:04 PM
28 February 2018
In Part 1 of the Wifi configuration tutorial
we learned how to set up the device to read/write from non volatile areas of memory so that we can recall a new wifi ssid and password between reboots. In Part 2 we're going to provide an interface that allows you to set the new values from a web page. This tutorial is a combination of all the previous parts so I'll include links to the relevant parts rather than run through it all again.
The one part we missed from the last tutorial was actually creating a wifi network. We need to include the ESP8266Wifi library and open up a new access point.
Do this after loading the new wifi values to ensure the network has the correct name.
The next step is to set up a webserver
to provide pages to the user. We're going to create a default index page that's just simple text. For the tutorial this will serve to point the user in the right direction for the admin functions but in a full program this would be whichever page you like. We're also going to set up a static handler to serve the page 'admin.html' from SPIFFS
and finally declare a handler to deal with incoming arguments from the admin page
With those parts implemented we're now ready to actually create the user interface. We're going to take a departure from the Arduino IDE at this point, all of the interface can be written in html
to perform some basic data validation before it gets sent to the ESP device. There are lots of online editors to aid development of html pages but I found JSFiddle
to be very useful. (although you'll have to manually switch to the results tab on the following script to see the output)
Once the form is successfully filled out it will POST
a series of arguments to the ESP device. The form only needs to contain new ssid or new password information, and it is only input data with a name attribute that gets sent so we should be seeing upto 3 arguments, 'oldpassword', 'newssid' and 'newpassword'. Our handleAdmin() function will be sent the incoming data and it's ready for us to process, lets take a look at that function.
The first thing we do is look at all the arguments and pass them out to the serial port, a handy way to make sure that we're sending the values we think we're sending. The web server library has more specific functions that allow us to check and see if a specific arguments exists before we try to process the data. We can pass the argument name to the web server using the 'hasArgs()' function and check to see if the old password has been supplied. The first test is to make sure that the password matches the one we're currently using, if these don't match we should ignore all the rest of the data.
If the password matches we then need to copy the values from the newssid and newpassword arguments into our own variable. We can check at this point that the arguments are also the right length (and if they're not greater than zero they don't exist at all). We copy the new values over to our config variables and store them to EEPROM, it's as simple as that. It's polite to let the user know if there was success or failure at this point so we construct a short html response string with the pass or fail result, being html we can also add in a browser redirect back to the main page. I have looked at performing an automatic reboot at this point to start using the new values but the Wemos D1 doesn't appear to restart correctly, this is probably something to do with the USB serial device and the arduino programming.
Here is the whole program, the next step would be to roll all of this access point configuration into a single library that could be easily imported into any project.
by firstname.lastname@example.org (Martin Raynsford) at 28 February 2018 08:31 PM
26 February 2018
By request I made a stencil as large as possible. This 600x900 sheet of mylar filled my entire bed and took a whole 2 hours to cut the fine detail out of. I believe it's going to be used to apply a pattern to fabric for a cosplay outfit.
by email@example.com (Martin Raynsford) at 26 February 2018 11:07 PM
25 February 2018
So far with the ESP8266
modules we've been using the same network name and password, these values have been hard coded into the program for ease of use. Now imagine that we had a dozen devices all running at the same time, all trying to set up the same wifi network (and yes I realise by using the mac address as part of our SSID
we have avoided this problem). The solution, that we're going to talk about today, is to allow the user to configure the network name and password. This is simply good practice as anyone who has logged into a device using 'admin' and 'password' should realise.
The first step is to find a way to store the new values in a way that they will be remembered while the device is turned off, and then be able to load that information when the device turns back on again. On a standard Arduino we'd use the EEPROM
which would allow us to write data to a specific type of memory that requires special electrical conditions to be programmed and that retains the information between boots. On the ESP8266 we use exactly the same EEPROM library but it only emulates EEPROM and it actually writes to the flash memory instead (the same place we store the program data to).
The EEPROM libraries
do all the hard work of writing to the correct registers within the device but older versions of the library would only read/write single bytes of data to/from the EEPROM. This led someone to create the EEPROMWriteAnything library
, this library allows you to define a single data structure
that contains all the information you want to store and write it in a single operation. That seems like a lot of preamble but hopefully it'll start to make sense once we put it all together.
The first thing to do is declare a data structure to hold our information we also create an instance of the structure at the same time called 'config'. The structure has two strings of data, one to hold the name of the network and the other to hold the password. Both the password and name can be up to 16 characters long but each string needs to have a null ('0') character at the end so we make byte arrays that are 17 bytes long. We can also give this information default values at the point of decleration.
This now gives us a way to store our information in volatile ram, meaning it will be forgotten at reboot. When the program starts, we want to load this information from the EEPROM overwriting the default values but this puts us in a bit of a catch 22 situation. At some point we need to write this information to the EEPROM before we read it. My solution also doubles up as a firmware reset should you ever forget the wifi password.
As part of the setup function we can initialise one of the input pins to be a reset indicator ('D1'). By pulling the GPIO pin low we can rewrite the password and network name upon program start, this should be done the first time the device is started but it can also be done any time the user requires it. This is akin to holding down a reset button on any electronic gadget while it boots. If the device detects the reset pin it writes the default values to the EEPROM, in both cases the device then reads the values back from the EEPROM before creating a new wifi network. The values are output to the serial port which is not particularly secure but if you already have a physical USB connection there are worse things you could do with the device.
My test setup just has a wire link connecting between D1 and GND, and D1 is configured to use the pullup resistor to provide the high voltage 'on' signal. I spent quite some time on a detour trying to use the built in reset button on the wemos board to provide the same function. It is possible to distinguish between a 'button push' reset and a 'power on' reset but the USB->Serial device (CH340C
) is tied into the reset pin to enable the arduino bootloader to reprogram the ESP device so pushing the reset button makes it appear like a power on reset. My detour only identified the problem and I haven't found a solution for it yet.
So that's part 1 of wifi config, we initialise some memory and store some default values to non volatile memory, recalling them at program start and a method for restoring the default values should the password be forgotten. The next part will be to provide a method for a user to actually change the values in eeprom.
by firstname.lastname@example.org (Martin Raynsford) at 25 February 2018 07:51 PM
19 February 2018
This was a new, clean honeycomb first thing this morning, now at the end of the day it's as dirty as ever. Wood is inevitably messy but it's also a little warped so you need the steel honeycomb so you can hold the wood down with magnets
by email@example.com (Martin Raynsford) at 19 February 2018 10:06 PM
18 February 2018
I tried the same style again
but this time I used an outline to show me where to paint the colours and I ended up with a slightly nicer colour wash. The grain of the tree is also 90 degrees out from the grain of the backboard which is a nice effect.
by firstname.lastname@example.org (Martin Raynsford) at 18 February 2018 02:19 PM
16 February 2018
I saw a discussion about how to make these kind of tree cutouts with multiple leaves, it inspired me to give it a try. I've included the process in photos below. People seem to use this style for wedding gifts and family trees. I tried to add some graded paint effects, I think I used a bit too much paint to start with before I started watering it down and spreading it to the edges. The next one will be better.
Start by cutting out the blanks for painting, I also cut out the tree trunk because it's going to be a different colour.
Paint the blank and the tree trunk, I tried for a colour wash effect so that there is some colour gradient across the piece.
Put the painted blank back into the laser cutter and cut the shapes from it, you can see I have already switch the red tree trunk for the brown painted one.
Tape the cut shapes back into the board so that they can all be lifted out of the laser as a single piece.
Glue the back of the cut shapes being careful not to get any glue on the frame.
Finally secure the glued,cut parts onto the back board and carefully remove the frame to reveal the finished item.
by email@example.com (Martin Raynsford) at 16 February 2018 01:24 PM
13 February 2018
I've been wanting to make an interesting clock variant for some time now and I thought it would be cool to have each digit represented by an analogue gauge, so here is my design for an alternate clock. The top two dials represent the hour (in a 24 hour format) and the bottom 2 dials represent the minutes. The whole system is run by an Arduino
connected to an I2C Real Time Clock module
and an I2C PWM Servo Driver
. Having both the RTC and the Servo Driver on I2C
, is definitely a bit of overkill for this simple project but it does leave a lot of IO free for future expansion and the servo control is exceptionally steady (no jitter)
The dials are made from a combination of laser cut wood (stained dark) and perspex. Each dial has a white perspex backing which has been engraved and infilled with acrylic paint to achieve a high contrast on the numbers. There is a second piece of clear perspex over the front of each dial to enclose the pointer and stop small fingers from touching the moving parts. The dials are mounted on a 6mm plate which is tilted backwards about 10 degrees which makes the whole unit fairly sturdy. The electronics are mounted onto the back of the board using small self taping screws on the appropriate mounting points for each module (svg here
The software to drive the whole thing is rather simple, Adafruit supplies lots of lovely sample code for both the RTC
and the PWM
driver so it was just a matter of tying those together. The simple plan was to be able to set a number between 0 and 9999 onto all 4 dials by working out the minimum and maximum range for a dial and subdividing by 10. That didn't quite work out and I had a little detour into the realms of PROGMEM
to map new values into the servos in a way that didn't consume any additional RAM (again thinking about the expansion possibilities). I found the PGMWrap library
was a very useful tool which allowed me to store my static map of values into the flash memory instead of in RAM. Full Source code is here
and included below.
I'm using fairly generic 9g micro servos
to drive the pointer on each dial. Although all 4 servos came in the same batch there appear to be two different types with differing time ranges. All 4 servos were sufficiently different in accuracy that I ended up having to map the exact positions of each of the dial numbers onto corresponding PWM values for the servo driver. This again had the added bonus of being very exact when moving to each position although it was a little time consuming to set up. The pointer was glued onto a modified servo horn and screwed into place before the clear perspex was added. It's a bit glue heavy and not particularly repairable so hopefully it won't break any time soon.
I left the setServoPosition function in the code so that I could easily use the dials for a hit counter or other number display. I never did find out how to declare and use a 2 dimensional array from the PROGMEM so if anyone figures out how to do that I would love to know please, it would simplify the mapping just a little bit more and much more streamlined code because the PWM servo driver is technically capable of handling 4 of these displays at once.
by firstname.lastname@example.org (Martin Raynsford) at 13 February 2018 11:57 PM
I made a prototype dial for another project and it all came together well. It's mostly Birch ply, stained dark brown. The pointer is 1.5mm ply painted black and attached to a cut down servo arm. The backing is 3mm white acrylic, infill painted with black acrylic paint. The whole thing has another layer of 3mm clear acrylic over the front to act as a protective layer. It's a standard 9g servo behind it and connected to an arduino to make it easy to drive.
by email@example.com (Martin Raynsford) at 13 February 2018 08:28 AM
12 February 2018
I made this gauge with white acrylic and a black paint infill to bring out the numbers, although I engraved through the protective layer and used it as a mask I think it's probably easier to just engrave the material without the mask because the paint wipes off the plastic pretty easily, now that I'm using airbrush paints.
by firstname.lastname@example.org (Martin Raynsford) at 12 February 2018 11:05 PM
08 February 2018
I've also been working on a bunch of these rotating rings, they can be used in all sorts of cakes. Most turntables are solid but because these have a hole in the middle you can build cake right through them. I've made 4, 5 and 8 inch versions but failed to take any 8" photos. Useful for cakes like this
by email@example.com (Martin Raynsford) at 08 February 2018 10:20 PM
DNS is essentially a naming system
for computers and services connected to a network. It's a way of mapping an IP address to a name and keeping that connection even if the IP Address Changes. You could visit google by going to http://220.127.116.11/
but it's much easier to remember and type http://google.com/
into your browser instead. So far we've been accessing our ESP device by typing http://192.168.4.1/ as a URL but there is a way to set up a local DNS server on the device so that it too can have it's own named URL.
For this tutorial we're going to go right back to the basic access point
code. This code creates a local access point with a simple user name and password and responds to the browser with a simple piece of text. Being the wonderful arduino environment there is already a library written to enable you to do this with just two lines of text, the first to include the library and the second to tell it which URL you want.
Voila, now when you go to the browser and visit http://esp.local/ it takes you to your device.
All is good, in theory. It can't be that simple though other wise I wouldn't be having such a dilemma about DNS. The trouble is this only appears to work from my iPhone. When I go to my android phone or my laptop I can't access the device in the same way. This is also part of the problem with arduino, we're only using the libraries we don't really understand how they work. There's usually some workaround though and in this case there is a second DNS library readily available which appears to do the same thing so lets look at that.
The DNSServer library is a bit more involved (but still not a lot). The header file has to be included, an instance of the dns server declared, the server needs to be set up with the domain name (and DNS port) and finally it needs to be called in the main loop to ensure the requests are processed.
This has the rather disappointing effect that it doesn't appear to work on either iPhone or Android so it seems like a funny thing to include it here. Well the DNSServer library does have one interesting feature that actually proves to be quite useful. If you do not specify a domain name and instead use a wildcard, '*', it is supposed to be able to capture all requests and direct them to the correct URL. This is know as a captive portal and public wifi spots use them to direct your browser to their own login pages. The captive portal functionality finally allows us to connect to http://esp.local/ on the android (and laptop) device. In fact we can connect to anything we want it all goes to the same location.
The trouble is it doesn't work on the iPhone, and here is the dilemma. With the two obvious DNS libraries neither of them actually does a complete job. The world is not ending though, it is possible to use both libraries at the same time and between them they seem to cover all bases. So that's the little work around for now (full code here
Arduino being open source, it is actually possible to delve deep inside these libraries and figure out how they work, what they're doing or not doing in the specific iPhone/Android cases and it should be perfectly possible to fix one of these libraries to work with both systems, that all takes time though, I guess I know what I'll be doing next week.
by firstname.lastname@example.org (Martin Raynsford) at 08 February 2018 06:46 PM
07 February 2018
I have learnt something new, the collective nouns for Owls is a "Parliament".
I have made a whole box full of owl heads for a course Dawn is running in Amsterdam
this weekend, and also the reason for all the cars
I made last week.
by email@example.com (Martin Raynsford) at 07 February 2018 09:59 PM
03 February 2018
While I still try to get my head around the two different DNS servers I thought it was about time to write another tutorial. In this tutorial I'm going to discuss the use of the Serial Peripheral Interface Flash File System
(SPIFFS). This handy library lets you store files on the flash memory of the device. So instead of having to construct a HTML string as a response to a request we can serve up a standard web page.
To use SPIFFS you need to include the file "fs.h" at the top of the program and in the setup function you need to start the SPIFFS library using the 'begin' function. This initialises the library and allows you to access any files that are contained within the flash memory. For the purpose of debugging I tend to loop through the file system to list all the files contained on the device. The following lines of code retrieve a reference to the directory structure and then outputs all the files names to the serial port.
Finally we need to put this file system to use. The web server library is able to serve web pages directly from the file system rather than having to construct a new response each time. In this case we instruct the web server to respond to a root request with the index.html page directly from SPIFFS. Using this method you can write a web page in sensible editor, test it in your browser all without ever having to connect to the ESP device.
Here the complete code for a simple web page server, the next issue is how to get the files onto the device in the first place. ESP8266FS
is a tool that can be used to create file system images and upload them to the ESP device. It integrates with the Arduino IDE so it's easy to use. To install the tool you simply create a folder called 'Tools' in your arduino sketchbook directory, and unpack the zipped file
Now when you open the Arduino IDE there should be an additional option in the 'Tools' menu system. ESP8266 Sketch Data Upload. If you create a folder called 'Data' next to your arduino sketch, then the tool will convert any files in that folder, into an image and send them to the file system on the device.
by firstname.lastname@example.org (Martin Raynsford) at 03 February 2018 11:27 PM
02 February 2018
I put the vacuum former
to some serious work this week. I had a good run of making car body shells and owl heads, a little bit of practice and I could turn round each new sheet pretty quickly. Obviously making the owl heads and cars themselves has taken up a little bit longer and it has delayed the next ESP8266 tutorial while I try to figure out DNS. In other news I managed to turn my kitchen into a parking lot.
by email@example.com (Martin Raynsford) at 02 February 2018 06:24 PM
31 January 2018
Eli had to make a stone age scene for his homework, he opted to make a model A frame hut similar to the one recently built on Primitive Technology
. We laser cut a base to hold it all together and make it easy to line the sticks up and we laser cut all the palm fronds from crepe paper to go over the top of it. It took all day but he really enjoyed it.
by firstname.lastname@example.org (Martin Raynsford) at 31 January 2018 10:21 PM
28 January 2018
The next incredibly useful feature for the ESP8266 is the ability to program it directly over the Wifi. This would allow you to build devices that didn't even need a usb serial connection and you can easily update any devices that have been sent out to people already (would have been very handy for me this week).
The HTTP web updater
is actually part of the standard arduino core and it's incredibly simple to set up. We're going to build upon the web server tutorial
but this functionality can be included in all future programs.
Include the ESP8266HTTPUpdateServer.h and declare a new instance of the class for use in the program. The only other thing required to make this work is to tell the update server which web server it should be working with. This is done just before you start the local web server.
The arduino environment is able to prepare a new image to upload to the device. In the menu system you can go to "Sketch->Export Compiled Binary", this will be all the information about your program contained in a single file.
Now when you connect to the device via wifi you should be able to navigate the browser to "192.168.4.1/update", this will load a page that allows you to select a new image to upload to the device. Select the binary image from your sketch folder and click the update button, you should see the status of the upload displayed at the bottom of the page.
If the device has successfully updated, you will receive an message informing you of it's completion. It says the device is rebooting but the wemos D1 needs to be manually restarted using the reset button.
Once the device has actually rebooted you should be able to connect again to the wifi and load the root page to see that your changes have taken effect. For this demo I used the update to change the basic text response from 'Hello World' to 'Wifi Updated'
Here is the complete example code,
by email@example.com (Martin Raynsford) at 28 January 2018 03:24 PM
25 January 2018
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 written in HTML. The sample creates a button and wraps it with a link to change the location of the browser when the user clicks the button. The new URI contains some arguments that tell the ESP8266 what is required. In this case we would like the LED to be toggled. This additional data will be sent from the browser to the web server on our device and the web server can interpret it accordingly.
The handleArgs function looks a bit more involved but the actual core is still pretty simple. The first four lines are just included to aid debugging, they create a string of data that lists all of the incoming arguments to the web server and they send that string to the serial port. This makes it very easy to see what was actually sent by the browser.
The middle of the function contains a for loop which iterates through all of the incoming arguments. There may be multiple arguments coming from the browser and they could be in any order so we loop through them all comparing the argument name against the value we're looking for, in this case 'led'. Once we have identified the argument we look at the value of the argument to decide what to do with it, in our case the value is 'toggle' but it could easily be 'on' or 'off'. If both the argument and it's value match then we toggle the state of the built in LED (don't forget to set up the LED pin as an output at the beginning of the program).
Upload the code and connect to the wifi network created by the device, point the browser towards http://192.168.4.1/ and you should see a simple page with a single button load. When you click that button the LED on the ESP8266 should toggle between the on and off state.
by firstname.lastname@example.org (Martin Raynsford) at 25 January 2018 11:39 AM
24 January 2018
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.
by email@example.com (Martin Raynsford) at 24 January 2018 05:40 PM
23 January 2018
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 root ("/") request with a simple text response "Hello World!". It is possible to add other URI responses to the webserver, to serve different pages depending on what is requested.
Putting it all together gives us this sample code.
Compile the sample code and upload it to the device, you should be able to connect to the wifi network created by the ESP chip. The default IP address for the device is 192.168.4.1 so open a browser and navigate to "http://192.168.4.1/", a page should load showing this response
by firstname.lastname@example.org (Martin Raynsford) at 23 January 2018 09:28 PM
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.
by email@example.com (Martin Raynsford) at 23 January 2018 09:27 AM
22 January 2018
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 for me to worry about this way round.
I've written a very basic sample to initialise an access point with a predefined ssid and password.
The sample initialises the serial port functions before starting the wifi, the serial port is useful for debugging the application. In this instance the serial port sends details of the exact ssid and password being used to create the wifi network. The network name is created by combining a fixed string with the unique Chip ID, that way if I have more than one device turned on at the same time they'll both generate different network names.
In reality the sample boils down to two lines of code,
"WiFi.mode(WIFI_AP);" which sets up the device to operate as an access point.
"WiFi.softAP(ssid, pass);" which sets up the wifi with a given name and password.
It's worth noting that the ssid should be at least 8 characters long and less than 64 characters. If you want to set up a wifi network without a password just leave the password field blank.
Now when you open up a list of wifi devices from your laptop or mobile phone you should see the wifi network available to access.
by firstname.lastname@example.org (Martin Raynsford) at 22 January 2018 11:46 PM