This is my first project here and I'm not good at describing things so if you have any questions let me know.

The origin story
===========
This project started with a friend coming up with a number of ideas for new devices to use in paranormal investigation. The idea behind the POD was that it could be left in a locked room overnight in a supposedly haunted location to gather an objective record of everything that happened there, not just visually but using every sensor available to detect any change in enviromental conditions. I'd been planning to try and build a tricorder for some time and it seemed like a close enough project so I offered to have a go at building this instead. It took a number of failed prototypes but eventually I ended up with something that works.


How it works
==========
The current system has 2 parts.


Part 1 is a modified version of Adafruit's Raspberry Pi touchscreen camera. This provides the photography, file handling and user interface functions. It has a NoIR camera for taking photos in infra red, and a PIR sensor for movement detection, but the main mod is the software. The cam.py script has been modified to provide 4 modes of operation (Snapshot, Timelapse, Polyspec, and Investigative). These take a bit of explaination so see the Modes section for a detailed description of each.


Part 2 is a sensor board controlled by an Arduino Nano, containing every sensor I could fit on the board at the time. All components plug into headers on the board so they can easily be replaced or reused without soldering. Included sensors measure temperature (both local and non-contact), humidity, air pressure, magnetic field strength (3 axis), accelleration (3 axis), light (4 bands), sound, and static charge (- and +). To make things simple for the host system, all communication with the sensors is handled by the Arduino. The board needs only a USB connection to a host system to function, and has an extremely simple protocol, explained in the Communication section.


Modes
=====
The camera has 4 modes at the time of writing this. There's still a lot of fine tuning needed and only Snapshot and Timelapse are fully functional.

Snapshot:
This takes a single shot when the user taps the screen, but also gets a reading from the sensor board and logs it in a file called Snapshots.csv. All readings are tagged with the filename of the photo they are taken with. After taking a photo, the photo remains on screen overlayed with the sensor readings until the 2nd tactile button is pressed, then the screen returns to a live view.


Timelapse:
This is configurable through the menus with 2 settings, [Scans] and [Photos]. When the user taps the screen, the backlight shuts down to save power. Following this, a new log file is created in the Logs folder. Every [Scans] seconds the sensor board takes a reading which is added to the log. After every [Photos] readings, a photograph is taken, unless [Photos] is set to 0 for datalogging only. This continues until the 2nd tactile button is pressed, or until the number of photos taken reaches 9999. Logfiles are saved after every sensor reading, so if the camera looses power the data is still safe.


Polyspec:
This is experimental and as of writing incomplete. It is intended to be used with an RGB illuminator that I'm still building, that will be controlled by the RasPi's GPIO pins. Tapping the screen starts a sequence of 4 photographs, each illuminated by a different colour light. Sensor readings are taken at the start and end of the sequence and added to Snapshot.csv. The sequence is currently [ None (natural light only), Red, Green, Blue ] but eventually I plan on upgrading it to [ None, IR, Red, Green, Blue, UV ]. This mode is intended to provide enough data to make composite images with much more colour than the NoIR camera normally provides, although it has very long exposure time due to the number of seperate images it takes.


Investigative:
Technically complete but this still needs some work. This is identical to Timelapse mode, except that whenever the output from the PIR sensor is high, the values of [Scans] and [Photos] are ignored. In this case, both sensor readings and photographs are taken as quickly and as often as possible until the PIR sensor goes low again, at which point it again works like Timelapse mode. In this way, the user can choose to take photographs only if something moves near the camera rather than at regular intervals, making it usefull as a security or wildlife camera. Currently though, there's just too long a delay on taking a photograph for this to work effectively.



Communication
============
The sensor array is controlled and powered by USB through the Arduino. To keep things simple, the Arduino listens for a single character command, then responds with a single line of text. First, a bit of background, some of the sensors can't just accurately take 1 reading. For example to find the volume of ambient sound, you need to read the microphone a load of times, then subtract the lowest value from the highest. With that in mind, each reading from the sensor board is "exposed" over a given time much like a camera. The different commands control how long the exposure lasts, with 2 basic modes being used.
Snap mode exposes the sensors for a fixed time (about 2 seconds) then replies with a reading. This is usefull if you just want to know the conditions right now, and is used for the camera's Snapshot mode
Log mode keeps the sensors exposed until the next time a command is received. This is used to pick up events that happen between readings, and is used for the camera's Timelapse mode.
Note that this variable exposure doesn't apply to all the sensors, anyway, here are the commands...


0
Cancels log mode (if running), resetting all stored minimum and maximum values to defaults. The Arduino replies with a #


1
Takes a reading in Snap mode. This cancels log mode if running. There is a 2 second delay, after which the Arduino replies with a string of comma seperated values ending in a newline character.


2
Takes a reading in Log mode, immediately replying with a string of comma seperated values ending in a newline character. As sensors are constantly exposed between readings while Log mode is running, this does not require an extra delay like Snap mode.


That's the commands covered, now lets take a look at a sample reading...


4.12265086174,0,l,Mag,225,189,-84,207.00,173.88,-77.28,0.70,40.03,BMP,1008.44,9.61,39.39,Lux,261,261,2,Analog,1022,1023,548,DHT,9.20,60.20,Temp,?,?,Long,0.00,0.00,0.00,-1024,


In this case, the 1st and 2nd values are added by the Pi, and represent recording time and frame number respectively. These are different depending on the mode being used, but everything else is from the sensor array.
The 1st value sent, l, identifies the array as running in log mode. Mag, BMP, Lux, Analog, DHT, Temp, and Long, each act as lables to show what sensors the block of numbers that follow them are from. They could be omitted to save space but for now they make things easier to understand. In this case the sensor following Temp has no data available as it hasn't had enough time to take a measurement, so to prevent the order from getting messed up, the arduino inserts ? characters in place of any unavailable values.