Difference between revisions of "TrafficCam"

From Earlham CS Department
Jump to navigation Jump to search
(Tasks)
(Equipment)
 
(103 intermediate revisions by the same user not shown)
Line 1: Line 1:
==TrafficCam==
+
==[http://stewie.cs.earlham.edu:8080/ TrafficCam]==
 
Gear to record video of the pedestrian crossing and the speed of Eastbound traffic in front of Earlham on National Road West.   
 
Gear to record video of the pedestrian crossing and the speed of Eastbound traffic in front of Earlham on National Road West.   
  
Line 30: Line 30:
 
* <s>Linksys WRT54GL</s>
 
* <s>Linksys WRT54GL</s>
 
* Shrubbery
 
* Shrubbery
* [http://www.data-alliance.net/servlet/the-149/Antenna-cable-RP-dsh-SMA-male/Detail 30ft RP-SMA extension cable] (we already have a 10ft one)
+
* [http://cgi.ebay.com/RP-SMA-Extension-Cable-9-METER-Male-Female-WiFi-Pigtail_W0QQitemZ300193409478QQcmdZViewItem 30ft RP-SMA extension cable] or [http://www.amazon.com/Hawking-Outdoor-Antenna-Cable-30/dp/B00008V9D9/ref=pd_bxgy_e_img_a Hawking Cable]
* 20 ft conduit (available locally)
+
* <s>20 ft conduit (available locally)</s>
  
 
===Current wifi card===
 
===Current wifi card===
Line 74: Line 74:
 
* <s>turn off one antenna on router</s>
 
* <s>turn off one antenna on router</s>
 
* <s>install speed sensor</s>
 
* <s>install speed sensor</s>
* redo camera interface to be customized for this project
+
* <s>redo camera interface to be customized for this project</s>
* make a custom 20 ft serial cable
+
* <s>make a custom 20 ft serial cable</s>
* measure power consumption of complete unit
+
* <s>measure power consumption of complete unit</s>
* deploy functional traffic cam unit
+
* <s>deploy functional traffic cam unit</s>
 +
* make website
 +
* generate speed graphs
 +
* integrate speed into video
  
 
===Image volume calculation===
 
===Image volume calculation===
Line 92: Line 95:
 
* Overall duration, 1 year?
 
* Overall duration, 1 year?
 
* Better density
 
* Better density
 +
 +
----
 +
 +
==Documentation==
 +
Written By: Maduna (madunnh)
 +
 +
===Main Hardware===
 +
* '''Pelican Case'''
 +
 +
[[Image:pelican_case.jpg|center|Closed Pelican Case]]
 +
 +
Model: [http://www.pelican-case.com/15caonca.html 1510 Pelican Case]
 +
 +
The case houses most of the hardware of the unit. It contains the battery, power supply, charge controller, router and the single board computer. The components of the case were carefully attached using materials such as velrco, wire-ties and bolts and nuts. The case was initially used for another project ([https://wiki.cs.earlham.edu/index.php/HIP::Keck Keck Water Monitoring Project]), so some of the components i.e. the battery and charge controller were already installed. The position of the charge controller was changed to a 'vertical mount' in order to make room for a secondary battery (if required) and to bring it closer to the power supply unit.
 +
 +
[[Image:p_case_components.jpg|center|Pelican Case with Components]]
 +
 +
The pelican case is strong, weatherproof, durable, portable and fully customizable. One outstanding feature that it has is the pressure valve, which controls the air pressure in the case, providing a safe charging environment for the battery and prevents the case from shrinking / expanding at varying pressure levels, i.e. during a flight.
 +
 +
* '''Battery'''
 +
 +
[[Image:Battery.jpg|center|B.B Battery]]
 +
 +
Model: [http://lib.store.yahoo.net/lib/zbattery/ep28-12b1.pdf EP28-12 B.B. Battery]
 +
 +
The battery is a 12V, 12Ah Lead-Acid rechargeable battery. It was chosen for its dimensions, capacity, operation temperature range and independent operational orientation (charges and discharges in any position). Even though the battery was not specially chosen for this project, its capacity was calculated to be sufficient for this project's hardware. The battery powers all the components of the unit.
 +
 +
* '''Charge Controller'''
 +
 +
[[Image:Charge_controller.jpg|center|Phocos Charge Controller]]
 +
 +
Model: [http://store.altenergystore.com/mmsolar/others/Phocos_User_Manual_CML2_all.pdf Phocos CML10-2]
 +
 +
This is a 10A, 12/24V charge controller specially chosen for its compatibility with the battery and ability to charge the battery using a solar panel. Due to the high power demand of the components and the significance this project, solar power was tested to be unreliable, especially at the deployment site where there are a lot of tall trees. Instead of a solar panel, a power supply was used. The charge controller regulates the battery charge, and safely powers the components at the same time.
 +
 +
* '''Power Supply'''
 +
 +
[[Image:Power_supply.jpg|center|Mean Well Power Supply]]
 +
 +
Model: [http://www.switching-powersupplies.com/pfc-series.html Mean Well SP-150-15]
 +
 +
The power supply takes normal 115V AC and outputs 15V, 0~10A which is in the range of the output of a solar power panel compatible with our charge controller and battery. The deployment site is far from any buildings with a continuous supply of AC power, but luckily, there is a streetlight near by. Because the street lights use regulated power and only turn on at nighttime, the power supply charges the battery at night and then the battery powers the unit during daytime.
 +
 +
* '''Router'''
 +
 +
[[Image:Router.jpg|center|Linksys WRT54G Router]]
 +
 +
Model: [http://www.linksys.com/servlet/Satellite?c=L_Product_C2&childpagename=US%2FLayout&cid=1149562300349&pagename=Linksys%2FCommon%2FVisitorWrapper Linksys WRT54G]
 +
 +
The router acts as a wireless adapter for the unit. It's firmware was upgraded to [http://www.dd-wrt.com/ DD-WRT] and it was configured to run in client mode.
 +
The router is connected to the directional wireless antenna and does port forwading to the single board computer (ports 22 [ssh] and 23 [telnet]) and the video camera (ports 80 [http] and 554 [mms]). The router was configured to connect to our local wireless network assign IP addresses to the camera and computer using static dhcp.
 +
 +
* '''Single Board Computer'''
 +
 +
[[Image:Pmp.jpg|center|TS-7260 aka PMP6]]
 +
 +
Model: [http://www.embeddedarm.com/products/board-detail.php?product=TS-7260 TS-7260 Arm SBC]
 +
 +
This board was chosen for most of its outstanding features, especially its wide input voltage range and robustness. Also, it is the same board being used by the water monitoring project mentioned above. The TS-7260 was nicknamed PMP6; meaning Portable Monitoring Platform #6. The pmp6 retrieves speed data from the radar and archives it in its flash memory. At regular time intervals, the pmp6 sends the data to a Host machine where it is processed and synchronized with the camera's video recording. The pmp6 uses a software stack described in detail under the client software section below.
 +
 +
* '''Directional Wifi Antenna'''
 +
 +
[[Image:Antenna.jpg|center|Hawking Directional Antenna]]
 +
 +
Model: [http://www.hawkingtech.com/downloads.php?file_id=3585 Hawking HAO14SDP]
 +
 +
The outdoor ''di-wifi antenna'' as I call it, was chosen for its long range and compatibility with our router's antenna socket. (This is the right thing to say now, but the truth is that the antenna was chosen because it was compatible with our first computer; pmp1, a TS-5600 with an ORiNOCO 802.11b PCMCIA Wireless Network Card, which was not a successful approach). For more information about this Approaches, refer to the "Unsuccessful Approaches" section below.
 +
 +
The di-wifi antenna is connected to the router's antenna socket using a 30ft Hawking HAC30N cable (purchased separately), and replaces one of the router's stock antenna. The other router's antenna was removed and turned off using the dd-wrt software, in order to save battery power. The antenna was mounted on a post and pointed towards one of the building with a wireless access point.
 +
 +
* '''Network Video Camera'''
 +
Model: [http://www.axis.com/files/datasheet/ds_210_211_32849_en_0809_lo.pdf Axis 211]
 +
 +
We own an older model a similar camera used the [http://www.cs.earlham.edu/ Weather Monitoring Project], and because of the Axis camera's features and durability, it was our #1 choice. The 211 model streams the video in mjpeg and mpeg4 formats which are both useful to us (refer to the Host Software section below). The camera can be powered using either Power Over Ethernet (POE) or a 12V DC adapter. We decided to use the 12V adapter in order to avoid complications with engineering POE and possibly borking our router and laptops during configuration, testing and debugging.
 +
 +
The router gives access to the camera's video stream using the already mentioned port forwarding to the Host machine and admins. The camera is connected to the battery and the router using a 25ft 2-wire cable and an Ethernet cable of the same length. These cables and the radar cable, run inside a conduit which connects the camera case to the  pelican case.
 +
 +
* '''Camera Case'''
 +
 +
[[Image:Camera_case_and_radar.jpg|center|Axis Camera Case and Houston Doppler Radar]]
 +
 +
Model: [http://www.axis.com/files/datasheet/ds_ach13hb_25355_us_0508_lo.pdf AXIS ACH13HB]
 +
 +
This is the outdoor default case/housing for the camera. It has a sun shield and a heater/fan inside it, to warm/cool the camera. We are currently not using the heater/fan because the case will be well protected from the sun by shrubs and also the camera gives off enough heat to warm itself up in the cold.
 +
 +
The camera case is connected to the pelican case as described above. The case was modified to fit the conduit and to also attach a mounting point for the radar (see images).
 +
 +
* '''Doppler Radar'''
 +
Model: [http://houston-radar.com/gpage.html DR500C Doppler Traffic Radar]
 +
 +
This radar was the best choice we made for the project. I has functionality and software that is beyond our use. The DR500C was chosen for its range, simple interface and most importantly for its inbuilt intelligence. It detects vehicles and calculate their speed, which can then be captured via the radar's serial interface.
 +
 +
The radar is powered via a specially engineered cable unit which consists of 2 serial to Ethernet adapters, a 20ft Ethernet cable, a custom made serial cable which connects the TS-7260's COM2 to one of the serial to Ethernet adapters. This custom made cable is at the ''pmp6-end'' of the connection and it also provides 12V DC to the radar via pin 1 (+12V DC) and pin 5 (Ground [-12VDC]), which is sourced from the battery via the charge controller (see image). At the ''radar-end'', the Ethernet cable is connected to the radar via the other serial to Ethernet adapter.
 +
 +
[[Image:Serial_to_ethernet_cable.jpg|center|Custom Serial Cable (grey), Serial to Ethernet Adapter (black) and Ethernet Cable (yellow)]]
 +
 +
The radar is mounted under the camera case using a custom made U-shaped clamp. The data output from the radar is a 3-digit number representing the speed in mph. A software stack running on the pmp (see below for details) captures the speed and stores it locally.
 +
 +
===Software===
 +
 +
All scripts can be viewed in [http://stewie.cs.earlham.edu/trac.cgi/browser/trafficcam_scripts svn] running on the host.
 +
 +
* '''Client - PMP6 and Camera'''
 +
SPEED DATA PATH: speed-data --> get_image_d --> get_speed.pl --> transfer-speed-files.sh --> host
 +
LIVE VIEW SPEED DATA PATH: ... --> get_speed.pl --> apache [port 8080] --> website on host
 +
 +
'''''get_image_d''''': daemon in /etc/init.d/ that starts get_speed.pl
 +
 +
'''''get_speed.pl''''': perl script in /root/scripts/ that captures the speed output from the serial console of the radar via the pmp's COM2 and stores the data in /root/data/
 +
 +
'''''transfer-speed-files.sh''''': shell script that moves the data from /root/data/ to /root/archive and then to /media/d0/traffic-cam/speed_cache on the host
 +
 +
VIDEO CAPTURE PATH: camera http server --> router --> host
 +
VIDEO STREAM PATH: ... --> host
 +
 +
'''''Cron'''''
 +
 +
File: /root/cron/crontab
 +
28 * * * *  /root/scripts/kill_get_speed.sh                          > /dev/null 2>&1
 +
29 * * * *  export TZ=EST05EDT; /root/scripts/transfer-speed-files.sh > /dev/null 2>&1
 +
30 * * * *  export TZ=EST05EDT; /root/scripts/get_speed.pl            > /dev/null 2>&1
 +
 +
* '''Host - Stewie'''
 +
SPEED DATA PATH: speed-data-files --> archive_speed.pl --> database
 +
 +
'''''archive_speed.pl''''': perl script that stores speed data from file into user '''hip''''s PostgreSQL database in a table called '''traffic_speed'''
 +
 +
LIVE SPEED DATA PATH: under development
 +
VIDEO CAPTURE DATA PATHS: capture_script --> cache_directory --> archiving_script --> archive_directory
 +
 +
'''''video capture scripts'''''
 +
* The various video capture and archiving scripts are in /media/d0/traffic-cam/scripts/
 +
** get_image.sh
 +
** get_mjpeg.sh
 +
** get_mpeg4.sh
 +
** archive_images.sh
 +
** archive_videos.sh
 +
* The cache and archive directories are in /media/d0/traffic-cam/
 +
** image_cache
 +
** video_cache
 +
** image_archive
 +
** video_archive
 +
* '''capture formats'''
 +
** JPEG (still image)
 +
** MJPEP
 +
** MPEG4
 +
 +
VIDEO STREAM PATH: apache [port 8080] -> [http://stewie.cs.earlham.edu:8080/ host webserver]
 +
 +
'''''Cron'''''
 +
 +
User '''hip''''s crontab
 +
# m h  dom mon dow  command
 +
#
 +
# LOG
 +
*/15 * * * * /media/d0/traffic-cam/scripts/log_down_time.sh    > /dev/null 2>&1
 +
#
 +
# IMAGES
 +
#*/10 * * * * /media/d0/traffic-cam/scripts/archive_images.sh  > /dev/null 2>&1
 +
#
 +
# VIDEO
 +
*/10 * * * * /home/hip/traffic-cam/scripts/archive_videos.sh  > /dev/null 2>&1
 +
#
 +
# SPEED
 +
*/2 * * * *  /home/hip/traffic-cam/scripts/archive_speed.pl Front_Campus n > /dev/null 2>&1
 +
 +
===Access Information===
 +
* '''Camera'''
 +
** ''user'': root
 +
** ''pass'': default pmp password
 +
* '''PMP6'''
 +
** ''user'': root
 +
** ''pass'': default pmp password
 +
* '''Database on Stewie'''
 +
** ''user'': hip
 +
** ''database'': hip
 +
** ''table'': traffic_speed
 +
 +
===Security===
 +
* '''Locks + Chains'''
 +
All lockable gear will be locked using padlocks and chains where possible
 +
* '''Camouflage'''
 +
Cases, conduit and cable were painted brown and green to camouflage the unit
 +
* '''Shrubs'''
 +
* Two 6-7ft shrubs will be planted on each side of the post on which the camera & radar will be mounted
 +
 +
===Unsuccessful Approaches===
 +
* ''Using pmp1 (a [http://www.embeddedarm.com/products/board-detail.php?product=TS-5600 TS-5600] single board computer with an Orinoco wireless card)''
 +
This is a stable board with and x86 architecture, it would have been much easier to develop software for it. The main problem was that it runs a custom technologic systems kernel, which is version 2.4 and we could not successfully re-build it to enable port Ipchains/tables for port forwarding. The main idea was to let the pmp collect the speed-data from the radar and also do port 80 forwarding to the camera via a cross-over cable.
 +
 +
Later we figured out that with this choice of pmp, (with the wifi card connected to the Hawking directional antenna using a MC to RP-SMA cable with an RP-SMA extension cable) was going to use around the same battery power as a fully functional router with inbuilt port-forwarding and wifi capabilities. As a result, we switched to the current pmp6 (TS-7260) and then added the Linksys WRT54G router.
 +
 +
* ''Choice of Radar''
 +
Our initial radar choice was a [http://www.datrontechnology.co.uk/img/dummy/sensors_systems/pdf/DRS1000E(11).pdf Delta Speed Sensor DRS1000] which costs more that double the cost of the Houston-Radar DR500S, was not only going to be expensive, but was also gonna require us to develop engineer cables and software to capture and convert its output into a speed value in mph.
 +
 +
After some extensive searching, we found the DR500S which is more advanced, much cheaper and available in the US.
 +
 +
----
 +
 +
==TrafficCam HOWTO==
 +
 +
=== Equipment ===
 +
* Network camera
 +
 +
* Compatible camera housing
 +
 +
* Single Board Computer
 +
** must have port-forwarding capabilities (if not, a Linksys router with DD-WRT firmware can take care of that [if using router, only 1 Ethernet jack is needed on computer])
 +
** may need to have wireless capabilities (depending on the available network)
 +
** if not using wireless, may need to have more than one Ethernet jack (1 for Ethernet and 1 for port forwarding)
 +
** may need to have Perl and SSH (depending of software scripts)
 +
 +
* Traffic Doppler radar
 +
** must have a compatible interface with the single board computer
 +
 +
* Good, reliable internet connection
 +
** If Wired (may require a computer with at least 2 Ethernet jacks)
 +
** Wireless (will require a computer that has wifi capabilities)
 +
** External Wireless Antenna (if signal is weak)
 +
 +
* Power Source
 +
** '''Either''' a compatible solar panel + battery + charge controller
 +
** '''OR''' AC power (may need to be converted to DC)
 +
 +
* Server
 +
** running a database server
 +
** running a webserver
 +
** capable of converting between various video formats
 +
 +
* Lots of compatible cables (if applicable)
 +
** power cable to computer
 +
** power cable to camera (or use PoE if available)
 +
** power to radar (depends on radar model)
 +
** cross-over cable from computer to camera (if not using a router)
 +
** Ethernet cable from router to camera
 +
** Ethernet cable from router to computer
 +
** communication cable from radar to computer
 +
** power cable from solar panel to charge controller
 +
** short cables from battery to charge controller
 +
** power cable from main AC to AC converter
 +
 +
* Posts
 +
** wireless antenna post (if using an external wireless antenna)
 +
** camera mounting post
 +
 +
* Security Measures
 +
** camouflage trafficcam unit (can spray paint bright colored pars of unit)
 +
** Lock camera case
 +
** Lock pelican case
 +
** Lock trafficcam unit onto something, i.e tree
 +
 +
=== Procedure ===
 +
 +
'''''TrafficCam Unit'''''
 +
 +
# Install case components [refer do documentations pictures]
 +
# Install camera in camera case
 +
# Mount camera on post
 +
# Generate SSH keys to work between trafficcam unit and server
 +
# Properly connect all components of units
 +
# Create cron jobs and configure computer's different processes i.e. speed recording, file transfer, data processing, port-forwarding, etc
 +
 +
'''''Server'''''
 +
# Install and configure database
 +
# Install and configure webserver
 +
# Generate SSH keys to work between server and trafficcam unit
 +
# Create cron jobs for different processes i.e. video encoding, speed data processing, etc
 +
 +
----
 +
Send Questions To: [mailto:madunnh@cs.earlham.edu Nhlanhla Maduna]

Latest revision as of 16:27, 21 October 2008

TrafficCam

Gear to record video of the pedestrian crossing and the speed of Eastbound traffic in front of Earlham on National Road West.

Research

Shopping

Current wifi card

Current battery and charge controller

Possible technologies

  • Technologic Systems single-board computer
  • WiFi interface with directional antenna
  • DRS1000 Delta speed sensor
  • Axis weatherproof camera - Consider the AXIS 211
  • POE injector - homebrew with e.g. Linksys vs one with native 12VDC input capability
  • Weatherproof case - Consider the AXIS ACH13HB, the datasheet is available at the same URL as the AXIS 211 camera (above) or the AXIS 290B
  • Mounting pole
  • Step ladder
  • Rope
  • Power Source
  • Large IDE HDD (750GB / 1TB)

Tasks

  • upgrade Stewie's HDD
  • stop webcam cron jobs
  • unmount weather cam from roof
  • prepare green pelican case
  • prepare pmp1
  • prepare wifi antenna
  • mount cam in enclosure on Dennis roof
  • update cacti hdd monitoring
  • configure stewie BIOS
  • disconnect cam in closet
  • rename new HDD on stewie
  • ask for the pmp1's EC WiFi IP to be available from off-campus
  • log power up for pmp and cam using cron
  • control wifi up/down on boot
  • camouflage / paint bright colored gear
  • port forwarding using router
  • change camera power cable
  • capture an MPG-4 / MJPEG @ 15 FPS and stream to stewie via pmp1 port 80 / 554
  • turn off one antenna on router
  • install speed sensor
  • redo camera interface to be customized for this project
  • make a custom 20 ft serial cable
  • measure power consumption of complete unit
  • deploy functional traffic cam unit
  • make website
  • generate speed graphs
  • integrate speed into video

Image volume calculation

  • 60 seconds/minute x 60 minutes/hour x 24 hours/day x 7 days/week x 4.5 weeks/month x 12 months/year = 32,659,200 seconds/year
  • 1 frame/second x 20 KB/frame x 32,659,200 seconds/year = 653,184,000 KB/year or 637,875 MB/year or 623 GB/year

Software architecture:

  • Cache 2 minutes locally
  • Use infobomb stack to transfer and append to current day's movie
  • 4a-3:59a movies, sync with infobomb and roll-over, simple trac or fancydir listing by year-month

Questions for Doug

  • Interface - 1 second frames, manual video review, automated video review, speed/video correlation,
  • Overall duration, 1 year?
  • Better density

Documentation

Written By: Maduna (madunnh)

Main Hardware

  • Pelican Case
Closed Pelican Case

Model: 1510 Pelican Case

The case houses most of the hardware of the unit. It contains the battery, power supply, charge controller, router and the single board computer. The components of the case were carefully attached using materials such as velrco, wire-ties and bolts and nuts. The case was initially used for another project (Keck Water Monitoring Project), so some of the components i.e. the battery and charge controller were already installed. The position of the charge controller was changed to a 'vertical mount' in order to make room for a secondary battery (if required) and to bring it closer to the power supply unit.

Pelican Case with Components

The pelican case is strong, weatherproof, durable, portable and fully customizable. One outstanding feature that it has is the pressure valve, which controls the air pressure in the case, providing a safe charging environment for the battery and prevents the case from shrinking / expanding at varying pressure levels, i.e. during a flight.

  • Battery
B.B Battery

Model: EP28-12 B.B. Battery

The battery is a 12V, 12Ah Lead-Acid rechargeable battery. It was chosen for its dimensions, capacity, operation temperature range and independent operational orientation (charges and discharges in any position). Even though the battery was not specially chosen for this project, its capacity was calculated to be sufficient for this project's hardware. The battery powers all the components of the unit.

  • Charge Controller
Phocos Charge Controller

Model: Phocos CML10-2

This is a 10A, 12/24V charge controller specially chosen for its compatibility with the battery and ability to charge the battery using a solar panel. Due to the high power demand of the components and the significance this project, solar power was tested to be unreliable, especially at the deployment site where there are a lot of tall trees. Instead of a solar panel, a power supply was used. The charge controller regulates the battery charge, and safely powers the components at the same time.

  • Power Supply
Mean Well Power Supply

Model: Mean Well SP-150-15

The power supply takes normal 115V AC and outputs 15V, 0~10A which is in the range of the output of a solar power panel compatible with our charge controller and battery. The deployment site is far from any buildings with a continuous supply of AC power, but luckily, there is a streetlight near by. Because the street lights use regulated power and only turn on at nighttime, the power supply charges the battery at night and then the battery powers the unit during daytime.

  • Router
Linksys WRT54G Router

Model: Linksys WRT54G

The router acts as a wireless adapter for the unit. It's firmware was upgraded to DD-WRT and it was configured to run in client mode. The router is connected to the directional wireless antenna and does port forwading to the single board computer (ports 22 [ssh] and 23 [telnet]) and the video camera (ports 80 [http] and 554 [mms]). The router was configured to connect to our local wireless network assign IP addresses to the camera and computer using static dhcp.

  • Single Board Computer
TS-7260 aka PMP6

Model: TS-7260 Arm SBC

This board was chosen for most of its outstanding features, especially its wide input voltage range and robustness. Also, it is the same board being used by the water monitoring project mentioned above. The TS-7260 was nicknamed PMP6; meaning Portable Monitoring Platform #6. The pmp6 retrieves speed data from the radar and archives it in its flash memory. At regular time intervals, the pmp6 sends the data to a Host machine where it is processed and synchronized with the camera's video recording. The pmp6 uses a software stack described in detail under the client software section below.

  • Directional Wifi Antenna
Hawking Directional Antenna

Model: Hawking HAO14SDP

The outdoor di-wifi antenna as I call it, was chosen for its long range and compatibility with our router's antenna socket. (This is the right thing to say now, but the truth is that the antenna was chosen because it was compatible with our first computer; pmp1, a TS-5600 with an ORiNOCO 802.11b PCMCIA Wireless Network Card, which was not a successful approach). For more information about this Approaches, refer to the "Unsuccessful Approaches" section below.

The di-wifi antenna is connected to the router's antenna socket using a 30ft Hawking HAC30N cable (purchased separately), and replaces one of the router's stock antenna. The other router's antenna was removed and turned off using the dd-wrt software, in order to save battery power. The antenna was mounted on a post and pointed towards one of the building with a wireless access point.

  • Network Video Camera

Model: Axis 211

We own an older model a similar camera used the Weather Monitoring Project, and because of the Axis camera's features and durability, it was our #1 choice. The 211 model streams the video in mjpeg and mpeg4 formats which are both useful to us (refer to the Host Software section below). The camera can be powered using either Power Over Ethernet (POE) or a 12V DC adapter. We decided to use the 12V adapter in order to avoid complications with engineering POE and possibly borking our router and laptops during configuration, testing and debugging.

The router gives access to the camera's video stream using the already mentioned port forwarding to the Host machine and admins. The camera is connected to the battery and the router using a 25ft 2-wire cable and an Ethernet cable of the same length. These cables and the radar cable, run inside a conduit which connects the camera case to the pelican case.

  • Camera Case
Axis Camera Case and Houston Doppler Radar

Model: AXIS ACH13HB

This is the outdoor default case/housing for the camera. It has a sun shield and a heater/fan inside it, to warm/cool the camera. We are currently not using the heater/fan because the case will be well protected from the sun by shrubs and also the camera gives off enough heat to warm itself up in the cold.

The camera case is connected to the pelican case as described above. The case was modified to fit the conduit and to also attach a mounting point for the radar (see images).

  • Doppler Radar

Model: DR500C Doppler Traffic Radar

This radar was the best choice we made for the project. I has functionality and software that is beyond our use. The DR500C was chosen for its range, simple interface and most importantly for its inbuilt intelligence. It detects vehicles and calculate their speed, which can then be captured via the radar's serial interface.

The radar is powered via a specially engineered cable unit which consists of 2 serial to Ethernet adapters, a 20ft Ethernet cable, a custom made serial cable which connects the TS-7260's COM2 to one of the serial to Ethernet adapters. This custom made cable is at the pmp6-end of the connection and it also provides 12V DC to the radar via pin 1 (+12V DC) and pin 5 (Ground [-12VDC]), which is sourced from the battery via the charge controller (see image). At the radar-end, the Ethernet cable is connected to the radar via the other serial to Ethernet adapter.

Custom Serial Cable (grey), Serial to Ethernet Adapter (black) and Ethernet Cable (yellow)

The radar is mounted under the camera case using a custom made U-shaped clamp. The data output from the radar is a 3-digit number representing the speed in mph. A software stack running on the pmp (see below for details) captures the speed and stores it locally.

Software

All scripts can be viewed in svn running on the host.

  • Client - PMP6 and Camera
SPEED DATA PATH: speed-data --> get_image_d --> get_speed.pl --> transfer-speed-files.sh --> host
LIVE VIEW SPEED DATA PATH: ... --> get_speed.pl --> apache [port 8080] --> website on host

get_image_d: daemon in /etc/init.d/ that starts get_speed.pl

get_speed.pl: perl script in /root/scripts/ that captures the speed output from the serial console of the radar via the pmp's COM2 and stores the data in /root/data/

transfer-speed-files.sh: shell script that moves the data from /root/data/ to /root/archive and then to /media/d0/traffic-cam/speed_cache on the host

VIDEO CAPTURE PATH: camera http server --> router --> host
VIDEO STREAM PATH: ... --> host

Cron

File: /root/cron/crontab

28 * * * *   /root/scripts/kill_get_speed.sh                           > /dev/null 2>&1
29 * * * *   export TZ=EST05EDT; /root/scripts/transfer-speed-files.sh > /dev/null 2>&1
30 * * * *   export TZ=EST05EDT; /root/scripts/get_speed.pl            > /dev/null 2>&1
  • Host - Stewie
SPEED DATA PATH: speed-data-files --> archive_speed.pl --> database

archive_speed.pl: perl script that stores speed data from file into user hip's PostgreSQL database in a table called traffic_speed

LIVE SPEED DATA PATH: under development
VIDEO CAPTURE DATA PATHS: capture_script --> cache_directory --> archiving_script --> archive_directory

video capture scripts

  • The various video capture and archiving scripts are in /media/d0/traffic-cam/scripts/
    • get_image.sh
    • get_mjpeg.sh
    • get_mpeg4.sh
    • archive_images.sh
    • archive_videos.sh
  • The cache and archive directories are in /media/d0/traffic-cam/
    • image_cache
    • video_cache
    • image_archive
    • video_archive
  • capture formats
    • JPEG (still image)
    • MJPEP
    • MPEG4
VIDEO STREAM PATH: apache [port 8080] -> host webserver

Cron

User hip's crontab

# m h  dom mon dow   command
#
# LOG
*/15 * * * * /media/d0/traffic-cam/scripts/log_down_time.sh    > /dev/null 2>&1
#
# IMAGES
#*/10 * * * * /media/d0/traffic-cam/scripts/archive_images.sh  > /dev/null 2>&1
#
# VIDEO
*/10 * * * * /home/hip/traffic-cam/scripts/archive_videos.sh  > /dev/null 2>&1
#
# SPEED
*/2 * * * *   /home/hip/traffic-cam/scripts/archive_speed.pl Front_Campus n > /dev/null 2>&1

Access Information

  • Camera
    • user: root
    • pass: default pmp password
  • PMP6
    • user: root
    • pass: default pmp password
  • Database on Stewie
    • user: hip
    • database: hip
    • table: traffic_speed

Security

  • Locks + Chains

All lockable gear will be locked using padlocks and chains where possible

  • Camouflage

Cases, conduit and cable were painted brown and green to camouflage the unit

  • Shrubs
  • Two 6-7ft shrubs will be planted on each side of the post on which the camera & radar will be mounted

Unsuccessful Approaches

  • Using pmp1 (a TS-5600 single board computer with an Orinoco wireless card)

This is a stable board with and x86 architecture, it would have been much easier to develop software for it. The main problem was that it runs a custom technologic systems kernel, which is version 2.4 and we could not successfully re-build it to enable port Ipchains/tables for port forwarding. The main idea was to let the pmp collect the speed-data from the radar and also do port 80 forwarding to the camera via a cross-over cable.

Later we figured out that with this choice of pmp, (with the wifi card connected to the Hawking directional antenna using a MC to RP-SMA cable with an RP-SMA extension cable) was going to use around the same battery power as a fully functional router with inbuilt port-forwarding and wifi capabilities. As a result, we switched to the current pmp6 (TS-7260) and then added the Linksys WRT54G router.

  • Choice of Radar

Our initial radar choice was a Delta Speed Sensor DRS1000 which costs more that double the cost of the Houston-Radar DR500S, was not only going to be expensive, but was also gonna require us to develop engineer cables and software to capture and convert its output into a speed value in mph.

After some extensive searching, we found the DR500S which is more advanced, much cheaper and available in the US.


TrafficCam HOWTO

Equipment

  • Network camera
  • Compatible camera housing
  • Single Board Computer
    • must have port-forwarding capabilities (if not, a Linksys router with DD-WRT firmware can take care of that [if using router, only 1 Ethernet jack is needed on computer])
    • may need to have wireless capabilities (depending on the available network)
    • if not using wireless, may need to have more than one Ethernet jack (1 for Ethernet and 1 for port forwarding)
    • may need to have Perl and SSH (depending of software scripts)
  • Traffic Doppler radar
    • must have a compatible interface with the single board computer
  • Good, reliable internet connection
    • If Wired (may require a computer with at least 2 Ethernet jacks)
    • Wireless (will require a computer that has wifi capabilities)
    • External Wireless Antenna (if signal is weak)
  • Power Source
    • Either a compatible solar panel + battery + charge controller
    • OR AC power (may need to be converted to DC)
  • Server
    • running a database server
    • running a webserver
    • capable of converting between various video formats
  • Lots of compatible cables (if applicable)
    • power cable to computer
    • power cable to camera (or use PoE if available)
    • power to radar (depends on radar model)
    • cross-over cable from computer to camera (if not using a router)
    • Ethernet cable from router to camera
    • Ethernet cable from router to computer
    • communication cable from radar to computer
    • power cable from solar panel to charge controller
    • short cables from battery to charge controller
    • power cable from main AC to AC converter
  • Posts
    • wireless antenna post (if using an external wireless antenna)
    • camera mounting post
  • Security Measures
    • camouflage trafficcam unit (can spray paint bright colored pars of unit)
    • Lock camera case
    • Lock pelican case
    • Lock trafficcam unit onto something, i.e tree

Procedure

TrafficCam Unit

  1. Install case components [refer do documentations pictures]
  2. Install camera in camera case
  3. Mount camera on post
  4. Generate SSH keys to work between trafficcam unit and server
  5. Properly connect all components of units
  6. Create cron jobs and configure computer's different processes i.e. speed recording, file transfer, data processing, port-forwarding, etc

Server

  1. Install and configure database
  2. Install and configure webserver
  3. Generate SSH keys to work between server and trafficcam unit
  4. Create cron jobs for different processes i.e. video encoding, speed data processing, etc

Send Questions To: Nhlanhla Maduna