ESP32-CAM helmet camera, prototype 2

 

I did a little more work on the design and added an external antenna, as it's a known fact the board works better with one.

Then I put quite a lot of effort into painting it up in a basic camouflage pattern. I am very pleased with how this worked out.

No other real changes to the project but it shows you can make something decent looking at a low cost.

Creality automatic spotlights

A while back I wired both my Creality 3D printers so that they are powered on and off through Octoprint. This is useful because I work two floors away from the printers and perhaps more importantly because it switches the printer off after a long print.

This has been working perfectly but I often have the light in my cellar switched off making the camera monitor pretty useless unless I go and switch the light on.

I figured it stood to reason that switching some lighting on with the printers was a good idea and I made up a couple of little spotlights attached to the printer frames and connected them to the same SSRs that switch the printer power.

The spotlights are made from some ceramic GU10 bulb holders I had, 20mm electrical conduit and some 3D printed parts I quickly knocked up in OpenSCAD. I knew from my work with making fittings for GU5.3 12v bulbs that heat from the bulb wouldn't be an issue with the printed parts, they barely get warm to the touch even after several hours.

I only did this yesterday but it's already meant I haven't been leaving the cellar light on as much while working on projects.

ESP32-CAM helmet camera, prototype 1

It's been a while since I've blogged. Back in March I was working very hard indeed on making props for our upcoming LARP. With the pandemic we suddenly had to postpone until some indeterminate time in the future.

This killed my enthusiasm for a bit and when I picked up projects again I needed a change.

Over the last couple of weeks I've been fiddling with the ESP32-CAM board again and turned the pile of components in the first photo into a working helmet camera prototype.

With the standard camera example code loaded it works really quite solidly and the battery life with a 18650 cell recovered from an old laptop battery pack seems good.

I started out with the selfie lens for aesthetic reasons but it does a good job of taking in a whole room as you move around, something the default lens these boards ship with doesn't do.

The tactile button on the side switches on the onboard 'flash' LED and there's an acrylic light pipe bringing the light out of the shadow of the lens. It's not a proper long throw torch but it just about manages to light a dark room so you can see and the camera will generate a very grainy picture with the gain up full.

Onboard charging is nice but currently getting the cell in/out in the field is impractically fiddly and the holder is stuck in with tape. The indicator LEDs on the TP4056 board are brought out on the side with another couple of light pipes and these work great. The idea is if these were issued on a multi-day game it would be the player responsibility to keep them charged and a USB charging socket makes that practical. For a short game they probably won't need charging.

Overall this has worked out really nicely and the design I've done in OpenSCAD is modular enough it's easy to swap out the rail mount and add something different. These could easily double as 'CCTV' cameras with a ball socket mount.

The design does need a little more work to make it easy to assemble but broadly it's there. I've also had it suggested that an external antenna would be acceptable, when I thought it would be too ugly. So I'll work on a version with that over the next few weeks, the boards have a uFL connector and it'll really help increase range.

I've got enough camera boards and recovered batteries in good condition to build a set for a whole team of 'marines' and a few static CCTV units. Doing this while keeping the cost down for 10+ units has been a major requirement of this project and I've definitely succeeded at that. The bill of materials using the recovered 18650s comes in at about £7 plus printer filament at the moment.

Mesh networked computer terminals with RFID logon - part 6

Going back a few weeks I was having trouble with stability of the RFID readers. Which I've now fixed with a far less complicated solution.

The library has an option to turn the RFID antenna on and off. Simply shutting it off and turning back on to check the card periodically seems a 100% stable solution.

Obviously you should also check the card hasn't been swapped by checking the ID hasn't changed but here is a a minimal sketch to do this. As checking for a card stops it appearing as new it's easy to get the logic messed up but this is a tested and working example.

Note to self: start putting stuff on GutHub.


#include <SPI.h>
#include <MFRC522.h>

const uint8_t SS_PIN = D8;    //My example code is for a WeMos D1 mini, change these to match your setup
const uint8_t RST_PIN = D0;   //My example code is for a WeMos D1 mini, change these to match your setup
 
MFRC522 rfid(SS_PIN, RST_PIN);

bool cardPresentWhenLastChecked = false;
bool antennaEnabled = true;
uint32_t cardCheckTimer = 0;

void setup()
  Serial.begin(115200);
  SPI.begin();
  rfid.PCD_Init();
  Serial.println(F("Checking for RFID card removal"));
}
 
void loop()
{
  if(millis() > cardCheckTimer)
  {
    //Start a check of the card
    if(antennaEnabled == false)
    {
        //Turn the antenna back on
        rfid.PCD_AntennaOn();
        antennaEnabled = true;
        //It takes time to wake up the RFID card so the sketch needs to wait before checking for it
        cardCheckTimer = millis() + 20ul;
    }
    else if(antennaEnabled == true)
    {
      if(millis() > cardCheckTimer)
      {
        //Check for a card after a delay for it to power up
        if(rfid.PICC_IsNewCardPresent() == true)
        {
          if(cardPresentWhenLastChecked == false)
          {
            //Card was absent but has been presented
            Serial.println(F("Card presented"));
            cardPresentWhenLastChecked = true;
          }
        }
        else if(rfid.PICC_IsNewCardPresent() == false && cardPresentWhenLastChecked == true)
        {
          //The card was present but has been removed
          Serial.println("Card removed");
          cardPresentWhenLastChecked = false;
        }
        //Switch off the antenna, otherwise the card will not show as 'new' when checked again
        rfid.PCD_AntennaOff();
        antennaEnabled = false;
        //Wait before checking the card again
        cardCheckTimer = millis() + 100ul;
      }
    }
  }
}

Ender 2 magnetic bed upgrade

I'm still down the prop mines so can't post much without spoilers, but as alluded to I've been doing a lot of  3D printing again recently. The Ender 2 is great but the bed material was getting nasty and it's always been a pain to get things off as it's not removable.
My Ender 3 has a basic removable, flexible bed which is so much nicer. You can't get Ender 2 removable beds easily but you can for the Ender 3, very cheaply. This is a magnetic one which avoids any clips and as I have a second I may upgrade the Ender 3.
I assumed the bed would cut down easily to go on the Ender 2. Which has a tiny bed compared to almost any modern printer. I popped the bed off the printer, which is dead easy, marked it out with some tape and it cut easily with a nice sharp craft knife.
You can see how small the Ender 2 bed is compared to the not huge Ender 3. I wandered a tiny bit with the craft knife despite running it against as steel edge, but once on the printer it's not a problem as you'd never deliberately print that close to the edge of the bed.
Just running off my first test print now but after some faff re-levelling the bed, which is tiresome on an Ender 2, things look very promising.

Update: The small surface area makes for quite weak attraction with the base. Tall prints, especially, seem to cause the bed to slip and kill the print. I've fixed this with a couple of clips. So I've still got a removable bed it's just not an instant off one. Which is not exactly a hardship.

Creality Ender spool holder upgrade


I've been using my 3D printers a lot recently and as is the case with pretty much any tool, heavy use shows up flaws.

The spool holder that ships with the Ender models is a simple large diameter plastic tube. Which kind of works but I've realised this has a couple of problems.


The standard spool holder simply doesn't hold the 0.5Kg reels I have, the diameter is too large. More importantly there's a lot of friction that means it pulls the filament tight and I think on a couple of occasions has caused it to snap. I tried adding some shiny tape but it didn't really help.


A long time back I made a freestanding spool holder for my old Ormerod and I was using that for the 0.5Kg reels but the filament snapping is very annoying on a long print as the Enders have no filament sensor.


To fix this I spent a little time today knocking up a similar arrangement to the standalone holder for the Enders that goes in place of the tube. It's some 3D printed parts, 608-RS bearings, M8 studding and nuts. Now the spool moves completely freely and filament falls off the spool nicely rather than being pulled tight.

Job done.

OctoPrint PSU control

I've been using my Creality printers with OctoPrint running on Raspberry Pis for a little while now and it's made them really seamless to drive. One last thing has been bugging me, I want the printers to switch off at the end of a long print. A very quick look online shows there's a plug-in for this so I ordered a couple of cheap SSRs and today spent a little while setting this up.


The plug-in can be configured with a GPIO pin it then uses to turn power on/off and I selected pin 8. This meant I could solder up a very simple straight three pin header with 5V, GND and pin 8 next to each other.

There is a tiny gotcha with this choice in that pin 8 is GPIO14 which is used for the serial console on the Pi by default. So you have to use raspi-config and disable both the console and serial hardware in the 'Interfacing options' menu.

With that done, it was simple to configure the pin in PSU control and check it would turn the SSR on/off. This worked immediately but I found that the action was 'inverted' and the plug-in has a convenient tick-box that fixes that.

To manage the printer power I took the existing IEC mains lead and carefully stripped the outer sheath, exposing the individual wires. That made it easy to break the live connection and have it switched by the SSR without having joins in the earth and neutral.

So this was safe to have floating around on my bench, I designed a 3D printable enclosure and have published it on Thingiverse. This enclosure will obviously work for any use of these little SSRs and I'm tempted to buy a few more to have in stock for future projects. The cable channel is the right diameter for typical IEC leads and grips it when you tighten the cover down.






Creality Ender 3 camera mount

I've been using my Ender 3 a lot and am very impressed with it. Teamed up with Octoprint it's just great. Better 3D printers are legion but this will do me for the foreseeable future.

Octoprint supports a USB webcam for remote print monitoring and I've been using one of my stash of old Xbox LiveCams for this.

However I got tired of having it gaffa taped to a jar nearby as I kept knocking it out of alignment. To stop this I made a little mount which works quite nicely, so I stuck it on Thingiverse.

All it needs is some double sided tape to hold it on the printer and a sticky pad for the camera. Should work with any old webcam with a flat base.

I started out designing something to fix with the bolts that secure the Y stepper motor but realised they're too short to use and have any meat to the print. This version fits reasonably snugly so the tape doesn't really take much load.