5. Communications Gateway Construction - sunny-day-flooding-project/tutorials_v1 GitHub Wiki

Table of Contents

  1. Tutorial Overview
  2. Hardware & Equipment
  3. Optical Dome
  4. Preparing Communications Box for Attachments
  5. Raspberry Pi Stack
  6. Camera
  7. Power Supply Assembly
  8. Final Communications Gateway Assembly

Tutorial Overview

The communications gateway is the part of the SuDS that is installed above the pressure logger in order to capture images of roadway flooding and transmit data to the API. This unit houses a Raspberry Pi 4 computer that connects to the BLE board in the pressure logger. A camera is attached to this Raspberry Pi 4 computer to allow for real-time imaging. This communications box will be installed on a pole near the storm drain with the pressure logger and needs access to a power outlet.

Fully built communications gateway

Hardware & Equipment

Hardware List

Name Amount Required Picture
Polycase Box 1
Optical Dome 1
Waterproof Grease, or "Lubricant" 1
Acrylic Solvent Cement 1
DIN Rail 1
#10-24 X 3/8" Machine Screws 2
Cable Gland 1
Nut 1, size that fits cable gland
3D printed Raspberry Pi Carrier 1 Link to CAD Files
DIN Rail Mounting Bracket 2
M3x12 Screws and nuts 4
Raspberry Pi 4B - 4GB 1
Raspberry Pi 4 Heat Sinks 1 9x9mm, 1 14x14mm
SanDisk High Endurance 64GB uSD 1
Raspberry Pi HQ Camera Module 1
Nylon Male Standoffs 6 10mm, 2 6mm, 2 15mm
Nylon Nuts 6
LiFePowered Pi+ UPS Device with stackable header 1
Raspberry Pi 4 Argon Fan Hat 1
Nylon Fasteners 4
Machined Camera Mount 1 Link to CAD Files
Ball Mount for camera module 1
Camera Lens 1
Power Cord 1
DIN Rail Power Supply 5VDC 1
Zip Ties
DIN Rail Fuse Holder 1
3 AMP AT Fuse 1
USB A to left-angle USB B cable 1
Wire Various colors needed
Heat shrink 2, various sizes needed

Equipment List

  • Screwdriver
  • Saw
  • Step Drill Bit
  • Allen Wrench
  • Soldering Iron
  • Drill Press
  • Wirestripper
  • X-acto knife
  • Voltmeter

Optical Dome

The Polycase Box (Communications Gateway) comes with 2 footers and 8 screws. The screws are identical for the case and footers. The company installation instructions (green sheet) are in the box. The mounting flanges will not be used as this is a pole-mounted box. Leave the plastic covering for continued protection until you're ready to install the optical dome.

Polycase Box

  • Remove the communications box lid by unsnapping it from the four hinges.
  • Remove the protective plastic covering from the lid.
  • Use a 3" hole saw on a drill press to cut a hole for the optical dome.
    • The top and right sides of the hole should be about two centimeters inside the inner ridge on the communications box lid. This may change slightly depending on the desired camera angle.
    • Run the drill press at 450 rpm and cut the 3 inch hole slowly in progressive steps, applying lubricant to the cutting surface intermittently. Trying to drill the hole too fast without enough lubricant could cause cracking in the case cover.

Creating the optical dome

  • Use the acrylic solvent cement along the outside of the communications box lid to bond to the flange of the optical dome. The flange of the optical dome should be inside the communications box lid.

Preparing Communications Box for Attachments

Installing the DIN Rail

Cut the DIN rail to fit in the box vertically along the center mounting holes. Length and/or position of cuts may have to be adjusted so that slots in DIN rail line up with mounting holes. Fasten the DIN rail inside the Communications box with two 10-24 3/8 machine screws.

Installing the DIN Rail

Installing the Cable Gland

  • Find the location of the hole used for the cable gland. It is about 2.085” over and 1.217” down from upper left of bottom. Reference the photo below.

Location of hole used for the cable gland

  • The cable gland itself is 0.821” in diameter. Measure the diameter on the step drill bit and find/mark the size that matches the gland diameter. Drill a smaller hole if necessary to achieve a tight fit. If available, use a drill press which can set a lock on the diameter you want.

Creating the hole for the cable gland

  • After drilling the hole, attach the cable gland. Optionally, you can cover O-ring with lubricant for additional water seal. Screw the cable gland in by hand and attach a nut on the inside of the box with the "flat side" of the nut touching the inside of the box. Use a wrench to loosely tighten. We will tighten this nut on the cable gland later to secure the wiring.

Attaching the cable gland

Raspberry Pi Stack

  • Attach a DIN Rail Mounting Bracket to the 3D printed Raspberry Pi Carrier using two M3x14mm screws and hex nuts.

Attaching the DIN Rail Mounting Bracket

  • Unbox the Raspberry Pi 4B. Ground yourself before touching the Raspberry Pi. When taking it out of the box, make sure you only touch the sides of the Raspberry Pi.
  • Install the Raspberry Pi heat sinks on the Raspberry Pi board, but not on RAM chip as this would interfere with the UPS board. See the picture below for reference.

Applying heat sinks to the Raspberry Pi

  • Install the micro-USD card to the Raspberry Pi.
  • Attach the Raspberry Pi camera ribbon cable to the Raspberry Pi board. If you purchased a Raspberry Pi camera, then a camera ribbon came with the package. If not, a camera ribbon can be purchased separately. If the camera ribbon is attached to the Raspberry Pi camera, reference the picture below to detach it.

Detaching the camera ribbon from the Raspberry Pi camera

  • Now, attach the camera ribbon to the Raspberry Pi board.
    • Pinch the ribbon holder and lightly pull to unlock the ribbon holder.
    • Align the metal slits on the end of the camera ribbon with the ribbon holder. Make sure the ribbon is well aligned and not skewed.
    • Once the camera ribbon is correctly aligned, slide the ribbon holder back in place. The ribbon is secure in the ribbon holder if it does not come out with slight tugging.

Attaching the camera ribbon to the Raspberry Pi board

  • Screw 4 10mm nylon male standoffs to the bottom of the blue mounting plate and use nuts at the bottom of the plate.

Screwing 10mm nylon standoffs to the blue mounting plate

  • Referencing the picture below, align the Raspberry Pi board on top of the pins on the blue mounting plate.
  • Screw 2 10mm Nylon male standoffs to the corners of the Raspberry Pi on either side of the header pins on the Raspberry Pi board.
  • Screw 2 15mm Nylon male standoffs on the other corner of the Raspberry Pi board, with one additional nut as a spacer on each of the 15mm standoffs. Put the nut on the 15mm Nylon male standoff before screwing it into the board.

Attaching standoffs to the Raspberry Pi board

  • Attach the Raspberry Pi LiFePO4wered Pi+ UPS (UPS device) to the header pins on the Raspberry Pi board, with the battery of the UPS device facing downwards. Align the pins and then push the headers together.
  • Once the UPS deice is attached, screw 2 5mm standoffs to both ends of UPS device that are next to the header pins.

Attaching the UPS device to the Raspberry Pi board

  • Carefully remove both the header protectors from the top side of the UPS device. Make sure to not bend the pins when removing the protectors.

Removing the header protectors from the UPS device

  • Reference the picture below and make sure that you have installed the nylon standoffs properly.
  • Attach the Raspberry Pi fan board to the header pins of the UPS device. Use 4 Nylon fasteners to connect the four corners of the fan board to the Raspberry Pi stack.

Finishing the "Raspberry Pi stack"

Camera

  • Using two M3x14mm screws and hex nuts, attach the DIN rail connector to the bottom of the blue camera mount board.

Attaching DIN Rail to blue camera mount board

  • Attach the ball mount to the blue camera mount board, with the large black end of the ball mount facing the inside of the blue camera mount board. Place it low so that the camera lens will fit in the communications box.

Attaching ball mount

  • Remove the cap on the Raspberry Pi camera module and attach it to the large black end of the ball mount. Point the camera module towards the power supply.

Attaching the Raspberry Pi camera module

  • Unlock the ribbon holder and attach the camera ribbon cable to the Raspberry Pi camera. Again, make sure the metal slits of the camera ribbon cable align with the ribbon holder on the camera. Minimize bends in the ribbon.
  • Remove the cap on the Raspberry Pi camera lens and attach the lens to the camera module. Leave the lens cap on to protect the lens. The adjustment piece that comes with the lens is not needed.

Removing additional component from camera

  • Attach this camera system to DIN rail. Make sure that the ball mount is placed low enough that the camera lens fits within the optical dome. Furthermore, check that the raspberry pi camera ribbon is not twisted. If so, reattach the camera ribbon.

Example of twisted camera ribbon, in which case you will need to fix.

Power Supply Assembly

Power Cord

  • Skip this step if the power supple cable you are using is already stripped and tinned. If not, cut off the end of the power cord.
  • Use a box cutter to carefully cut the outer insulation (jacket) of the power cord, exposing 3 inches of wires. Bend and flex the cord as you're cutting to help with this process. Don’t cut the insulation on the wires inside the cord itself (e.g., black, white, and green jackets).

Removing insulation of power cord to expose inner wires

  • Use a wire striper to strip the ends of the white, black, and green wires.
  • Twist the ends of the exposed wire and tin the wires. Tinning the wires creates a solid wire tip and helps the wires connect to other electronics.

Tinning the interior white, green, and black wires

  • Route the power cord and wires through cable gland on the side of the communications box. We will go back and tighten the cable gland later.

Routing wires through the cable gland

  • The DIN Rail Power Supply will be attached to the DIN Rail right next to the cable gland. Attach the wires to the Power Supply, keeping the Power Supply unattached to make installing easier.
    • The green wire is the ground, the black/ brown wire is the power (ACL), and the white/ blue wire is neutral (ACN).
    • Thus, the white wire goes into the opening on the DIN Rail Power Supply labeled "ACN," and the black goes into the one labeled "ACL." Use a screwdriver to the screw and clamp the wires down.

Connecting wires to power supply

  • Test that the DIN Rail Power Supply is working and adjust the power.
    • Plug the power supply into the outlet.
    • Using a voltmeter, slightly adjust the power supply using a screwdriver until the outcoming voltage reading is 5.0 Volts. Reference the picture below.
    • Once adjusted, unplug the power.

Testing DIN Rail Power Supply with voltmeter

  • Tighten the cable gland with a wrench to make sure the wires are secure.
  • Use small zip ties to tidy the wires on the inside of the box near the cable gland. Leave the DIN Rail Power Supply detached as there are more wires to install.

Tidying up wires with zip ties

  • Now prepare the fuse holder for build. Insert a 3 Amp AT fuse into fuse holder. Push hard and you should hear a click when it is in place.

Inserting 3 AMP AT fuse

  • The Raspberry Pi is powered by a micro-USB cord connected to the DIN Rail Power Supply and the fuse holder. The USB-A connector of the cord won't be used, so cut off that end. Make the length of the cord 20" so that it can fit in the box.
  • Remove and strip the outer insulation of the cable so that there is enough wire for the black (ground) to reach the power supply ground and red (power) to attach to the fuse holder.
  • Cut 12" of both black wire and red wire to be used as extension wires. Solder and heat shrink to the micro-USB cord to their respective wires.
  • Tin the all ends of the wires.

Preparing micro-USB cord for build

  • Next, configure the wiring on the fuse holder. Connect the red wire from the micro-USB cable to one end of the fuse holder. Screw down to clamp.
  • Cut 6" of red wire. Strip and tin both ends of this wire.
  • Attach one end of this 6" red wire to the other end of the fuse holder. Again, screw down to clamp.

Attaching wires to the fuse holder

  • Connect the wire from the fuse holder to that of the DIN Rail Power Supply.
    • Connect the free end of the red wire from the fuse holder to the positive on power supply box (+v). Screw down to clamp.
    • Connect the free end of the black wire from the micro-USB cable to the negative on power supply box (–v). Screw down to clamp.

Configuring power between the fuse holder and DIN Rail Power Supply

Final Communications Gateway Assembly

  • Attach the power supply to the DIN Rail on the side closest to the cable gland. Reference the picture below to clip the power supply in place.

Attaching Power Supply to DIN Rail

  • Use a wrench to tighten the cable gland now that the power supply is attached to the DIN Rail. This will create a watertight seal.
  • Attach the fuse holder to the DIN rail. The orientation of the fuse holder doesn't matter, but make sure you put it flush with the power supply. You should also hear a click.
  • Attach the Raspberry Pi stack and the camera system to the DIN Rail.
    • First, make sure the camera system is placed on the DIN Rail so that the camera lens fits within the optical dome.
    • Then, attach the Raspberry Pi stack to the DIN Rail close enough to the camera system so that the camera ribbon is not twisted nor stretched to taught. The side of the Raspberry Pi stack with the blue mounting plate should be placed against the fuse holder and the open-side of the Raspberry Pi stack should be facing the camera system.

Installing all attachments to DIN Rail

  • Check the wiring by plugging in the power cable to an outlet. The light on the Raspberry Pi stack should come on.