So, if I were to link two Uno's over I2C, and think big picture. The thought is, that the master should contain all the devices neccesary for the driving and autopilot, while the slave should have the peripherals. What this allows, that the boards only talk during the autopilot, in which case I just send the slave a simple signal, which runs the autopilot function on the slave drive for the peripherals.
Now, I know somebody will tell me to go to a Mega. But my question with the mega, is does it have the same PulseIn CPU usage (30% per pin) as the Uno? If so, it makes more sense to me to use more Uno's and split the reading between two processors.
That said, given the layout below, I have 5 ping sensors and 3 PWM Rx inputs. On the ping sensors, the fronts only get polled moving forward, and the backs only get polled moving backwards, and they're only used during autopilot, which means it's not listening for Rx CH1 or 2. Thus,
--RF control
Rx CH1
Rx CH2
Belly Ping
--Autopilot
Forward--
Left Front Ping
Right Front Ping
Belly Ping
Backwards--
Left Rear Ping
Right Rear Ping
Belly Ping
On top of that, I'll only be pinging the sensors on half second intervals on Autopilot. So theoretically, I could have all 3 pulseIns running at once, with the front or back sensors on the 0, 0.5, 1.0, ect time scale, and the belly ping on the 0.25, 0.75, 1.25, 1.75, ect scale. The problem would be on manual RF control, I'd like to ping the belly sensor while driving, although not totally necessary- I should have 7" from the ground to the lowest electronics (which will be shielded from splash), but I'd like to never go through anything deeper than 5". Ideally, I'd be able to use the ping sensor to override the stick's throttle settings when something was in a certain range (say, 3" from sensor).
If I could do that, then I'd be perfectly set with a Mega board.
8 analog pins (lose 6 for comm channel)
12 PWM channels
12 solid state digital channels
Bluetooth Interface
Rx CH1 input
Rx CH2 input
Rx CH3 input
Rx CH4 input
Rx CH5 input
Rx CH6 input
Left Motor Drive
Left Motor Direction
Right Motor Drive
Right Motor Direction
Stepper Motor Drive
Stepper Motor Direction
Winch Motor Drive
Winch Motor Direction
Cargo Box Forward Limit Switch
Cargo Box Lower Limit Switch
Left Servo Drive
Right Servo Drive
Camera Servo Drive
Lighting System
LDR/Light Sensor for Lighting System
Longitudinal Tilt Switch
Left Front Ping Sensor
Right Front Ping Sensor
Right Rear Ping Sensor
Left Rear Ping Sensor
Belly Ping Sensor
I count 28 devices
- 1 bluetooth modem (2 pins)
- 3 PWM Rx inputs
- 3 Solid State Rx inputs
- 5 ping sensors (input)
- 3 servos (PWM output)
- 4 motor drives (PWM output)
- 4 directional controls (digital)
- 1 LDR/Light Sensor input (digital)
- 1 Lighting System Output (digital)
- 2 Limit Switch inputs (digital)
- 1 Tilt Switch Input (digital)
=
- 1 Comm Channel (BT)
- 7 PWM outputs
- 7 digital inputs
- 5 digital outputs
- 8 PWM inputs (ping sensors + 3 Rx channels)
Which would have to be divided like so:
-----Master-
Bluetooth Modem
PWM input-
Rx CH1
Rx CH2
Left Front Ping Sensor
Right Front Ping Sensor
Right Rear Ping Sensor
Left Rear Ping Sensor
Digital input-
Longitudinal Tilt Switch
LDR/Light Sensor
Rx CH6
PWM output-
Left Motor Speed
Right Motor Speed
Digital output-
Lighting System
Left Motor Direction
Right Motor Direction
-----Slave-
PWM input-
Rx CH3
Belly Ping Sensor
Digital input-
Rx CH4
Rx CH5
Cargo Front Limit Switches
Cargo Bottom Limit Switches
PWM output-
Left Servo Control
Right Servo Control
Stepper Motor Speed
Winch Motor Speed
Camera Servo
Digital output-
Stepper Motor Direction
Winch Motor Direction
// Pins 3, 5, 6, 9, 10, 11 are PWM.
// Pins 2, 4, 7, 8, 12, 13 are Digital.
// Pins A0, A1, A2, A3, A4, A5 are analog.
Master.Pin0- Bluetooth
Master.Pin1- Bluetooth
Master.Pin2- Rx CH1
Master.Pin3- Left motor drive
Master.Pin4- Rx CH2
Master.Pin5- Right motor drive
Master.Pin6- empty PWM
Master.Pin7- Left Motor Direction
Master.Pin8- Right Motor Direction
Master.Pin9- empty PWM
Master.Pin10- empty PWM
Master.Pin11- Longitudinal Tilt Switch
Master.Pin12- Left Front Ping Sensor
Master.Pin13- Right Front Ping Sensor
Master.PinA0- Rx CH6
Master.PinA1- Left Rear Ping Sensor
Master.PinA2- right Rear Ping Sensor
Master.PinA3- empty
Master.PinA4- I2C
Master.PinA5- I2C
Slave.Pin0- reserved Rx/Tx
Slave.Pin1- reserved Rx/Tx
Slave.Pin2- Rx CH5
Slave.Pin3- Camera Servo
Slave.Pin4- Rx CH3
Slave.Pin5- Winch Motor Control
Slave.Pin6- Winch Motor Direction
Slave.Pin7- LDR/Light Sensor
Slave.Pin8- Rx CH4
Slave.Pin9- Left Servo Control
Slave.Pin10- Right Servo Control
Slave.Pin11- Stepper Motor drive
Slave.Pin12- Stepper Motor Direction
Slave.Pin13- empty
Slave.PinA0- Cargo Box Front Limit Switches
Slave.PinA1- Cargo Box Bottom Limit Switches
Slave.PinA2- Lighting System
Slave.PinA3- empty
Slave.PinA4- I2C
Slave.PinA5- I2C