Fallout Inspired Fusion Cell - Internet Monitor
by Ajaxjones in Circuits > Arduino
8157 Views, 60 Favorites, 0 Comments
Fallout Inspired Fusion Cell - Internet Monitor
One of the hassles I have is that I'm running internet out to the shed over the mains and it's sometimes a bit sketchy. So I built a small WiFi and internet connection checker and needed to put it inside a small case. What better then to place it in a Fusion Cell , inspired from those that they use in Fallout.
Supplies
Wemos D1 R1
Small 3v Relay
1k Resistor
1N4007 diode
LED + 270R resistor
Paints,inks and red tape
3D Model
So the first step was to find a suitable model, and there was one on Thingiverse. Only problem was that it was fairly chunky and solid and slightly the wrong size. So using Tinkercad I download the files, resized and then hollowed out the model.
With this done, I then worked out where to add the Wemos and a hole for the USB cable and a hole for the LED.
I printed a couple of these out and did them in ABS and at .15 resolution. I did this partly as I wanted to see the difference between leaving one in the raw print state and the other with some sanding and smoothing.
You can see where I also added some modelling putty and then sanded one down starting with 60 grade paper and working up to 600 grit. I sometimes take more time sanding, but this was only to be a simple desktop case and so I stopped at this stage where it was fairly smooth.
You can get the files here, https://www.thingiverse.com/thing:3874753 and they are based on the files originally made by Natnat9259.
Prep and Primer
With the cases sanded and cleaned I then applied a couple of coats of build primer. So far I've found one from Halfords that does the job reasonably well and doesnt take too long to dry. They have another one that is yellow, but it takes ages to dry and I dont have the time for that :)
With a few coats and a light sanding of 1200 wet and dry, I then put on a couple coats of grey primer and then sanded these down a little with the 1200 using water to keep it smooth.
Painting
With the Cells in primer the next step was to lay down some paint. For this I went the simple route and used standard car aerosol paints. The base was done in Ford Signal yellow and Skoda silver for the cap inserts with Brooklands green for the caps. After I masked off the tops, I painted them with some Matt Black to give the silver a better base colour. A few dusting light coats and then built up the layers. Prior to the final coat, I gave them a quick rub down with 1500 grade wet and dry with the sandpaper suitably wet.
Weathering
Now we've got some shiny Fusion cells, the next step is to weather them up. An assortment of Burnt Umber, Raw Sienna and, Raw Umber brushed on and then wiped off did the main trick I then also mixed up a very watery black wash and painted that on and also wiped on. Once it was dry, I went over them both with a coat of Matt Varnish to help seal them and also to give a nice used finish.
Detailing
A few little touch ups with Tamiya paints and then I used some red lining tape to put the red line around the base. A silver sharpier applied to edges give it a more chipped realistic look and makes it seem that its had some heavy handling during its life.
Electronics and Code
With the cases made, it was time to fit up the electronics. For this I'm using a WEMOS D1 which just fits nicely in the base. You can run the LED directly off the outputs, but I also wanted an audible warning. So the trick here is to use a small relay and just switch it on and off. The noise isnt then too intrusive, but provides and extra alert level on top of the change in flashing light. I printed up a small shelf that slides in over the Wemos that the board with the relay can sit on.
The current that the output pins can supply is less than that required to energise the relay coils, so a simple 1n2222 transistor is used with the Wemos powering the Base connection and the Collector/Emitter junction of the transistor handling the current. A reverse diode across the relay coils stops back EMF, but I skipped from using a capacitor from the base connection to earth, which should really be there but its all fine so far.
The aim is to have a nice subtle pulsing light when all is fine, and then different levels of flashing and clicking when either the WiFi drops out (loss of ping to the default gateway) or loss of internet when the ping to an outside server fails. I'd normally use google.com for that, but in this instance the appropriate server to ping is bethesda.net , makers of Fallout of course.
The code is pretty simple , but there is a neat piece with the ESP8266 code in that you dont have to pre-configure the WiFi connection. Just turn it on and look on your phone for a new hotspot called Fusion Cell. Connect to this and a web page asks for the Wifi that you want to connect to. Enter the details and it stores and reboots and then connects to the Internet. This means you can program up the Wemos with the normal Arduino IDE and then just move it around wherever you want to use it.
Code
#include
#include #include "ArduinoHttpClient.h"// leave blank as we will get them through the Wifi Manager, seems to be working fine this way #define WIFI_SSID "" #define WIFI_PASS ""
//needed for library #include #include #include "WiFiManager.h" //https://github.com/tzapu/WiFiManager
boolean wifi = true; boolean internet = true;
//const char* remote_host = "www.google.com"; // or can use 172.217.11.14 const char* remote_host = "fallout.bethesda.net"; // IPAddress GatewayAddress (192, 168, 0, 1);
// Define LED as an Integer (whole numbers) and pin D8 on Wemos D1 Mini Pro int LED = D2; int RELAY = D1;
float sinVal; int ledVal;
void setup() { Serial.begin(115200); while (!Serial); // wait for serial attach delay(5); pinMode(LED, OUTPUT); // Set the LED (D2) as an output pinMode(RELAY, OUTPUT); // Set the RELAY (D1) as an output
// for testing, this will show the status of the WiFi WiFi.printDiag(Serial); WiFiManager wifiManager;
//set callback that gets called when connecting to a previous WiFi fails, and enters Access Point mode wifiManager.setAPCallback(configModeCallback);
//reset saved settings , un comment this next line to force the testing of the WiFi Manager so you can connect //use your phone or tablet to look for the Kube LED network that will appear //wifiManager.resetSettings();
//sets timeout until configuration portal gets turned off //useful to make it all retry or go to sleep //in seconds wifiManager.setTimeout(240);
if (!wifiManager.autoConnect("Fusion Cell")) { Serial.println(F("failed to connect and hit timeout")); //reset and try again delay(3000); ESP.reset(); delay(1000); }
// We start by connecting to a WiFi network
Serial.println(); Serial.println(); Serial.print("Connecting to "); Serial.println(WIFI_SSID);
WiFi.begin(WIFI_SSID, WIFI_PASS); //entered config mode, set Neo Pixel to purple #241628 = 2364968 Serial.println("\n[Startup mode]");
while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); }
Serial.println(""); Serial.println("WiFi connected"); Serial.print("IP address: "); Serial.println(WiFi.localIP()); Serial.print("Gateway address:"); Serial.println(WiFi.gatewayIP()); IPAddress GatewayAddress (WiFi.gatewayIP()); Serial.println(); Serial.println("Initializing..."); Serial.flush(); Serial.println(); Serial.println("Running...Fusion_Cell_-_Internet_Checker"); // set up the defaults }
// Main Loop is here void loop() { WiFiClient client; //delay(1000); //digitalWrite(LED, LOW); // Turn LED off. Serial.println("-------------------"); Serial.println("Checking Gateway"); analogWrite(LED, 125); if(Ping.ping(GatewayAddress)) { Serial.println("Gateway Success!!"); wifi = true; } else { Serial.println("Error :("); wifi = false; } ledpulse(wifi,internet);
analogWrite(LED, 125); Serial.println("Checking Local Host"); if(Ping.ping(remote_host)) { Serial.println("Remote Success!!"); internet = true; // digitalWrite(LED, HIGH); // Turn LED on. } else { Serial.println("Error :("); internet = false; } ledpulse(wifi,internet); }
/* pulsing algorithm by 14CORE */ int ledpulse(boolean W, boolean I) { if (W && I ){ digitalWrite(RELAY, LOW); // Turn RELAY off. // pulsing flash for (int y=0; y<18; y++) { for (int x=0; x<180; x++) { // convert degrees to radians then obtain the sin value // then obtain sin value sinVal = (sin(x*(3.1412/180))); ledVal = int(sinVal*255); analogWrite(LED, ledVal); delay(5); // Delay } } }
if (!W) { // slow flash for (int x=0; x<4; x++) { digitalWrite(LED, LOW); // Turn LED off. digitalWrite(RELAY, LOW); // Turn RELAY off. delay(500); // Delay .5 seconds digitalWrite(LED, HIGH); // Turn LED on. digitalWrite(RELAY, HIGH); // Turn LED on. delay(500); // Delay .5 seconds } }
if (!I) { // rapid flash for (int x=0; x<20; x++) { digitalWrite(LED, LOW); // Turn LED off. digitalWrite(RELAY, LOW); // Turn RELAY off. delay(100); // Delay .5 seconds digitalWrite(LED, HIGH); // Turn LED on. digitalWrite(RELAY, HIGH); // Turn LED on. delay(100); // Delay .5 seconds } } }
// ----------------------------------------------------------------------------------------- // this is called when WiFiManager enters configuration mode, void configModeCallback (WiFiManager *myWiFiManager) { Serial.println(F("Entered config mode")); Serial.println(WiFi.softAPIP()); //if you used auto generated SSID, print it Serial.println(myWiFiManager->getConfigPortalSSID()); //entered config mode, set LED ON digitalWrite(LED, HIGH); // Turn LED on. Serial.println("\n[config mode]"); }
In Operation
The Fusion Cells are now finished and working on my desk. The second one has a laser pointer module installed instead of the LED and powered off the relay, but although its 'cool' its hard to spot as the dot appears on the ceiling !