Previous Posts Here:
I am going to catch up a few blog posts and post my code in the AM.
The QuadCOP has a variety of sensors onboard to help it avoid collisions and detect events.
From left to right, top to bottom:
4X Sonic sensors, 4 pin version.
1X PIR motion detector
1X IR flame detector (http://www.amazon.com/gp/product/B00AFSEC2Y?psc=1&redirect=true&ref_=oh_aui_detailpage_o06_s00)
1X mechanical relay
1X Luxeon LED
1X Arduino Nano with header pins.
All of these sensors are digital in that they have a trigger, and then a "Delay". If the delay it too long, it is assumed the sensor did not detect anything. If it does pull the "Echo" pin high, then you time from the point you pulled the trigger pin high to the time the echo pin went high. Then there is a conversion factor of some sort for each sensor to tell you what you need to know.
There are two ping sensors on the bottom for ground detection, and two on the forward nose to detect obstacles.
The IR flame sensor is inside rotating head. This allows flame to be"Scanned" for.
The PIR sensor is for when the QadCOP is docked at its base station, if it detects motion it will fly into action!
The Luxoen LED is for night flying, and is triggered by the mechanical relay.
The Nano is connected to the I2C bus as a slave.
The Nano runs a loop and triggers all sensors in a certain order. If anything is detected, it stores the event in a small queue of 100 items for each Queue. It is a FIFO (First In First Out) Que and will stop recording at 100 items. The RPFS will send a register read to the SensorArray, each register will represent a sensor. When an event is read, a read pointer (stack pointer) is incremented. So each queue has two pointers, a write and read pointer. The data is returned for processing to the RPFS. The data returned is always 2 bytes of data using the I2C block algorithm I created, which will be explained in a later post.
The SensorArray also accepts commands, via another register. The only two commands at this time are "clear all queues" and "Turn on/Off the LED". Each command consist of a register byte, a command code, and the parameter code ( 0 or 1 for on/off). The parameter code only applies to the LED but is still sent for the clear queues command to be consistent.
This is a picture of the I2C bus "splitter" or multiplexer. In the upper middle of the pic is how I am connecting the various I2C items together with the RPFS always the master.
I will post a picture soon of the sensors installed.
Here is the software flow for the code that runs in the Arduino Nano.