Introduction: Add a Camera to Your Silver Bullet Cutter

Picture of Add a Camera to Your Silver Bullet Cutter

The Silver Bullet is a great cutter, fast, powerful and capable. However, it does have a minor drawback. For print and cut work, registration is not automatic - you have to align a laser dot with the printer by eye and this means squatting down in front of the cutter and aligning it whilst balancing a keyboard on your knee. It's not a big problem but it can be awkward if you're doing it a lot, and if you want to, as I often do, run multiple passes with different settings, getting the registration done precisely is tricky. The obvious answer is to add a camera so that it can all be achieved from the comfort of your desktop.

This project is, in essence, quite simple. A Raspberry Pi Zero W with the Zero camera module is mounted on the cutter head of the Silver Bullet. The video from the camera transmitted using the built-in web server over the wireless network and available simply by opening a browser window when needed. The Pi and camera are powered from the Silver Bullet.

Parts list

Items

Tools & Materials

  • Soldering station/iron
  • Flux-cored electronig grade solder
  • Multimeter
  • Glue Gun & glue sticks
  • Thin wire
  • Terminal blocks
  • [Optional] White LED & limiting resistor

Software

Step 1: Program Your Pi

Picture of Program Your Pi

To get going with your Raspberry Pi you'll need to download the Raspbian Jessie operating system image. I tried using the latest Stretch version, but it gave me too much trouble with the packages and it doesn't have anything we need, so Jessie will do just fine. Download the .zip file from here and extract the .img file to somewhere convenient. There is a guide on writing the image to the MicroSD card in the RaspberryPi.org site, so I won't repeat it here, just follow the simple instructions and come back when it's completed writing the card.

Once the card has been written, you'll need to do a couple of things to get it ready for headless operation using WiFi. Remove and re-insert the MicroSD card to make sure Windows recognises it after it's been written. You may see a few pop-ups asking if you'd like to format the partitions as Windows doesn't recognise all of them. Needless to say, DON'T format anything! You should see one partition that does have a visible file system and it should be called 'boot' Open that in an Explorer window.

Enable SSH on the Pi by simply creating a file in the root of the boot volume called ssh with no content and no file extension. If you don't have file extensions visible in Window be very sure that it doesn't sneakily add the .txt extension.

Enable WiFi by creating a file in the root of the boot volume called wpa_supplicant.conf. This file will contain the details of your Wi-Fi network. Place the following content in the file, substituting your network's SSID and PASSWORD

country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="SSID"
    scan_ssid=1
    psk="PASSWORD"
    key_mgmt=WPA-PSK
}

Safely eject the SD card and insert it into your Pi. You can now power it up by connecting a microUSB cable to the bottom microUSB port marked PWR and connecting the other end to a PC or power bank. You could also use a microUSB phone charger if you have one. Give the Pi a minute to boot, and while it's doing that load up PuTTY. You now need to connect to the Pi using the IP address, so log on to your router and look at the DHCP leases. Hopefully you should be able to see the new device. If you're not sure which one it is, Raspberry Pi MAC addresses start B8:27:EB as in the screenshot. Connect to the Pi using PuTTY with the hostname of pi@[IPaddress] on port 22. Make sure SSH is selected then click Open. You should then say Yes to the key fingerprint warning. You can log on using the default password of raspberry.

Configure the Pi

At the terminal, run

sudo raspi-config

Update the following settings:

  • Change your password to something unique
Change User Password
  • Change the hostname of the Pi. I changed mine to BulletCam
Hostname
  • Set the Pi to log in automatically
Boot Options > Console Autologin
  • Se the system locale. I set mine to en_GB.UTF-8 UTF-8
Localisation Options > Change Locale
  • Set the time zone. I set mine to Europe > London
Localisation Options > Change Timezone<br>
  • Set the Wi-Fi country to ensure you're only using legal channels. GB for me.
Localisation Options > Change Wi-fi Country
  • Now the important one. Enable the camera
Interface Options > P1 Camera
  • Expand the filesystem to use the whole SD Card if you like, although it's not really necessary for what we're doing.
Advanced Options > Expand Filesystem
  • Ensure the GPU has enough memory. 128 seems to be OK, but I set mine to 256 for a bit of elbow room
Advanced Options > Memory Split > 256

Now just select Finish and reboot when asked

Give the Pi a minute to reboot, reconnect with PuTTY and update the packages

sudo apt-get update && sudo apt-get upgrade -y

This will take quite some time - I found the nodered package took an extraordinarily long time - so take a break and come back later.

Step 2: Install UV4L

Picture of Install UV4L

Now that the Pi is configured, it's time to get the video software installed.

Enter the following command

curl http://www.linux-projects.org/listing/uv4l_repo/lrkey.asc | sudo apt-key add -

Now add the following line to the /etc/apt/sources.list file

deb http://www.linux-projects.org/listing/uv4l_repo/raspbian/ jessie main

Now run the following commands to install the raspicam packages

sudo apt-get update
sudo apt-get install uv4l uv4l-raspicam
sudo apt-get install uv4l-raspicam-extras

Now we need to install the WebRTC extention to install the streaming server

sudo apt-get install uv4l-webrtc-armv6

Restart the UV4L service

sudo service uv4l_raspicam restart

Now you can see if your efforts are starting to pay off. Open a browser and navigate to http://[Pi IP address]:8080/stream and in a few seconds you should see a video stream from your PiCam.

Now that you're basking in the glow of your success it's time to configure the stream to something a little more suited to our use case. Open the config file for editing

sudo nano /etc/uv4l/uv4l-raspicam.conf

Under the # raspicam driver options heading, uncomment width and height and set them as follows:

##################################
# raspicam driver options
##################################

encoding = mjpeg
width = 640
height = 480
framerate = 30
#custom-sensor-config = 2

You will also need to rotate the output due to the eventual orientation of the camera. Scroll down to the ### image settings option: section and uncomment the rotation option and set it to 90

rotation = 90

I also set the auto white balance to tungsten as it seemed to do better than the auto setting in my environment

awb = tungsten

If everything has gone well you should find that that the streaming server now starts automatically with all the correct settings when the Pi boots up. Give it a try by restarting the Pi, waiting a minute for it to boot and reloading the stream page.

Step 3: Determining the Component Positioning

Picture of Determining the Component Positioning

Ideally, I would have mounted the Raspberry Pi in the body of the cutter and connected the camera using a flat flexible cable that would run with the existing flat cable that connects the cutting head. Unfortunately these cables are not easy to source as they only come in particular shapes and sizes. Additionally the camera is hard-wired to a very short length of FFC and, try as I might, I couldn't find an adaptor to join lengths. I attempted to solder together some cables retrieved from a dead laptop, but with 22 connectors at 0.5mm pitch it didn't play ball! I also tried running some very flexible lightweight cable but it didn't go well and I just couldn't see it working without causing a lot of trouble.

So, what to do? The system should be pretty self-contained once complete, needing nothing more than a 5v supply that could provide sufficient current for the Raspberry Pi and camera. The cutting head has an exposed board that is pretty simple so I broke out the screwdriver and multi-meter and started poking around. I visually traced the connections from the cutting head cable and used a multi-meter to confirm my theory that the 5v rail from the PSU was connected directly to the head so I shouldn't need to worry about drawing too much current from sensitive electronics. Further investigation of the head revealed that the markings clearly show the 5v and 0v connections where I could tap off the power.

With the power supply sorted the Pi Zero needed siting. The only place it could possibly go was the side of the head, allowing the camera cable to slip underneath where it could point at the laser dot. This presented a problem as there is a screw-mounted rubber bumper in case the head travels too far and with the Pi on the side it would hit before the optical cut out kicked in. I fixed this quite simply by removing the screw and bumper and placing an adhesive-backed silicone rubber foot a little higher and further back where it would stop the head but miss the board.

Step 4: I Have the Power!

Picture of I Have the Power!

Having decided to take power from the head I realised that it would be best to be able to easily disconnect the Pi Zero from the circuit in case I needed to get in there again so I drilled a small hole in the board next to an existing hole so I could mount a twin screw terminal block. As I haven't got any pads to solder this to I fixed it in place with the ever-popular hot glue. Not pretty, but it does the trick. I soldered the wires to the bottom connections marked + and E after verifying with a multimeter that they directly connected to the 5 and 0 pins of the flat flexible cable. The wires were then routed underneath the board utilising an existing hole and fixed in place with hot glue. After soldering the other ends to the screw terminals and colouring the blocks with a sharpie the power was tapped and ready for the Pi.

At this point I connected some long temporary wires from the screw terminals to the 5v (GPIO pin 2) and 0v (GPIO pin 6) connectors on the Pi Zero. You can use any of the 5v and ground holes as they are all electrically the same, but these were the easiest. Solder the wires directly to the holes in the Pi's GPIO without using header pins otherwise you won't have room to mount the board. Make sure to leave plenty of length on the power wires for now; you can cut them to size once everything else is in place at the end of the build.

Note that the Pi Zero doesn't have polarity or over voltage/current protection, so double-check everything as you go. Once that's done the Pi will power up when the Silver Bullet is turned on.

Step 5: Camera

Picture of Camera

Now it's time to get the camera in place and set up correctly. Most cameras have a minimum focal distance of about 50cm, but we need ours to focus at about 2cm. Fortunately for us modern lenses can be amazingly small and Smart Micro Optics have released a product called Blips. These are ideal as they are simply a tiny plastic lens on a flexible film designed to stick on to smartphone cameras. The Macro Plus lens has a focal distance of 20mm, which is perfect. All you need to do is to carefully position the lens over the camera head and wrap it around. The adhesive on the tape will keep it in place and you can simply cut off the excess tape with some small scissors.

Now comes the tricky part - positioning and fixing the camera. First you need to remove the cover from the cutting head on the Silver Bullet. Unscrew the four silver screws on each side and it will slide off. Start up the Pi, load an example of your usual material into the cutter and open the video stream in a browser. Turn on the Silver Bullet and with it in Online mode press the crosshair button to turn on the laser. Now you can use a pair of long tweezers to hold the camera in place against the laser emitter. Move the camera around while watching the stream to position the laser dot in the centre of the image and get the material in focus. Now you know where the camera needs to go.

Ideally you would carefully measure, design and print a camera mount with a 3D-printer. Unfortunately I haven't got one of those (yet). So our old favourite the hot glue comes into play. Whilst holding the camera in place and looking at the video stream to ensure it's accurate, tack the camera in place with some hot glue. Make sure you continue to hold the camera steady while the glue cools so that the aim doesn't drift. Once it's solid, add more glue until it's secure, being careful not to get glue anywhere near the lens or the laser emitter. I reinforced the mount on mine by slipping a length or three right-angled header pins under the macro lens film as a makeshift bracket, but I think the glue alone should be sufficient. The head cover fits very snugly so make sure that the glue doesn't stick out and that the laser power leads have space.

Step 6: [Optional] Illumination LED

Picture of [Optional] Illumination LED

The positioning of my cutter means that it's sometimes quite dark and this can make it a little harder to see the registration marks against the bright laser. The camera set-up works OK like this so it's not absolutely necessary, but I decided to add a little illumination just to make things easier.

I used a single LED and resistor from a 12v LED strip that I had lying around as this works just fine with 5v and only draws 15mW. Another couple of thin wires run up to the screw terminals on the upper circuit board allows the LED to be powered just like the Raspberry Pi. If you don't have any LED strip handy then almost any low current, wide angle LED and limiting resistor should do as long as you can find a way of mounting it.

Step 7: Mount the Raspberry Pi

Picture of Mount the Raspberry Pi

With the camera (and optional LED) in place it's time to put the head cover back on. once it's in place you can mount the Pi on the side. I decided to cover the back of the Pi with a layer of adhesive vinyl to keep it free of glue and make sure nothing shorted. Then it's simply a matter of checking exactly where it should go so that the camera cable can connect without any more slack than is necessary, and making sure the board doesn't hit the rubber end stop at full head travel. Add a thin squirt of hot glue on the back and hold it in place until it's set. I also added a little more glue around the corner holes to make sure it stays put.

Step 8: Connect and Test

Picture of Connect and Test

Now you can connect up the camera cable (making sure you don't break the fragile retaining clip like I did) and then screw the power cables in to the terminal blocks on the top circuit board. Make sure that everything is secure and tidy, and that the power is definitely the right way round.

You're done - power on the Silver Bullet, open the stream in your browser and have fun!

Comments

About This Instructable

238views

6favorites

License:

More by RussPitcher:Add a Camera to Your Silver Bullet CutterAdd buttons to your X52-Pro Joystick with an Arduino Micro
Add instructable to: