DabCam

by rutger.van.teutem in Circuits > Cameras

1937 Views, 8 Favorites, 0 Comments

DabCam

IMG_20210528_175434.jpg
img_27-05-2021_12-48-52_Points-854.46.jpg

A camera that takes pictures when you dab.

1 camera and 2 wiresless remotes. The remotes or "Dabcons" measure the current magnitude of acceleration and send that data to the main camera unit. If a large spike is detected in both Dabcons at the same time the camera unit takes a picture and saves it to the Raspberry Pi's SD card with the date and time and combined magnitude.

https://github.com/rutgerVT/DabCam

Supplies

  • 1 Raspberry pi 3A+
  • 1 2.8 inch PiTFT
  • 3 Arduino Nano's
  • 3 nRF24L01 modules
  • 2 MPU6050's
  • 4-6 Lithium Ion 18650 cells
  • 2 1S Charge + voltage regulation circuits
  • 1 2S Charge circuit
  • 1 2S Lithium Ion BMS with balancing
  • 2 DC-DC Step-Down Power Regulator 5v
  • 1 DC-DC Step-Up Regulator 12V
  • 1 Sony IMX335 AHD module
  • 1 AHD to HDMI converter
  • 1 USB HDMI Capture Card
  • 1 Viewfinder from a Sony handycam (optional)
  • 1 HDMI Splitter (optional)
  • 1 HDMI to Composite Video Converter (optional)
  • Some buttons and switches.

Make Sure It Your Camera Works

IMG_20210224_165159.jpg
IMG_20210224_165139.jpg

Take the IMX335 and connect it to the AHD to HDMI converter. Connect a 12 volt power source to the IMX335 and connect the the output of the converter to the USB HDMI capture card. Plug the capture card in to your Raspberry Pi and use ffplay to check everything is working. Fingers crossed you should see the camera feed on your Raspberry Pi. If it doesn't work make sure your USB HDMI capture card is supported by v4l2 and the Raspberry pi. Also make sure the camera and AHD to HDMI converter are powered and turned on. This would also be a good time to setup and test your PiTFT!

Power!

IMG_20210306_123635.jpg
IMG_20210320_031947.jpg

Connect 4 of your 18650's in a S2P2 configuration(Make sure to get cells with tabs and only ever solder to the tabs. Never solder directly to a Lithium cell!). Connect the BMS and the 2S charge circuit. Now test the battery by supplying a voltage to the charge circuit. This will cause the BMS to turn on and start delivering power from and to the batteries. Finally connect the 2 DC-DC Step-Down regulators and the DC-DC Step-Up regulator the the output of the BMS with a switch inbetween so you can turn it on and off. Dial in the output voltage of the Step-Up regulator to 12v. The 2 5v rails will be used to power the Raspberry Pi, Arduino, optional view finder and all the HDMI stuff. The 12v rail will used to power the camera module.

Adding a Nano to the Pi

DabCamPi.PNG

Take one of the Arduino Nano boards and connect one of the nRF24L01 boards to it. Create a voltage divider circuit with 2 resistors to drop 8.4v down to 5v. You can use: https://ohmslawcalculator.com/voltage-divider-calc... to figure out the resistor values. Connect the output of the voltage divider to A6 on the Arduino. This will allow the arduino to tell the Raspberry Pi how much battery we have left. Flash the code found on the Git to the Arduino. (The code requires the "RF24" library from the Library Manager) Now connect the Arduino to the Raspberry Pi using the serial pins. (Make sure to enable the serial pins without shell access on the Raspberry Pi with raspi-config)

(Optional) Viewfinder

IMG_20210227_014952.jpg
IMG_20210227_014944.jpg
IMG_20210321_010036.jpg

Optionally you can take the viewfinder off of an old handycam, reverse engineer the wiring and hook it up for a cool way to see where the camera is pointing. If your viewfinder has a connector start by looking online if anyone has already reverse engineerd the connector. Mine only had wires but the camera I took it from still worked somewhat. So I just opened up the camera and measured to figure out what wire was what. Then I labeled them. To hook it up to the camera you need to add an HDMI splitter to the output of the AHD to HDMI converter then take one output and connect it to the USB HDMI capture card and take the other and connect it to a HDMI to Composite converter. Take the composite video and connect it to the video in pin of the viewfinder. Connect 5v to the power input pins and you're good to go! Just look at that tiny crt go!

Dabcons!

Dabcon.PNG
IMG_20210324_173706.jpg
IMG_20210324_173441.jpg
IMG_20210324_174612.jpg

Connect a 18650 cell to a 1S regulator and charger circuit. Connect the output via a switch to an Arduino Nano. Now connect a MPU6050 and a nRF24L01 to the Arduino. Upload the DabCon code to the arduino and you're good to go. Make sure to set the conNr variable in the code to 1 for the first and 2 for the second dabcon before flashing the code.

The code requires 2 libraries:

  1. https://github.com/jarzebski/Arduino-MPU6050
  2. "RF24" from the Library Manager.

Shells!

IMG_20210410_184013.jpg
IMG_20210527_171128.jpg

Design and print some shells for the camera and dabcons. I've put my STL files in the git if you want to use those but you can of course make your own! The camera prints in several parts that need to be plastic welded together. The dabcons print in 2 pieces and I used cyanoacrylate to put them together. Make sure add some way of charging the dabcons before closing it up. I made a slit in the bottom for a 3 pin reversable connector but you could do something with wireless charging coils.

Putting It All Together!

IMG_20210306_134230.jpg
IMG_20210320_031932.jpg
IMG_20210321_001218.jpg
IMG_20210410_184019.jpg
IMG_20210527_171121.jpg

Add some buttons to the shell. Next to the handle there is a row of holes where you can put tall tack switches. Wire them up to the GPIO pins on the Raspberry Pi.

Upload PiCam.py the Pi and create a "Vids" and "Images" folder in the same location. Open your rc.local file with "sudo nano /etc/rc.local" and add this before "exit 0"

(
  cd /Path/To/Your/Files/
  python3 ./PiCam.py
)

Test and make sure everything works before putting it in the shell. Put it all together and you're done! You can now dab to your hearts content knowing that every dab will be photographed and saved for future use.