Know How...

Mar 14th 2016

Know How... 194

Raspberry Pi Day!

We celebrate pi day with all things Raspberry Pi.
New episodes every Monday at 6:00pm Eastern / 3:00pm Pacific / 22:00 UTC and Thursday at 2:00pm Eastern / 11:00am Pacific / 18:00 UTC.
Category: Help & How To

Build your own Raspberry Pi Security Cam, how to install the official Raspberry Pi 7" touchscreen, and learn the math for how much battery you'll need to power your next project.

Build Your Own Security Camera

Parts Needed

- Raspberry Pi Model B Revision 2.0 (512MB)
- Micro SD card 8GB or higher
- Webcam Logitech HD Webcam C520
- Usb with external Power Supply

Setting up RaspPi
- Prepare / Format your SD Card
- Download Raspbian Jessie Lite
- Download WinDisk Imager (Or image writer for your OS)
- Insert Card and Boot up Pi

Find your IP
- ifconfig

Enable SSH
- sudo raspi-config

Set Up Motion

- sudo apt-get update
- sudo apt-get upgrade

Install Motion
- sudo apt-get install motion

Check if Raspberry Pi sees webcam
- lsusb

You should see the webcam pop up on the list of USB devices

Now to Configure Motion

- sudo nano /etc/motion/motion.conf

In case you're using a RasPi 1 or want to make sure you can get your camera working properly;

- output_pictures off
- ffmpeg_output_movies off
- stream_maxrate 30
- stream_localhost off

"ctrl x" to save.

Set Motion to begin at startup

- sudo nano /etc/default/motion
- start_motion_daemon=yes

Start and Stop Motion

- sudo service motion start
- sudo service motion stop


How long will my battery last?
"I'm trying to figure out the battery life for my lighting project, and I'm hoping you guys can help me out... I have a Lohas 100 watt LED chip, which is being powered by a 5200 mAh 30C lipo. I used an LM2577 power converter to get from ~12v to 35v. While simply knowing the answer would be nice, I'd really like to know how the math works, so I can do it myself in the future." -- 52Degrees

Watt: Unit of Energy per time
Volt: Unit of Electrical Potential
Amp: Unit of Electrical Current

** If you were to think of Volts and Amps in terms of a wave, how high a wave is would be the voltage, and how BIG, or how much water was IN the wave would be the Amperage
** Together, how HIGH and how BIG the wave is determines how much ENERGY the wave can impart over time.

Let's use my favorite equation: "West Virgina" or "Watts = volts x amps"

This is a FANTASTIC relationship for us engineers, because it means we can play with voltage and current to get the amount of wattage that we need for an application

* Let's take a 100 watt bulb
-- I need 100 energy units (watts) over the course of an hour (Watt/Hour) to keep it lit.
* Assuming that the bulb can handle a variable range of voltage and current, there are several ways I can supply that power:
1. I can provide high voltage and low current (i.e. 100 volts & 1 amp)
2. I can provide low voltage and high current (i.e. 1 volt & 100 amps)
3. I can provide something in between (i.e. 10 volts & 10 amps)

** All of these scenarios will give me 100 units of power (watt) over the course of an hour (watt-hour)

Ok... now to HIS question:
* He was a 100Watt/Hour LED
* He has 5300mAh 3S 30C battery

So Let's do the Math!
1. The Battery has 5300mAh of CAPACITY at 11.1 volts (12volts)
2. If we multiply 5.3Ah (that's 5300mAh) by 11.1 volts, we get 58.83Watt/Hours of capacity.
-- This means if we were to pull 58.83 watts of power, the battery would be COMPLETELY drained in an hour.
3. HOWEVER, LiPo batteries have a "discharge rating" (in his case, 30C) -- This determines the MAX current at which you can pull power from the pack.
-- 30c X 11.1 volts = 333 Watts
-- (Capacity of Battery / Discharge) * 60 minutes ---- ((58.83Wh /333Wh) * 60minutes) = 10.6 minutes
-- If we were to pull the full 333 watts of power, we would completely DRAIN the LiPo in 10.6 minutes

* More importantly, we know that the battery, which can safely provide 333 watts of power, can safely power the 100 Watt LED.

** BUT... how LONG will it power the LED?

Let's use the math we just used to see how quickly we would drain the battery at full discharge.
* (Capacity of Battery (58.83Wh) / Discharge rate (100Wh)) * 60 minutes = 35.298 minutes
* That's 35.298 minutes to complete discharge

But we're not done!
* First, let's subtract 20% to account for resistance, voltage conversion and poorly rated batteries
-- Our 38.16 minutes loses 7.63 minutes = 30.528 minutes
* Also... we don't want to run the pack to zero. That's how you destroy your LiPo. I like to run it down 50% before stopping. But you can add a low-voltage warning device to the balance leads to let you know when it goes below 3.3 volts per cell.
-- Our 30 minutes becomes 15 minutes

** SO... he can SAFELY run the light on this LiPo for 15 minute.
-- We're building in A LOT of wiggle room, and I'm betting he could safely get 20-25 minutes, but 15 is the conservative limit.

Using your Multimeter to measure Current
You want to use "DCA" (Direct Current Amps)
1. Connect the probe leads as follows
- Black to "COM"
- Red to mA or 20A (on this meter, mA maxes at 200mA / 20A maxes at 20A for 30 Seconds)

2. Disconnect Power
3. Break the circuit you want to measure, then connect the meter inline
4. Set your meter to measure in Amps or Milliamps
5. Connect power

** Note: NEVER connect an current meter directly to the battery. You will destroy the meter! (Essentially, you create a short-circuit.)

Our RasPi is pulling ~60mAh & our battery is a 11.1v 2200mAh LiPo
** So, running it through the same equations:
Our LiPo has 11.1 x 2.2 = 24.42 Watt/Hours of power available

The Pi will pull 5v * .06 amps = .3 Watt/Hours

We could run the Pi for 80.6 hours
** but this is a COMPLETELY unloaded Pi with no accessories attached.

RasPi Screen

1. Raspberry Pi 2 or 3
2. Official Raspberry Pi 7" Screen

1. Pliers
2. Phillips Screwdriver

1. Connect the large display ribbon from the screen to the back of the adapter board
2. Connect the small display ribbon to the small connector on the front of the adapter board
3. Connect the 4 standoffs THROUGH the adapter board into the mounts on the Pi Screen
4. Connect one end of the DSI ribbon cable to the adapter board.
5. Connect the other end of the DSI ribbon cable to the "Display" port on the Pi
6. Connect the red jumper cable from the 5V pin on the adapter board to the 1st pin on the outside of the GPIO
7. Connect the black jumper cable from the GND pin on the adapter board to the 3rd pin on the outside GPIO

** I suggest a fresh instalation of the latest Distro of Raspbian

Connect with us!