SlideShare a Scribd company logo
1 of 38
Download to read offline
Building a Drone from scratch
Igor Stoppa
Embedded Linux Conference
October 2016
V 0.1.0
Disclaimers
Opinions expressed in these foils represent exclusively
to the author’s view.
All Logos and Trademarks represented belong to their
respective owners.
Summary
● Intro - what is this about? - why from scratch?
● Setting the Goals
● Requirements: must have, nice to have, long term
● Identifying the constraints: time, materials, means.
● System design: centralized / distributed, make / buy
● The gory details:
○ HW / SW selection, system architecture
○ Dealing with physical systems:
motors in real life, inertia, max battery power
● Ideas for future expansion
Intro - what is this about?
● Learning-by-doing project
● Attempt to build a drone of acceptable quality, while:
○ keeping the cost low;
○ keeping the overall complexity low;
○ using off-the-shelf components easily obtainable
through major worldwide retailers.
○ achieving sufficient modularity to support various
configurations
Intro - Why from scratch?
● Many frameworks available, trying to hide the
complexity.
Useful for productization, less open to free form
experimentation.
● SW platforms tend to focus on specific HW.
It simplifies the design and the verification, at the
expense of freedom of choice.
● It’s more interesting
● Challenge: use the most out of the HW selected
Setting the Goals
4WD Drone:
less glamorous than flying, but less likely to break.
Easy upgrade path:
no proprietary solutions, compartmentalize functionality.
Low cost:
stock parts from popular kits, SW to improve accuracy.
Ease of debug:
tap into standard interfaces between building blocks.
Requirements
Must Have
Speed control, Steering, Remote Control
Nice to Have
Obstacle detection, Obstacle avoidance, camera stream
Long Term
Remote Computer Vision, Onboard Computer Vision
Constraints to Development
Limited time
Only few hours per week, each week a new feature.
Costs
It shouldn’t break the bank, especially when taken as
educational tool/toy. This includes the tools used.
Material
It should rely only on components readily available at
affordable price, through worldwide distribution channels.
System Design
Extensibility
Allow additional HW features. Ex: accelerometer.
Modularity
Segregation of different functionality.
Ease of unit-test and debug, less interference.
Real time response
Deterministic cap to reaction times, in specific cases.
Power Efficiency
Minimize power loss in major use cases (DC motors).
System Design - continued
Low Mass
Minimize negative effects of inertia:
- higher power (peak current) required to alter the state
(steer, speed up/down)
- higher chance to drift
Circumscribe electrical damage
In case of electrical fault (misconnection/short, etc.),
preserve the most expensive component(s) from
damage.
Single Board vs Multiple Boards
Comparison Single Board Multi-Boards
Extensibility Less Yes
Power Efficiency Yes Less
Low Mass Yes Less
Modularity Less Yes
Real time Response Less Yes
Damage Control Less Yes
Considerations
There is no perfect solution - unsurprisingly.
Both can be made to work, with ad-hoc adjustments.
The Multi-Boards approach wins because:
● It is better at protecting the “Main” board.
● It can even omit the “Main” board - ex: simple RC drone.
● It enables the use of an RTOS for the time-sensitive tasks.
Overall System Architecture
Main
Board
WIFI or other radio
Pull
Up
Vcc
Micro
Controller 1
Board
M
I2C Bus
Optical
encoder
Micro
Controller n
Board
...
RC-Variant
radio
Pull
Up
Vcc
Micro
Controller 1
Board
M
I2C Bus
Optical
encoder
Micro
Controller n
Board
...
Receiver
Micro
Controller
Board
Transmitter
Micro
Controller
Board
Power Distribution - 1 Battery
9V regulated
5V
regulated
Control
Logic
Motors
Driver
Power Distribution - 1 Battery
1 single battery for powering both logic and actuators
● Actuators can try to draw more current than the battery
provides while accelerating. Ex: inversion of rotation, start.
● Voltage across the battery pack can drop.
● The drop can be enough to starve the regulator feeding
the logics.
Solution: limit the max current used by the actuators.
Power Distribution - 1 Battery
9V regulated with
current limiter [7]
5V
regulated
Control
Logic
Motors
Driver
Motors - options
DC Motor
● Pros: fast, naturally continuous, robust.
● Cons: needs additional circuitry for speed/position control
Servo Motor
● Pros: fast, high torque
● Cons: needs modification to be continuous, can vibrate
when idle, more expensive.
Choice: DC Motor
Optical Encoder
DC Motor
Gear Box
Wheel
Optical
Coupler
Frequency proportional
to the rotation speed
Optical Coupler
End Stop for 3D printer
TCST2103 [1]
● Fairly cheap
● Sufficiently accurate
● Compatible with the
dimensions of the optical
encoder.
Driving DC motors - H bridge
● Allows to apply voltage
across a load in either
direction.
● Various technologies used
to implement S1..S4
● Different levels of
efficiency.
MVin
S1
S2
S3
S4
Driving DC motors - signals
Micro
Controller 1
Board
DC Motor
Driver
CH-A
CH-B
CH-A/B
(A/B)O2 (A/B)O1
(A/B)IN2 (A/B)IN1 PWM(A/B)
0 0 DON’T CARE FREE SPINNING
0 1 PWM CLOCKWISE
1 0 PWM COUNTER CLOCKWISE
1 1 DON’T CARE LOCKED
Motors Drivers - options [2]
L298N
● Cheap
● Big Internal Power Loss
● Large (HeatSink)
TB6612FNG
● More expensive
● Small Internal Power Loss
● Small (no need to
dissipate power)
Low Level Automation - uC
Arduino Pro Mini (AVR328p)
[3]
● Has I2C interface
● Sufficiently powerful to
perform the required
calculations
● For each motor:
○ Drive status
○ Dedicate PWM line
○ Optical Encoder input
Motor Control and Feedback
Motor status control
● 2 independent GPIOs for each motor
PWM
● 2 independent counters, each feeding into 2 dividers
● Independent control for each motor, allows for calibration
Optical Encoder input
● 1 GPIO for each motor encoder, as IRQ, to avoid polling
● Only the counters are bumped in IRQ context, the rest as
bottom half
Bat-like: send a burst of waves, waits for the echos [8]
2cm - 400cm range
15 degrees aperture
Proximity Sensor
Trigge
r
Pings
Echo
Proximity Sensor
Create pairs that do not
interfere with each other.
Activate the pairs clockwise.
Possible improvement: create
double pairs that are
orthogonal.
Running the microController
main() Program
● Main loop with functions
● interrupt handlers
8-bit RTOS
● Interrupt handlers
● Tasks Scheduling
● Semaphores
● Mailboxes
RTOS selection
FreeRTOS [4]
● GPLv3 for non commercial
● Only for ATMega323,
but not for ATMega328p
● Many (mostly dead)
unofficial ports to Mini Pro
● Not very small memory
footprint.
ChibiOS [5]
● GPLv3 for non commercial
● Essential BSP for Mini Pro
● Small footprint
I2C Development and Debugging
HW tools summary:
● HW debugger/flasher - AVR Dragon
● Bus low level protocol analyzer/snooper -
Bus Pirate
● Logical analyzer - SigRok + Pulseview
● USB scope - Hantek + Openhantek
Full dissertation on I2C from ELC NA 2016 [6].
I2C High Level Protocol debugging
Need to create
custom tools, for
non-trivial testing
of both the
protocol and the
implementation
of the API.
Main Board Selection
Requirements
● It must run linux
● Low power consumption
● I2C interface - master
● WiFi interface
● Small form factor
● USB OTG/Master
Main Board Selection
Options
● Intel Edison [9]
○ Pros: powerful, small.
○ Cons: $$, modules $$
● Next Thing CHIP [10]
○ Pros: cheap
○ Cons: delayed
● Intel Joule [11]
○ Pros: powerful
○ Cons: $$$,
Geppetto PCB $$$
Future
● Accelerometer
● Optical Flow cameras on the sides
● Computer Vision
● GPS
● LIDAR
● Port to quadcopter.
Questions?
Thank you!
Backup Info
References
[1]. http://www.alldatasheet.com/datasheet-pdf/pdf/26411/VISHAY/TCST2103.html
[2]. http://forum.makeblock.cc/t/the-review-of-dc-motor-drivers-l298n-tb6612fng-and-lv8406t/372
[3]. https://www.sparkfun.com/products/11113
[4]. http://www.freertos.org/
[5]. http://www.chibios.org/dokuwiki/doku.php
[6]. http://events.linuxfoundation.org/sites/events/files/slides/ELC%202016%20-%20I2C%20hacki
ng%20demystified_0.pdf
[7]. http://www.ti.com/product/LM2596
[8]. http://www.micropik.com/PDF/HCSR04.pdf
[9]. http://www.intel.com/content/www/us/en/do-it-yourself/edison.html
[10]. https://getchip.com/
[11].

More Related Content

What's hot

Tuning Android Applications (Part Deux)
Tuning Android Applications (Part Deux)Tuning Android Applications (Part Deux)
Tuning Android Applications (Part Deux)CommonsWare
 
introduction to embedded systems part 2
introduction to embedded systems part 2introduction to embedded systems part 2
introduction to embedded systems part 2Hatem Abd El-Salam
 
Architectures for mobile computing dec12
Architectures for mobile computing dec12Architectures for mobile computing dec12
Architectures for mobile computing dec12Rajveer Shekhawat
 
Embedded system custom single purpose processors
Embedded system custom single  purpose processorsEmbedded system custom single  purpose processors
Embedded system custom single purpose processorsAiswaryadevi Jaganmohan
 
Sw&connectivity product overview [compatibility mode]
Sw&connectivity product overview [compatibility mode]Sw&connectivity product overview [compatibility mode]
Sw&connectivity product overview [compatibility mode]Alexander Pienaar
 
June newsletter 2013 in english
June newsletter 2013 in englishJune newsletter 2013 in english
June newsletter 2013 in englishLika Electronic
 
Embedded systems-unit-1
Embedded systems-unit-1Embedded systems-unit-1
Embedded systems-unit-1Prabhu Mali
 

What's hot (10)

Tuning Android Applications (Part Deux)
Tuning Android Applications (Part Deux)Tuning Android Applications (Part Deux)
Tuning Android Applications (Part Deux)
 
Kumar sv07
Kumar sv07Kumar sv07
Kumar sv07
 
introduction to embedded systems part 2
introduction to embedded systems part 2introduction to embedded systems part 2
introduction to embedded systems part 2
 
Embedded System-design technology
Embedded System-design technologyEmbedded System-design technology
Embedded System-design technology
 
Architectures for mobile computing dec12
Architectures for mobile computing dec12Architectures for mobile computing dec12
Architectures for mobile computing dec12
 
Embedded system custom single purpose processors
Embedded system custom single  purpose processorsEmbedded system custom single  purpose processors
Embedded system custom single purpose processors
 
Sw&connectivity product overview [compatibility mode]
Sw&connectivity product overview [compatibility mode]Sw&connectivity product overview [compatibility mode]
Sw&connectivity product overview [compatibility mode]
 
Choosing the right processor
Choosing the right processorChoosing the right processor
Choosing the right processor
 
June newsletter 2013 in english
June newsletter 2013 in englishJune newsletter 2013 in english
June newsletter 2013 in english
 
Embedded systems-unit-1
Embedded systems-unit-1Embedded systems-unit-1
Embedded systems-unit-1
 

Viewers also liked

How Technologies like Certify and Uber Are Transforming Modern Business Travel
How Technologies like Certify and Uber Are Transforming Modern Business TravelHow Technologies like Certify and Uber Are Transforming Modern Business Travel
How Technologies like Certify and Uber Are Transforming Modern Business TravelAshley Emery
 
Drone101 - Introduction to Multirotors
Drone101 - Introduction to MultirotorsDrone101 - Introduction to Multirotors
Drone101 - Introduction to MultirotorsJohnson Lam
 
Drone Building 101
Drone Building 101Drone Building 101
Drone Building 101Aaron Buma
 
Building a Thought Controlled Drone
Building a Thought Controlled DroneBuilding a Thought Controlled Drone
Building a Thought Controlled DroneJim McKeeth
 

Viewers also liked (7)

How Technologies like Certify and Uber Are Transforming Modern Business Travel
How Technologies like Certify and Uber Are Transforming Modern Business TravelHow Technologies like Certify and Uber Are Transforming Modern Business Travel
How Technologies like Certify and Uber Are Transforming Modern Business Travel
 
Drone101 - Introduction to Multirotors
Drone101 - Introduction to MultirotorsDrone101 - Introduction to Multirotors
Drone101 - Introduction to Multirotors
 
Drone Building 101
Drone Building 101Drone Building 101
Drone Building 101
 
Quadcopter Technology
Quadcopter TechnologyQuadcopter Technology
Quadcopter Technology
 
Building a Thought Controlled Drone
Building a Thought Controlled DroneBuilding a Thought Controlled Drone
Building a Thought Controlled Drone
 
Drones: Present & Future
Drones: Present & FutureDrones: Present & Future
Drones: Present & Future
 
Drone Technology
Drone TechnologyDrone Technology
Drone Technology
 

Similar to Open_IoT_Summit-Europe-2016-Building_a_Drone_from_scratch

WIRELESS SURVILLANCE ROBOT
WIRELESS SURVILLANCE ROBOT WIRELESS SURVILLANCE ROBOT
WIRELESS SURVILLANCE ROBOT KrishGupta94
 
ELC 2016 - I2C hacking demystified
ELC 2016 - I2C hacking demystifiedELC 2016 - I2C hacking demystified
ELC 2016 - I2C hacking demystifiedIgor Stoppa
 
Lakefield: Hybrid Cores in 3D Package
Lakefield: Hybrid Cores in 3D PackageLakefield: Hybrid Cores in 3D Package
Lakefield: Hybrid Cores in 3D Packageinside-BigData.com
 
39245147 intro-es-i
39245147 intro-es-i39245147 intro-es-i
39245147 intro-es-iEmbeddedbvp
 
Challenges in Embedded Development
Challenges in Embedded DevelopmentChallenges in Embedded Development
Challenges in Embedded DevelopmentSQABD
 
Open_IoT_Summit-Europe-2016-Building_an_IoT-class_Device_0
Open_IoT_Summit-Europe-2016-Building_an_IoT-class_Device_0Open_IoT_Summit-Europe-2016-Building_an_IoT-class_Device_0
Open_IoT_Summit-Europe-2016-Building_an_IoT-class_Device_0Igor Stoppa
 
Continuous Performance Testing
Continuous Performance TestingContinuous Performance Testing
Continuous Performance TestingC4Media
 
Zero Downtime JEE Architectures
Zero Downtime JEE ArchitecturesZero Downtime JEE Architectures
Zero Downtime JEE ArchitecturesAlexander Penev
 
ARDUINO BASED HEART BEAT MONITORING SYSTEM
ARDUINO BASED HEART BEAT MONITORING SYSTEMARDUINO BASED HEART BEAT MONITORING SYSTEM
ARDUINO BASED HEART BEAT MONITORING SYSTEMMOHAMMAD HANNAN
 
Basics of embedded system design
Basics of embedded system designBasics of embedded system design
Basics of embedded system designK Senthil Kumar
 
Computer Architecture and Organization
Computer Architecture and OrganizationComputer Architecture and Organization
Computer Architecture and Organizationssuserdfc773
 
The Principle Of Ultrasound Imaging System
The Principle Of Ultrasound Imaging SystemThe Principle Of Ultrasound Imaging System
The Principle Of Ultrasound Imaging SystemMelissa Luster
 
embedded system introduction to microcontrollers
embedded system introduction to microcontrollersembedded system introduction to microcontrollers
embedded system introduction to microcontrollersBarER4
 
Kernel Recipes 2016 - Speeding up development by setting up a kernel build farm
Kernel Recipes 2016 - Speeding up development by setting up a kernel build farmKernel Recipes 2016 - Speeding up development by setting up a kernel build farm
Kernel Recipes 2016 - Speeding up development by setting up a kernel build farmAnne Nicolas
 
IRJET- Literature Survey on Hardware Addition and Subtraction
IRJET- Literature Survey on Hardware Addition and SubtractionIRJET- Literature Survey on Hardware Addition and Subtraction
IRJET- Literature Survey on Hardware Addition and SubtractionIRJET Journal
 

Similar to Open_IoT_Summit-Europe-2016-Building_a_Drone_from_scratch (20)

Micro-controllers (PIC) based Application Development
Micro-controllers (PIC) based Application DevelopmentMicro-controllers (PIC) based Application Development
Micro-controllers (PIC) based Application Development
 
WIRELESS SURVILLANCE ROBOT
WIRELESS SURVILLANCE ROBOT WIRELESS SURVILLANCE ROBOT
WIRELESS SURVILLANCE ROBOT
 
ELC 2016 - I2C hacking demystified
ELC 2016 - I2C hacking demystifiedELC 2016 - I2C hacking demystified
ELC 2016 - I2C hacking demystified
 
Esd module1
Esd module1Esd module1
Esd module1
 
Lakefield: Hybrid Cores in 3D Package
Lakefield: Hybrid Cores in 3D PackageLakefield: Hybrid Cores in 3D Package
Lakefield: Hybrid Cores in 3D Package
 
39245147 intro-es-i
39245147 intro-es-i39245147 intro-es-i
39245147 intro-es-i
 
Challenges in Embedded Development
Challenges in Embedded DevelopmentChallenges in Embedded Development
Challenges in Embedded Development
 
Open_IoT_Summit-Europe-2016-Building_an_IoT-class_Device_0
Open_IoT_Summit-Europe-2016-Building_an_IoT-class_Device_0Open_IoT_Summit-Europe-2016-Building_an_IoT-class_Device_0
Open_IoT_Summit-Europe-2016-Building_an_IoT-class_Device_0
 
Continuous Performance Testing
Continuous Performance TestingContinuous Performance Testing
Continuous Performance Testing
 
Zero Downtime JEE Architectures
Zero Downtime JEE ArchitecturesZero Downtime JEE Architectures
Zero Downtime JEE Architectures
 
ARDUINO BASED HEART BEAT MONITORING SYSTEM
ARDUINO BASED HEART BEAT MONITORING SYSTEMARDUINO BASED HEART BEAT MONITORING SYSTEM
ARDUINO BASED HEART BEAT MONITORING SYSTEM
 
Basics of embedded system design
Basics of embedded system designBasics of embedded system design
Basics of embedded system design
 
Computer Architecture and Organization
Computer Architecture and OrganizationComputer Architecture and Organization
Computer Architecture and Organization
 
The Principle Of Ultrasound Imaging System
The Principle Of Ultrasound Imaging SystemThe Principle Of Ultrasound Imaging System
The Principle Of Ultrasound Imaging System
 
Ip so c-30sept2010
Ip so c-30sept2010Ip so c-30sept2010
Ip so c-30sept2010
 
embedded system introduction to microcontrollers
embedded system introduction to microcontrollersembedded system introduction to microcontrollers
embedded system introduction to microcontrollers
 
Embedded
EmbeddedEmbedded
Embedded
 
Embedded
EmbeddedEmbedded
Embedded
 
Kernel Recipes 2016 - Speeding up development by setting up a kernel build farm
Kernel Recipes 2016 - Speeding up development by setting up a kernel build farmKernel Recipes 2016 - Speeding up development by setting up a kernel build farm
Kernel Recipes 2016 - Speeding up development by setting up a kernel build farm
 
IRJET- Literature Survey on Hardware Addition and Subtraction
IRJET- Literature Survey on Hardware Addition and SubtractionIRJET- Literature Survey on Hardware Addition and Subtraction
IRJET- Literature Survey on Hardware Addition and Subtraction
 

Open_IoT_Summit-Europe-2016-Building_a_Drone_from_scratch

  • 1. Building a Drone from scratch Igor Stoppa Embedded Linux Conference October 2016 V 0.1.0
  • 2. Disclaimers Opinions expressed in these foils represent exclusively to the author’s view. All Logos and Trademarks represented belong to their respective owners.
  • 3. Summary ● Intro - what is this about? - why from scratch? ● Setting the Goals ● Requirements: must have, nice to have, long term ● Identifying the constraints: time, materials, means. ● System design: centralized / distributed, make / buy ● The gory details: ○ HW / SW selection, system architecture ○ Dealing with physical systems: motors in real life, inertia, max battery power ● Ideas for future expansion
  • 4. Intro - what is this about? ● Learning-by-doing project ● Attempt to build a drone of acceptable quality, while: ○ keeping the cost low; ○ keeping the overall complexity low; ○ using off-the-shelf components easily obtainable through major worldwide retailers. ○ achieving sufficient modularity to support various configurations
  • 5. Intro - Why from scratch? ● Many frameworks available, trying to hide the complexity. Useful for productization, less open to free form experimentation. ● SW platforms tend to focus on specific HW. It simplifies the design and the verification, at the expense of freedom of choice. ● It’s more interesting ● Challenge: use the most out of the HW selected
  • 6. Setting the Goals 4WD Drone: less glamorous than flying, but less likely to break. Easy upgrade path: no proprietary solutions, compartmentalize functionality. Low cost: stock parts from popular kits, SW to improve accuracy. Ease of debug: tap into standard interfaces between building blocks.
  • 7. Requirements Must Have Speed control, Steering, Remote Control Nice to Have Obstacle detection, Obstacle avoidance, camera stream Long Term Remote Computer Vision, Onboard Computer Vision
  • 8. Constraints to Development Limited time Only few hours per week, each week a new feature. Costs It shouldn’t break the bank, especially when taken as educational tool/toy. This includes the tools used. Material It should rely only on components readily available at affordable price, through worldwide distribution channels.
  • 9. System Design Extensibility Allow additional HW features. Ex: accelerometer. Modularity Segregation of different functionality. Ease of unit-test and debug, less interference. Real time response Deterministic cap to reaction times, in specific cases. Power Efficiency Minimize power loss in major use cases (DC motors).
  • 10. System Design - continued Low Mass Minimize negative effects of inertia: - higher power (peak current) required to alter the state (steer, speed up/down) - higher chance to drift Circumscribe electrical damage In case of electrical fault (misconnection/short, etc.), preserve the most expensive component(s) from damage.
  • 11. Single Board vs Multiple Boards Comparison Single Board Multi-Boards Extensibility Less Yes Power Efficiency Yes Less Low Mass Yes Less Modularity Less Yes Real time Response Less Yes Damage Control Less Yes
  • 12. Considerations There is no perfect solution - unsurprisingly. Both can be made to work, with ad-hoc adjustments. The Multi-Boards approach wins because: ● It is better at protecting the “Main” board. ● It can even omit the “Main” board - ex: simple RC drone. ● It enables the use of an RTOS for the time-sensitive tasks.
  • 13. Overall System Architecture Main Board WIFI or other radio Pull Up Vcc Micro Controller 1 Board M I2C Bus Optical encoder Micro Controller n Board ...
  • 14. RC-Variant radio Pull Up Vcc Micro Controller 1 Board M I2C Bus Optical encoder Micro Controller n Board ... Receiver Micro Controller Board Transmitter Micro Controller Board
  • 15. Power Distribution - 1 Battery 9V regulated 5V regulated Control Logic Motors Driver
  • 16. Power Distribution - 1 Battery 1 single battery for powering both logic and actuators ● Actuators can try to draw more current than the battery provides while accelerating. Ex: inversion of rotation, start. ● Voltage across the battery pack can drop. ● The drop can be enough to starve the regulator feeding the logics. Solution: limit the max current used by the actuators.
  • 17. Power Distribution - 1 Battery 9V regulated with current limiter [7] 5V regulated Control Logic Motors Driver
  • 18. Motors - options DC Motor ● Pros: fast, naturally continuous, robust. ● Cons: needs additional circuitry for speed/position control Servo Motor ● Pros: fast, high torque ● Cons: needs modification to be continuous, can vibrate when idle, more expensive.
  • 19. Choice: DC Motor Optical Encoder DC Motor Gear Box Wheel Optical Coupler Frequency proportional to the rotation speed
  • 20. Optical Coupler End Stop for 3D printer TCST2103 [1] ● Fairly cheap ● Sufficiently accurate ● Compatible with the dimensions of the optical encoder.
  • 21. Driving DC motors - H bridge ● Allows to apply voltage across a load in either direction. ● Various technologies used to implement S1..S4 ● Different levels of efficiency. MVin S1 S2 S3 S4
  • 22. Driving DC motors - signals Micro Controller 1 Board DC Motor Driver CH-A CH-B CH-A/B (A/B)O2 (A/B)O1 (A/B)IN2 (A/B)IN1 PWM(A/B) 0 0 DON’T CARE FREE SPINNING 0 1 PWM CLOCKWISE 1 0 PWM COUNTER CLOCKWISE 1 1 DON’T CARE LOCKED
  • 23. Motors Drivers - options [2] L298N ● Cheap ● Big Internal Power Loss ● Large (HeatSink) TB6612FNG ● More expensive ● Small Internal Power Loss ● Small (no need to dissipate power)
  • 24. Low Level Automation - uC Arduino Pro Mini (AVR328p) [3] ● Has I2C interface ● Sufficiently powerful to perform the required calculations ● For each motor: ○ Drive status ○ Dedicate PWM line ○ Optical Encoder input
  • 25. Motor Control and Feedback Motor status control ● 2 independent GPIOs for each motor PWM ● 2 independent counters, each feeding into 2 dividers ● Independent control for each motor, allows for calibration Optical Encoder input ● 1 GPIO for each motor encoder, as IRQ, to avoid polling ● Only the counters are bumped in IRQ context, the rest as bottom half
  • 26. Bat-like: send a burst of waves, waits for the echos [8] 2cm - 400cm range 15 degrees aperture Proximity Sensor Trigge r Pings Echo
  • 27. Proximity Sensor Create pairs that do not interfere with each other. Activate the pairs clockwise. Possible improvement: create double pairs that are orthogonal.
  • 28. Running the microController main() Program ● Main loop with functions ● interrupt handlers 8-bit RTOS ● Interrupt handlers ● Tasks Scheduling ● Semaphores ● Mailboxes
  • 29. RTOS selection FreeRTOS [4] ● GPLv3 for non commercial ● Only for ATMega323, but not for ATMega328p ● Many (mostly dead) unofficial ports to Mini Pro ● Not very small memory footprint. ChibiOS [5] ● GPLv3 for non commercial ● Essential BSP for Mini Pro ● Small footprint
  • 30. I2C Development and Debugging HW tools summary: ● HW debugger/flasher - AVR Dragon ● Bus low level protocol analyzer/snooper - Bus Pirate ● Logical analyzer - SigRok + Pulseview ● USB scope - Hantek + Openhantek Full dissertation on I2C from ELC NA 2016 [6].
  • 31. I2C High Level Protocol debugging Need to create custom tools, for non-trivial testing of both the protocol and the implementation of the API.
  • 32. Main Board Selection Requirements ● It must run linux ● Low power consumption ● I2C interface - master ● WiFi interface ● Small form factor ● USB OTG/Master
  • 33. Main Board Selection Options ● Intel Edison [9] ○ Pros: powerful, small. ○ Cons: $$, modules $$ ● Next Thing CHIP [10] ○ Pros: cheap ○ Cons: delayed ● Intel Joule [11] ○ Pros: powerful ○ Cons: $$$, Geppetto PCB $$$
  • 34. Future ● Accelerometer ● Optical Flow cameras on the sides ● Computer Vision ● GPS ● LIDAR ● Port to quadcopter.
  • 38. References [1]. http://www.alldatasheet.com/datasheet-pdf/pdf/26411/VISHAY/TCST2103.html [2]. http://forum.makeblock.cc/t/the-review-of-dc-motor-drivers-l298n-tb6612fng-and-lv8406t/372 [3]. https://www.sparkfun.com/products/11113 [4]. http://www.freertos.org/ [5]. http://www.chibios.org/dokuwiki/doku.php [6]. http://events.linuxfoundation.org/sites/events/files/slides/ELC%202016%20-%20I2C%20hacki ng%20demystified_0.pdf [7]. http://www.ti.com/product/LM2596 [8]. http://www.micropik.com/PDF/HCSR04.pdf [9]. http://www.intel.com/content/www/us/en/do-it-yourself/edison.html [10]. https://getchip.com/ [11].