Merge branch 'master' into ardupilot
67
640.html
Normal file
@@ -0,0 +1,67 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
|
||||
<title>640 | Dark Water</title>
|
||||
|
||||
<!-- Flatdoc -->
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
|
||||
<script src='/flatdoc/legacy.js'></script>
|
||||
<script src='/flatdoc/flatdoc.js'></script>
|
||||
|
||||
<!-- Flatdoc theme -->
|
||||
<link href='/flatdoc/theme-dark/style.css?3' rel='stylesheet'>
|
||||
<script src='/flatdoc/theme-dark/script.js?1'></script>
|
||||
|
||||
<!-- Highlight.js -->
|
||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.4.0/styles/monokai-sublime.min.css">
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.4.0/highlight.min.js"></script>
|
||||
<!-- Meta -->
|
||||
<meta content="640 | Dark Water" property="og:title">
|
||||
<meta content="Dark Water Foundation documentation." name="description">
|
||||
|
||||
<!-- Initializer -->
|
||||
<script>
|
||||
Flatdoc.run({
|
||||
fetcher: Flatdoc.github('darkwaterfoundation/docs', '640.md')
|
||||
});
|
||||
|
||||
$(document).on('flatdoc:ready', function() {
|
||||
// Highlight all the codes
|
||||
$('pre code').each(function(i, block) {
|
||||
hljs.highlightBlock(block);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body role='flatdoc' class='large-brief no-literate'>
|
||||
|
||||
<div class='header'>
|
||||
<div class='left'>
|
||||
<h1><a href='/index.html'>Dark Water Documentation</a></h1>
|
||||
<ul>
|
||||
<li><a href='/640.html'>640</a></li>
|
||||
<li><a href='/escape.html'>ESCAPE</a></li>
|
||||
<!--<li><a href='/soar.html'>Soar</a></li>-->
|
||||
<li><a href='/expansionadding.html'>Expansions</a></li>
|
||||
<li><a href='https://community.darkwater.io/'>Support</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class='right'>
|
||||
<!-- GitHub buttons: see http://ghbtns.com -->
|
||||
<iframe src="//ghbtns.com/github-btn.html?user=darkwaterfoundation&repo=docs&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="110" height="20"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='content-root'>
|
||||
<div class='menubar'>
|
||||
<div class='menu section' role='flatdoc-menu'></div>
|
||||
</div>
|
||||
<div role='flatdoc-content' class='content'></div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
835
640.md
Normal file
@@ -0,0 +1,835 @@
|
||||
# Getting started
|
||||
|
||||

|
||||
|
||||
Welcome to the 640 board - this guide will describe all the features of the 640 board and show you how to control up to 6 motors or 3 stepper motors and 2 servos very simply.
|
||||
|
||||
## Board layout
|
||||
|
||||
Before we start to assemble your board, we'll take a look at what each section is and what it is for. Place your 640 board on a table in front of you and identify each area.
|
||||
|
||||
### CPPM / PPM-SUM
|
||||
|
||||

|
||||
|
||||
This is the connection that allows you connect a Radio Control (RC) receiver so that you can extend the range of control for your robot.
|
||||
|
||||
### Servos
|
||||
|
||||

|
||||
|
||||
The 640 board has connections for two Servos. They default to being powered by the Raspberry Pi 5v supply, but we can switch them to be powered by the external battery supply if we want to.
|
||||
|
||||
### Motors
|
||||
|
||||

|
||||
|
||||
The 640 board can control 6 independent motors. Each motor has a connection with two pins (or terminals if you are using the screw terminal connections). It doesn't matter which way around you wire your motor, just make sure that you wire them all the same way. If you find that sending a Forward command makes your robot go backwards, then you can switch the wires around.
|
||||
|
||||
### Power
|
||||
|
||||

|
||||
|
||||
The power connection can accept from 2v all the way up to 11v DC - the power you connect here is isolated from your Raspberry Pi and only goes to the motors. Make sure you match your recommended motor voltage as too much power can damage them, and too little won't make them turn.
|
||||
|
||||
### Expansion area
|
||||
|
||||

|
||||
|
||||
This area to the right of the board is for adding extra expansion boards to increase the functionality available to you. For more information on adding expansion boards [look here](/expansionadding.html)
|
||||
|
||||
### Address selection
|
||||
|
||||

|
||||
|
||||
The 640 board uses I2C to control the motors. You can have a lot of I2C controlled boards on your Raspberry Pi at the same time, but each must have a unique address.
|
||||
|
||||
We have set up the 640 board to use the address **0x60**. If you find that this conflicts with another board you want to use, and you can't change the address of that board, then you can use these 5 solder jumpers to change the 640 board address.
|
||||
|
||||
#### How to change the address
|
||||
|
||||
Each of the address pins (A0 - A4) can be set to 0 (un-soldered) or 1 (soldered). You set an address pin to 1 by adding solder to each pad of the address pin until the two parts join.
|
||||
|
||||

|
||||
|
||||
Each address jumper has a binary value - A0 = 1, A1 = 2, A3 = 4, A4 = 8
|
||||
|
||||
The starting address for the 640 board is 0x60 - if we solder jumper A0 then the address will be 0x60 + 1 = 0x61. Soldering A0 and A1 will give us 0x60 + 1 + 2 = 0x63
|
||||
|
||||
# Setup your 640
|
||||
|
||||
Now that we know what each part of the board is for, it's time to solder all the connections - it doesn't matter what order you attach the connections to your board, but we've found that the order below is the simplest.
|
||||
|
||||
## Assemble the parts
|
||||
|
||||
**IMPORTANT** - if you have an expansion board that you want to add to your 640 board, then you should add that first as it will be a lot easier than adding it after soldering connectors to the board.
|
||||
|
||||

|
||||
|
||||
As we don't know what headers and connectors you selected when you ordered your 640 board - we're going to show you how to connect the most common selection - other connectors and headers should attach in the same way.
|
||||
|
||||
*Hint* - A lump of plasticine or clay is very useful to hold your board level.
|
||||
|
||||
## Attach the 3 pin servo header
|
||||
|
||||
The first part to slot into place is the 3 x 3 connector for the CPPM and Servos. The holes for this part are aligned so that the connector should fit tightly and be held in place.
|
||||
|
||||

|
||||
|
||||
Slot it in place, but don't solder it yet.
|
||||
|
||||
## Attach the motor and power terminals
|
||||
|
||||
Now we need to add the motor and power connectors - slot each in place making sure that you have them the right way around (for the screw terminals the holes should be at the front of the board).
|
||||
|
||||
Use a piece of paper or card to hold the connectors in place and turn the board upside down. Slide the paper out from under the board and use a piece of plasticine to prop the board up level.
|
||||
|
||||

|
||||
|
||||
Make sure everything is lined up correctly - use extra plasticine to align connectors if needed. Once you are happy, solder each of the pins.
|
||||
|
||||
## Attach the header
|
||||
|
||||
For this example we'll show you how to connect a stackable header, as it's the most complex.
|
||||
|
||||
Due to the length of the stackable headers pins, it can sometimes be a hassle to get them through the holes on the board.
|
||||
|
||||
We've found that if you slide up the spacer on the stackable header so that it is near the top, you can get the pins into the boards header holes a lot easier and then slide the spacer back down again.
|
||||
|
||||

|
||||
|
||||
Once you have your header in place, use some plasticine to make sure the board is level and then solder away. You should solder a single pin first, then make sure the header is level - if it isn't then apply the soldering iron to the pin again and move the header until it is correct.
|
||||
|
||||

|
||||
|
||||
Now that your board is set up, it's time to configure your Raspberry Pi so that you can use it.
|
||||
|
||||
# Setting up your Pi
|
||||
|
||||
Before we can start using the 640 board we need to enable the interfaces that the board uses on your Raspberry Pi.
|
||||
|
||||
The 640 board is controlled using the I2C interface. Any expansion boards attached to your 640 board are controlled using the SPI interface.
|
||||
|
||||
## Enable I2C and SPI in Pixel
|
||||
|
||||
If you are using the graphical interface on your Raspberry Pi then click on your main menu icon, move down to *Preferences* and click on the *Raspberry Pi Configuration* menu item. Once open click on the *Interfaces* tab and you should see something like in the image below.
|
||||
|
||||

|
||||
|
||||
Make sure that the line labelled I2C is set to enabled.
|
||||
|
||||
If you have an expansion board then you'll need to enable the SPI interface as well on the line above, so click the *Enabled* setting next to the *SPI* label
|
||||
|
||||

|
||||
|
||||
Once you click Ok you may be promtped to reboot your Raspberry Pi - go ahead and reboot.
|
||||
|
||||
## Enable I2C and SPI on the command line
|
||||
|
||||
If you are only using the command line on your Raspberry Pi then you will need to use the text version of the Raspberry Pi configuration tool to enable the interfaces.
|
||||
|
||||
Type the following to bring up the configuration interface:
|
||||
|
||||
```bash
|
||||
$ sudo raspi-config
|
||||
```
|
||||
|
||||
Once the menu is showing, scroll down to the *Advanced Options* menu and press Enter.
|
||||
|
||||

|
||||
|
||||
Now we'll need to enable the I2C interface, so move down *I2C* menu and press Enter. You'll be asked if you want to enabled I2C - select *Yes* and you will see a confirmation and be returned to the main menu.
|
||||
|
||||

|
||||
|
||||
Go to the *Advanced Options* again and do the same for *SPI*
|
||||
|
||||

|
||||
|
||||
This time when you are returned to the main menu, move down to the *Finish* option (pressing the right arrow key twice will get you there) and press enter.
|
||||
|
||||
You have now enabled the interfaces you need to use your board.
|
||||
|
||||
## Reboot your Pi
|
||||
|
||||
Once you have enabled the interfaces you will need to reboot your Raspberry Pi so that the required libraries can be loaded. This is an important step and your code won't run correctly without it.
|
||||
|
||||
# Wiring up the 640 board
|
||||
|
||||
Now that we have your 640 board and Raspberry Pi setup, it's time to connect some motors and servos to it.
|
||||
|
||||

|
||||
|
||||
## Connecting Servos
|
||||
|
||||
Servos can be connected to the two servo connections to the immediate left of the DC motor connections. The 640 is setup to provide power to the Servos from the Raspberry Pi's 5v power. This can be changed to use the external power supply by modifying the solder header on the bottom of the board.
|
||||
|
||||

|
||||
|
||||
## Connecting Motors
|
||||
|
||||
Motors are connected to each individual motor connector on the board. You should try to wire each motor up with the positive and negative wires on the same sides as all the others - unless you know that a particular motor (or set of motors) is reversed on your robot.
|
||||
|
||||

|
||||
|
||||
## Connecting the power
|
||||
|
||||
The power supply for your motors is connected to the connector on the far right of the board. The 640 board can take between 2V and 11V for the motor power supply. It motor power supply is kept apart from the Raspberry Pi supply so that any voltage drop caused by the motors doesn't damage your Raspberry Pi or cause it to reboot.
|
||||
|
||||
There is a polarity protection mosfet on the 640 board to protect the motor drivers, so if you find that your motors aren't moving, then check that you have the battery connected the right way around.
|
||||
|
||||

|
||||
|
||||
## Connecting your RC receiver
|
||||
|
||||
The RC receiver is connected to the 3-pin connector on the far left of the board. Your Radio Control (RC) receiver should be capable of outputting CPPM or PPM-SUM signals. For some RC receivers need a jumper placed across two pins in order to enable this mode (as is the case with the D4R-II receiver displayed).
|
||||
|
||||
Once you have your RC receiver connected to the board and bound (linked) to yur RC transmitter, you should run the C++ PPM decoder example code ([below](#programming-the-640-installing-the-c-libraries-examples)) to make sure that the signals are being received correctly.
|
||||
|
||||

|
||||
|
||||
# Programming the 640
|
||||
|
||||
## Installing the Python libraries
|
||||
|
||||
The Python libraries for the 640 board and some example scripts are available via our GitHub repository. To install them open a terminal window on your Raspberry Pi (unless you are running with only the command line) and enter the following:
|
||||
|
||||
```bash
|
||||
$ git clone https://github.com/darkwaterfoundation/darkwater_python_640.git
|
||||
```
|
||||
|
||||
Next you need to navigate into the new directory so enter:
|
||||
|
||||
```bash
|
||||
$ cd ./darkwater_python_640
|
||||
```
|
||||
|
||||
And once in there we can install the libraries with:
|
||||
|
||||
```bash
|
||||
$ sudo python setup.py install
|
||||
```
|
||||
|
||||
### Example scripts
|
||||
|
||||
Once everything is installed we can have a play with the example scripts included in the download. As well as being useful to test each part of your board, they are also handy as a starting point when writing your own scrips.
|
||||
|
||||
Let's move into the examples directory and take a look at what is there.
|
||||
|
||||
```bash
|
||||
$ cd ./examples
|
||||
```
|
||||
|
||||
If you list the files in this directory, you should see a few test scripts
|
||||
|
||||
```bash
|
||||
$ ls -al
|
||||
```
|
||||
|
||||
#### 640motortest.py
|
||||
|
||||
This script will start each motor port, in the forwards direction, in turn from left to right and then do the same backwards. To run the script enter the following:
|
||||
|
||||
```bash
|
||||
$ python 640motortest.py
|
||||
```
|
||||
|
||||
#### 640servotest.py
|
||||
|
||||
This script will move any servos connected to the servo headers left, then center, then right. To run the script enter the following:
|
||||
|
||||
```bash
|
||||
$ python 640servotest.py
|
||||
```
|
||||
|
||||
#### 640steppertest.py
|
||||
|
||||
This script divides the 6 motor ports into 3 stepper motor ports. Motor 1 and 2 will be stepper 1, motor 3 and 4 will be stepper 2 and motor 5 and 6 will be stepper 3.
|
||||
|
||||
Each stepper will be moved forwards and backwards through 400 steps when the test script is run:
|
||||
|
||||
```bash
|
||||
$ python 640steppertest.py
|
||||
```
|
||||
|
||||
## The Python API
|
||||
|
||||
Now you know everything works, it's time to write your own scripts. So create a new python script in your editor with a memorable name and add the following lines to import our libraries:
|
||||
|
||||
```python
|
||||
import time
|
||||
from darkwater_640 import dw_Controller, dw_Motor, dw_Servo, dw_Stepper
|
||||
```
|
||||
|
||||
### Create a controller
|
||||
|
||||
The **dw_controller** object controls access to all the elements on the 640 board, so the first thing we need to do is create a controller - we pass in the address of the 640 board as a parameter - the default address is 0x60
|
||||
|
||||
```python
|
||||
dw = dw_Controller( addr=0x60 )
|
||||
```
|
||||
|
||||
Now that we have the controller created, we can access all the connectors on the board.
|
||||
|
||||
### Select a Motor
|
||||
|
||||
There are 6 motor ports on the 640 board numbered 1 to 6 from left to right (with the ports facing you ).
|
||||
|
||||
If we want to control a motor on port number 1 then we need to request the motor object for that port from our controller - this is very easily done with a single line
|
||||
|
||||
```python
|
||||
m1 = dw.getMotor(1)
|
||||
```
|
||||
|
||||
### Motor driving
|
||||
|
||||
There are two main commands that you can give a motor - to move in a direction and to stop.
|
||||
|
||||
We'll start with the main command to stop the motor
|
||||
|
||||
#### off()
|
||||
|
||||
The off command will switch off the motor and apply the brakes
|
||||
|
||||
```python
|
||||
m1.off()
|
||||
```
|
||||
|
||||
#### setMotorSpeed( *speed* )
|
||||
|
||||
We can also stop the motor by using the second command and passing a speed of 0
|
||||
|
||||
```python
|
||||
m1.setMotorSpeed(0)
|
||||
```
|
||||
|
||||
The **setMotorSpeed** command allows you to specify the speed of each motor - there are two different speed ranges the first goes from *-255* to *255*, the second from *1000* to *2000*.
|
||||
|
||||
If you are familiar with radio control vehicles and ESC motors then you will recognise the second range.
|
||||
|
||||
For now we'll concentrate on the first range.
|
||||
|
||||
To get your motor going forwards at full speed you should set its speed at 255
|
||||
|
||||
```python
|
||||
m1.setMotorSpeed(255)
|
||||
```
|
||||
|
||||
To get your motor going backwards at full speed you should set its speed to -255
|
||||
|
||||
```python
|
||||
m1.setMotorSpeed(-255)
|
||||
```
|
||||
|
||||
The numbers from 0 to the maximum in each direction will drive the motor at a slower speed, so for half speed forwards we'd use
|
||||
|
||||
```python
|
||||
m1.setMotorSpeed(125)
|
||||
```
|
||||
|
||||
And for a slow speed backwards we can use
|
||||
|
||||
```python
|
||||
m1.setMotorSpeed(-50)
|
||||
```
|
||||
|
||||
#### Alternate speed range
|
||||
|
||||
If you plan to move from a DC driven robot to an ESC motor powered robot then it makes sense to use the same conventions that will work on both, so you can also use the 1000 to 2000 speed range with the 640 board
|
||||
|
||||
To get your motor going forwards at full speed you should set its speed to 2000
|
||||
|
||||
```python
|
||||
m1.setMotorSpeed(2000)
|
||||
```
|
||||
|
||||
For full speed reverse you should set the speed to 1000
|
||||
|
||||
```python
|
||||
m1.setMotorSpeed(1000)
|
||||
```
|
||||
|
||||
And to stop the motor we can set the speed to the mid point which is 1500
|
||||
|
||||
```python
|
||||
m1.setMotorSpeed(1500)
|
||||
```
|
||||
|
||||
As before, any number between 1500 and the maximum in each direction will drive the motor at a slower speed, so for half speed forward you'd set the speed to 1750
|
||||
|
||||
```python
|
||||
m1.setMotorSpeed(1750)
|
||||
```
|
||||
|
||||
and half speed in revers would be 1250
|
||||
|
||||
```python
|
||||
m1.setMotorSpeed(1250)
|
||||
```
|
||||
|
||||
### Select a Servo
|
||||
|
||||
There are two servo ports on the 640 board. They are numbered 1 and 2 with number 1 to the left hand side and number 2 the closest to the motor ports.
|
||||
|
||||
You select a servo in the same manner as you select motors, by requesting a servo object from the controller - to select the first servo we use:
|
||||
|
||||
```python
|
||||
s1 = dw.getServo(1)
|
||||
```
|
||||
|
||||
### Servo control
|
||||
|
||||
Once you have a servo object there are currently three commands you can run.
|
||||
|
||||
#### off()
|
||||
|
||||
The off command will switch off your servo and stop any signals being sent to it.
|
||||
|
||||
```python
|
||||
s1.off()
|
||||
```
|
||||
|
||||
#### setPWMuS( *microseconds* )
|
||||
|
||||
This command will allow you to set the PWM pulse to the Servo in microseconds.
|
||||
|
||||
Most standard servos use a parameter value of 1000 for fully counter-clockwise, 2000 for fully clockwise, and 1500 for the middle - though you may have a wider range on your servo, so you should check the technical documentation for it to get the finer details.
|
||||
|
||||
```python
|
||||
s1.setPWMuS(1500) # middle
|
||||
s1.setPWMuS(2000) # fully clockwise
|
||||
s1.setPWMuS(1000) # fully counter clockwise
|
||||
```
|
||||
|
||||
#### setPWMmS( *milliseconds* )
|
||||
|
||||
This command allows you to specify the PWM pulse in milliseconds rather than seconds.
|
||||
|
||||
```python
|
||||
s1.setPWMmS(1.5) # middle
|
||||
s1.setPWMmS(2.0) # fully clockwise
|
||||
s1.setPWMmS(1.0) # fully counter clockwise
|
||||
```
|
||||
|
||||
### Select a Stepper motor
|
||||
|
||||
You can control up to 3 stepper motors with the 640 board - each stepper motor uses two motor ports for 4 wire stepper motors and three motor ports for 5 wire stepper motors.
|
||||
|
||||
Running 5 wire stepper motors is almost the same as 4 wire stepper motos but requires a small extra step which we'll explain at the end.
|
||||
|
||||
Each stepper motor is assigned to a pair of motor ports -
|
||||
|
||||
- **Stepper motor 1** - uses motor ports 1 and 2
|
||||
- **Stepper motor 2** - uses motor ports 3 and 4
|
||||
- **Stepper motor 3** - uses motor ports 5 and 6
|
||||
|
||||
The first step is to identify the two wires for each coil on your stepper motor (you may need to read the technical documentation for your motor to find this out) and attach these two wires to each port.
|
||||
|
||||
*Example: You have a stepper motor with 4 wires - orange, pink, yellow and blue. If the orange and pink wires for your stepper motor are attached to coil one then attach these wires to motor port 1, attach the two remaining wires to motor port 2.*
|
||||
|
||||
Once you have your stepper motor wired up you need to request the relevant stepper motor object from the controller.
|
||||
|
||||
```python
|
||||
stepper1 = dw.getStepper(1)
|
||||
```
|
||||
|
||||
### Stepper motor control
|
||||
|
||||
There are four commands for stepper motors. The first one you'll recognise
|
||||
|
||||
#### off()
|
||||
|
||||
The off command will switch off the stepper motor
|
||||
|
||||
```python
|
||||
stepper1.off()
|
||||
```
|
||||
|
||||
#### setMotorSpeed( *rpm* )
|
||||
|
||||
This command allows you to set the speed of your stepper motor. Pass the number of revolutions per minute that you want your stepper motor to run at.
|
||||
|
||||
```python
|
||||
stepper1.setMotorSpeed(200)
|
||||
```
|
||||
|
||||
#### oneStep( *direction*, *style* )
|
||||
|
||||
This command will move the stepper motor one step in your chosen direction -
|
||||
|
||||
- **dw_Controller.FORWARD** - set the stepper motor to move forward
|
||||
- **dw_Controller.REVERSE** - set the stepper motor to move backwards
|
||||
|
||||
There are two stepping styles available -
|
||||
|
||||
- **dw_Controller.SINGLE** - this is the simplest method of stepping which activates a single coil at a time to move and hold the motor. This method uses the least amount of power.
|
||||
- **dw_Controller.DOUBLE** - this is a slightly more complex method of stepping which uses to coils to move and hold the motor. This method uses twice as much power as the single step, but is more powerful.
|
||||
|
||||
```python
|
||||
stepper1.oneStep(dw_Controller.FORWARD, dw_Controller.SINGLE)
|
||||
stepper1.oneStep(dw_Controller.REVERSE, dw_Controller.DOUBLE)
|
||||
```
|
||||
|
||||
#### step( *steps*, *direction*, *style* )
|
||||
|
||||
If you want to move the stepper motor a set number of steps then you can use this command. This, however, will stop all processing until the motor has moved the specified number of steps.
|
||||
|
||||
```python
|
||||
stepper1.step(200, dw_Controller.FORWARD, dw_Controller.SINGLE)
|
||||
stepper1.step(200, dw_Controller.REVERSE, dw_Controller.DOUBLE)
|
||||
```
|
||||
|
||||
If you want more control and need to move two or more motors at the same time then you should use the **oneStep** command.
|
||||
|
||||
## Installing the C++ libraries
|
||||
|
||||
The C++ libraries for the 640 board and some example scripts are available via our GitHub repository. To install them open a terminal window on your Raspberry Pi (unless you are running with only the command line) and enter the following:
|
||||
|
||||
```bash
|
||||
$ git clone https://github.com/darkwaterfoundation/darkwater_cplus_640.git
|
||||
```
|
||||
|
||||
Once they are download we can navigate into the new directory and take a look around - so enter:
|
||||
|
||||
```bash
|
||||
$ cd ./darkwater_cplus_640
|
||||
```
|
||||
|
||||
Let's list the contents of that new directory by typing
|
||||
|
||||
```bash
|
||||
$ ls -al
|
||||
```
|
||||
|
||||
You should see two directories (and a README.md file which contains this content), called **darkwater** and **examples**.
|
||||
|
||||
The **darkwater** directory contains all of the classes needed to control your board and the **examples** directory contains a selection of demo code we've put together to show you how they are used.
|
||||
|
||||
### Examples
|
||||
|
||||
Take a look in the examples directory and you will see the following available demos.
|
||||
|
||||
#### Motor
|
||||
|
||||
The Motor example will start each motor in turn from 1 through to 6 in a forwards direction, then stop them and do the same in reverse. To build this demo type the following:
|
||||
|
||||
```bash
|
||||
$ cd ./Motor
|
||||
$ make
|
||||
```
|
||||
|
||||
Once you are returned to the command prompt you can run the program with the command:
|
||||
|
||||
```bash
|
||||
$ sudo ./Motor
|
||||
```
|
||||
|
||||
#### Servo
|
||||
|
||||
The servo example will move each of the two servos on the 640 board backwards and forwards six times. To build this demo type the following:
|
||||
|
||||
```bash
|
||||
$ cd ./Servo
|
||||
$ make
|
||||
```
|
||||
|
||||
Once it is compiled you can run it with the command:
|
||||
|
||||
```bash
|
||||
$ sudo ./Servo
|
||||
```
|
||||
|
||||
#### PPM
|
||||
|
||||
The PPM example will read the input from a PPM radio control receiver connected to the CPPM header on the 640 board, interpret the first 6 channels and move the corresponding motors.
|
||||
|
||||
To build this demo type the following:
|
||||
|
||||
```bash
|
||||
$ cd ./PPM
|
||||
$ make
|
||||
```
|
||||
|
||||
Once compiled, attach your CPPM receiver to the CPPM connector (see here CPPM set up) and run the program - you will see the output for each channel on the screen as it runs. Attaching motors to each of the motor connectors will allow you to control them individually by moving the sticks on your RC transmitter.
|
||||
|
||||
```bash
|
||||
$ sudo ./PPM
|
||||
```
|
||||
|
||||
#### AccelGyroMag
|
||||
|
||||
If you have a 9DoF expansion board on your 640 board or are using a SOAR board then this example will read and output the Gyroscope, Accelerometer and Compass readings.
|
||||
|
||||
To compile and run it, type the following
|
||||
|
||||
```bash
|
||||
$ cd ./AccelGyroMag
|
||||
$ make
|
||||
$ sudo ./AccelGyroMag
|
||||
```
|
||||
|
||||
## The C++ API
|
||||
|
||||
If you take a look at the code in each of the examples you should be able to get an idea of how the 640 board API works. We'll go into more detail of each of the available commands below.
|
||||
|
||||
The first thing we need to do for our program is to import the required libraries - so near the top of your new program you will put
|
||||
|
||||
```c
|
||||
#include "darkwater/DW640.h"
|
||||
#include "darkwater/Util.h"
|
||||
#include <stdlib.h>
|
||||
```
|
||||
|
||||
If you will be using the CPPM header for input then you will also need to add:
|
||||
|
||||
```c
|
||||
#include <pigpio.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
```
|
||||
|
||||
For this example, we'll include everthing in a *main* function for neatness - have a look at the PPM example code for an alternate set up.
|
||||
|
||||
```c
|
||||
int main()
|
||||
{
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
### Create a controller
|
||||
|
||||
The **DW640** object controls access to all the elements on the 640 board, so the first thing we need to do is create a controller - we pass in the address of the 640 board as a parameter - the default address is 0x60 so if you haven't changed the address then you can leave this out.
|
||||
|
||||
```c
|
||||
DW640 dw(0x60);
|
||||
dw.initialize();
|
||||
```
|
||||
|
||||
Now that we have the controller created, we can access all the connectors on the board.
|
||||
|
||||
### Select a Motor
|
||||
|
||||
There are 6 motor ports on the 640 board numbered 1 to 6 from left to right (with the ports facing you ).
|
||||
|
||||
If we want to control a motor on port number 1 then we need to request the motor object for that port from our controller - this is very easily done with a single line
|
||||
|
||||
```c
|
||||
DW_Motor *dw1 = dw.getMotor(1);
|
||||
```
|
||||
|
||||
### Motor driving
|
||||
|
||||
There are two main commands that you can give a motor - to move in a direction and to stop.
|
||||
|
||||
We'll start with the main command to stop the motor
|
||||
|
||||
##### off()
|
||||
|
||||
The off command will switch off the motor
|
||||
|
||||
```c
|
||||
dw1->off()
|
||||
```
|
||||
|
||||
#### setMotorSpeed( *speed* )
|
||||
|
||||
We can also stop the motor by using the second command and passing a speed of 0
|
||||
|
||||
```c
|
||||
dw1->setMotorSpeed(0);
|
||||
```
|
||||
|
||||
The **setMotorSpeed** command allows you to specify the speed of each motor - there are two different speed ranges the first goes from *-255* to *255*, the second from *1000* to *2000*.
|
||||
|
||||
If you are familiar with radio control vehicles and ESC motors then you will recognise the second range.
|
||||
|
||||
For now we'll concentrate on the first range.
|
||||
|
||||
To get your motor going forwards at full speed you should set its speed at 255
|
||||
|
||||
```c
|
||||
dw1->setMotorSpeed(255);
|
||||
```
|
||||
|
||||
To get your motor going backwards at full speed you should set its speed to -255
|
||||
|
||||
```c
|
||||
dw1->setMotorSpeed(-255)
|
||||
```
|
||||
|
||||
The numbers from 0 to the maximum in each direction will drive the motor at a slower speed, so for half speed forwards we'd use
|
||||
|
||||
```c
|
||||
dw1->setMotorSpeed(125)
|
||||
```
|
||||
|
||||
And for a slow speed backwards we can use
|
||||
|
||||
```c
|
||||
dw1->setMotorSpeed(-50)
|
||||
```
|
||||
|
||||
#### Alternate speed range
|
||||
|
||||
The spped range above is easy to use as you can quickly see what speed is forwards, backwards and stopped. ESC powered motors use a different range that goes from 1000 to 2000, with 1500 (the middle point) being stop.
|
||||
|
||||
Both the ESCAPE and 640 boards can use either range, but if you are primarily working with ESC powered motors and Radio Control inputs then you should use this range as it makes programming a lot easier.
|
||||
|
||||
To get your motor going forwards at full speed you should set its speed to 2000
|
||||
|
||||
```c
|
||||
dw1->setMotorSpeed(2000)
|
||||
```
|
||||
|
||||
For full speed reverse you should set the speed to 1000
|
||||
|
||||
```c
|
||||
dw1->setMotorSpeed(1000)
|
||||
```
|
||||
|
||||
And to stop the motor we can set the speed to the mid point which is 1500
|
||||
|
||||
```c
|
||||
dw1->setMotorSpeed(1500)
|
||||
```
|
||||
|
||||
As before, any number between 1500 and the maximum in each direction will drive the motor at a slower speed, so for half speed forward you'd set the speed to 1750
|
||||
|
||||
```c
|
||||
dw1->setMotorSpeed(1750)
|
||||
```
|
||||
|
||||
and half speed in reverse would be 1250
|
||||
|
||||
```c
|
||||
dw1->setMotorSpeed(1250)
|
||||
```
|
||||
|
||||
### Select a Servo
|
||||
|
||||
There are two servo ports on the 640 board. They are numbered from 1 and 2 with number 1 to the left hand side and number 2 the closest to the motor connectors.
|
||||
|
||||
You select a servo in the same manner as you select motors, by requesting a servo object from the controller - to select the first servo we use:
|
||||
|
||||
```c
|
||||
DW_Servo *s1 = dw.getServo(1);
|
||||
```
|
||||
|
||||
### Servo control
|
||||
|
||||
Once you have a servo object there are currently three commands you can run.
|
||||
|
||||
#### off()
|
||||
|
||||
The off command will switch off your servo and stop any signals being sent to it.
|
||||
|
||||
```c
|
||||
s1->off();
|
||||
```
|
||||
|
||||
#### setPWMuS( *microseconds* )
|
||||
|
||||
This command will allow you to set the PWM pulse to the Servo in microseconds.
|
||||
|
||||
Most standard servos use a parameter value of 1000 for fully counter-clockwise, 2000 for fully clockwise, and 1500 for the middle - though you may have a wider range on your servo, so you should check the technical documentation for it to get the finer details.
|
||||
|
||||
```c
|
||||
s1->setPWMuS(1500); // middle
|
||||
s1->setPWMuS(2000); // fully clockwise
|
||||
s1->setPWMuS(1000); // fully counter clockwise
|
||||
```
|
||||
|
||||
#### setPWMmS( *milliseconds* )
|
||||
|
||||
This command allows you to specify the PWM pulse in milliseconds rather than seconds.
|
||||
|
||||
```c
|
||||
s1->setPWMmS(1.5); // middle
|
||||
s1->setPWMmS(2.0); // fully clockwise
|
||||
s1->setPWMmS(1.0); // fully counter clockwise
|
||||
```
|
||||
|
||||
### Select a Stepper motor
|
||||
|
||||
You can control up to 3 stepper motors with the 640 board - each stepper motor uses two motor ports for 4 wire stepper motors and three motor ports for 5 wire stepper motors.
|
||||
|
||||
Running 5 wire stepper motors is almost the same as 4 wire stepper motors but requires a small extra step which we'll explain at the end.
|
||||
|
||||
Each stepper motor is assigned to a pair of motor ports -
|
||||
|
||||
- **Stepper motor 1** - uses motor ports 1 and 2
|
||||
- **Stepper motor 2** - uses motor ports 3 and 4
|
||||
- **Stepper motor 3** - uses motor ports 5 and 6
|
||||
|
||||
The first step is to identify the two wires for each coil on your stepper motor (you may need to read the technical documentation for your motor to find this out) and attach these two wires to each port.
|
||||
|
||||
*Example: You have a stepper motor with 4 wires - orange, pink, yellow and blue. If the orange and pink wires for your stepper motor are attached to coil one then attach these wires to motor port 1, attach the two remaining wires to motor port 2.*
|
||||
|
||||
Once you have your stepper motor wired up you need to request the relevant stepper motor object from the controller.
|
||||
|
||||
```c
|
||||
DW_Stepper *st1 = dw.getStepper(1);
|
||||
```
|
||||
|
||||
The default stepper object created assumes that your stepper motor has 48 steps per revolution - if you motor has more or less steps per revolution then you can specify this using an alterative command:
|
||||
|
||||
```c
|
||||
DW_Stepper *st1 = dw.getStepper(1, 48);
|
||||
```
|
||||
|
||||
Change the *48* in the line above to the number of steps your stepper motor has per revolution.
|
||||
|
||||
### Stepper motor control
|
||||
|
||||
There are four commands for stepper motors. The first one you'll recognise
|
||||
|
||||
#### off()
|
||||
|
||||
The off command will switch off the stepper motor
|
||||
|
||||
```c
|
||||
st1->off();
|
||||
```
|
||||
|
||||
#### setMotorSpeed( *rpm* )
|
||||
|
||||
This command allows you to set the speed of your stepper motor. Pass the number of revolutions per minute that you want your stepper motor to run at.
|
||||
|
||||
```c
|
||||
st1->setMotorSpeed(200);
|
||||
```
|
||||
|
||||
#### oneStep( *direction*, *style* )
|
||||
|
||||
This command will move the stepper motor one step in your chosen direction -
|
||||
|
||||
- **DW_FORWARD** - set the stepper motor to move forward
|
||||
- **DW_REVERSE** - set the stepper motor to move backwards
|
||||
|
||||
There are two stepping styles available -
|
||||
|
||||
- **DW_SINGLE** - this is the simplest method of stepping which activates a single coil at a time to move and hold the motor. This method uses the least amount of power.
|
||||
- **DW_DOUBLE** - this is a slightly more complex method of stepping which uses to coils to move and hold the motor. This method uses twice as much power as the single step, but is more powerful.
|
||||
|
||||
```c
|
||||
st1->oneStep(DW_FORWARD, DW_SINGLE);
|
||||
st1->oneStep(DW_REVERSE, DW_DOUBLE);
|
||||
```
|
||||
|
||||
#### step( *steps*, *direction*, *style* )
|
||||
|
||||
If you want to move the stepper motor a set number of steps then you can use this command. This, however, will stop all processing until the motor has moved the specified number of steps.
|
||||
|
||||
```c
|
||||
st1->step( 400, DW_FORWARD, DW_SINGLE );
|
||||
st1->step( 400, DW_REVERSE, DW_DOUBLE );
|
||||
```
|
||||
|
||||
If you want more control and need to move two or more motors at the same time then you should use the **oneStep** command.
|
||||
|
||||
## Compiling your code
|
||||
|
||||
Unlike with Python, we need to take an extra step with C++ and compile our code so that it can be run on the Raspberry Pi.
|
||||
|
||||
To do that, and to make it easier to re-compile as you update, we will create a *makefile*. The *makefile* is a little script that knows the location of all the libraries we want to include in our program and knows how to compile them together to make a single exectuable.
|
||||
76
escape.html
Normal file
@@ -0,0 +1,76 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
|
||||
<title>ESCAPE | Dark Water</title>
|
||||
|
||||
<!-- Flatdoc -->
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
|
||||
<script src='/flatdoc/legacy.js'></script>
|
||||
<script src='/flatdoc/flatdoc.js'></script>
|
||||
|
||||
<!-- Flatdoc theme -->
|
||||
<link href='/flatdoc/theme-dark/style.css?3' rel='stylesheet'>
|
||||
<script src='/flatdoc/theme-dark/script.js?1'></script>
|
||||
|
||||
<!-- Highlight.js -->
|
||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.4.0/styles/monokai-sublime.min.css">
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.4.0/highlight.min.js"></script>
|
||||
<!-- Meta -->
|
||||
<meta content="ESCAPE | Dark Water" property="og:title">
|
||||
<meta content="Dark Water Foundation documentation." name="description">
|
||||
|
||||
<!-- Initializer -->
|
||||
<script>
|
||||
Flatdoc.run({
|
||||
fetcher: Flatdoc.github('darkwaterfoundation/docs', 'escape.md')
|
||||
});
|
||||
|
||||
$(document).on('flatdoc:ready', function() {
|
||||
// Highlight all the codes
|
||||
$('pre code').each(function(i, block) {
|
||||
hljs.highlightBlock(block);
|
||||
});
|
||||
|
||||
var hash = window.location.hash;
|
||||
if(hash != '') {
|
||||
$('html, body').animate({
|
||||
scrollTop: $(hash).offset().top
|
||||
}, 2000);
|
||||
console.log(hash);
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body role='flatdoc' class='large-brief no-literate'>
|
||||
|
||||
<div class='header'>
|
||||
<div class='left'>
|
||||
<h1><a href='/index.html'>Dark Water Documentation</a></h1>
|
||||
<ul>
|
||||
<li><a href='/640.html'>640</a></li>
|
||||
<li><a href='/escape.html'>ESCAPE</a></li>
|
||||
<!--<li><a href='/soar.html'>Soar</a></li>-->
|
||||
<li><a href='/expansionadding.html'>Expansions</a></li>
|
||||
<li><a href='https://community.darkwater.io/'>Support</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class='right'>
|
||||
<!-- GitHub buttons: see http://ghbtns.com -->
|
||||
<iframe src="//ghbtns.com/github-btn.html?user=darkwaterfoundation&repo=docs&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="110" height="20"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='content-root'>
|
||||
<div class='menubar'>
|
||||
<div class='menu section' role='flatdoc-menu'></div>
|
||||
</div>
|
||||
<div role='flatdoc-content' class='content'></div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
682
escape.md
Normal file
@@ -0,0 +1,682 @@
|
||||
# Getting started
|
||||
|
||||

|
||||
|
||||
Welcome to the ESCAPE board - this guide will describe all the features of the ESCAPE board and show you how to control up to 6 motors and 6 servos very simply.
|
||||
|
||||
## Board layout
|
||||
|
||||
Before we start to assemble your board, we'll take a look at what each section is and what it is for. Place your ESCAPE board on a table in front of you and identify each area.
|
||||
|
||||
### CPPM / PPM-SUM
|
||||
|
||||

|
||||
|
||||
This is the connection that allows you connect a Radio Control (RC) receiver so that you can extend the range of control for your robot.
|
||||
|
||||
### Motors
|
||||
|
||||

|
||||
|
||||
The ESCAPE board can control 6 independent motors. Each motor has a connection with three pins onto which you will plug the control wire from the motors ESC unit. The centre pin on the Motor connections aren't connected together. This is because the centre wire from an ESC sends 5v and having multiple 5v power supplies connected to each other can be very bad.
|
||||
|
||||
### Servos
|
||||
|
||||

|
||||
|
||||
The ESCAPE board has connections for 6 Servos. They default to being powered by the ESCAPE boards power supply, but we can switch them to be powered by the Raspberry Pi by placing a jumper on the **POWER** pins (assuming the Raspberry Pi is powered via its USB port).
|
||||
|
||||

|
||||
|
||||
We can also power the Raspberry Pi by placing an ESC control wire on one of the Servo connects and using the 5v sent on its power wire with the **POWER** jumper in place.
|
||||
|
||||
We'll go into more detail on this later, so don't worry about it for now.
|
||||
|
||||
### Power
|
||||
|
||||

|
||||
|
||||
The power connection should accept 5v DC - the power you connect here is isolated from your Raspberry Pi and only goes to the servos unless you have the **POWER** jumper in place.
|
||||
|
||||
### Expansion area
|
||||
|
||||

|
||||
|
||||
This area to the right of the board is for adding extra expansion boards to increase the functionality available to you. For more information on adding expansion boards [look here](/expansionadding.html)
|
||||
|
||||
### Address selection
|
||||
|
||||

|
||||
|
||||
The ESCAPE board uses I2C to control the motors. You can have a lot of I2C controlled boards on your Raspberry Pi at the same time, but each must have a unique address.
|
||||
|
||||
We have set up the ESCAPE board to use the address **0x61**. If you find that this conflicts with another board you want to use, and you can't change the address of that board, then you can use these 5 solder jumpers to change the ESCAPE board address.
|
||||
|
||||
#### How to change the address
|
||||
|
||||
Each of the address pins (A0 - A4) can be set to 0 (un-soldered) or 1 (soldered). You set an address pin to 1 by adding solder to each pad of the address pin until the two parts join.
|
||||
|
||||

|
||||
|
||||
Each address jumper has a binary value - A0 = 1, A1 = 2, A3 = 4, A4 = 8
|
||||
|
||||
The starting address for the ESCAPE board is 0x61 - if you look closely at the jumper pads labelled A0 you will see a small connection between them setting this jumper to 1.
|
||||
|
||||
If we solder jumper A1 then the address will be 0x61 + 2 = 0x63. Soldering A1 and A2 will give us 0x61 + 2 + 4 = 0x67
|
||||
|
||||
# Setup your ESCAPE
|
||||
|
||||
Now that we know what each part of the board is for, it's time to solder all the connections - it doesn't matter what order you attach the connections to your board, but we've found that the order below is the simplest.
|
||||
|
||||
## Assemble the parts
|
||||
|
||||
**IMPORTANT** - if you have an expansion board that you want to add to your 640 board, then you should add that first as it will be a lot easier than adding it after soldering connectors to the board.
|
||||
|
||||

|
||||
|
||||
As we don't know what headers and connectors you selected when you ordered your ESCAPE board - we're going to show you how to connect the most common selection - other connectors and headers should attach in the same way.
|
||||
|
||||
*Hint* - A lump of plasticine or clay is very useful to hold your board level.
|
||||
|
||||
## Attach the 2 pin Power jumper
|
||||
|
||||
The small 2 pin jumper is the first part to put in place. It goes in the two holes labelled **POWER**.
|
||||
|
||||

|
||||
|
||||
Place it in the holes but don't solder it in place yet.
|
||||
|
||||

|
||||
|
||||
## Attach the 7 pin motor header and 6 pin servo header
|
||||
|
||||
The next parts to slot into place are the 7 x 3 connector for the CPPM and motors and the 6 x 3 connector for the servos. The holes for these parts are aligned so that the connectors should fit tightly and be held in place.
|
||||
|
||||

|
||||
|
||||
Slot them in place, and then using a piece of paper or card to hold the connectors in place, turn the board over.
|
||||
|
||||
Slide the paper away and use a piece of plasticine or clay to keep the board level on your desk if needed.
|
||||
|
||||

|
||||
|
||||
Solder all the pins in place - if you solder a single pin on each connector initially, then you can check if they are level and aligned correctly.
|
||||
|
||||
If they aren't then apply the soldering iron tip to the soldered pin and move the connector until it is level.
|
||||
|
||||
## Attach the power terminal
|
||||
|
||||
Now we need to add the power connector - slot it in place making sure that you have it the right way around (for the screw terminals the holes should be at the front of the board).
|
||||
|
||||
Use a piece of paper or card to hold the connector in place and turn the board upside down. Slide the paper out from under the board and use a piece of plasticine to prop the board up level.
|
||||
|
||||

|
||||
|
||||
Make sure everything is lined up correctly - use extra plasticine to align connectors if needed. Once you are happy, solder each of the pins.
|
||||
|
||||
## Attach the header
|
||||
|
||||
For this example we'll show you how to connect a stackable header, as it's the most complex.
|
||||
|
||||
Due to the length of the stackable headers pins, it can sometimes be a hassle to get them through the holes on the board.
|
||||
|
||||
We've found that if you slide up the spacer on the stackable header so that it is near the top, you can get the pins into the boards header holes a lot easier and then slide the spacer back down again.
|
||||
|
||||

|
||||
|
||||
Once you have your header in place, use some plasticine to make sure the board is level and then solder away. You should solder a single pin first, then make sure the header is level - if it isn't then apply the soldering iron to the pin again and move the header until it is correct.
|
||||
|
||||

|
||||
|
||||
Now that your board is set up, it's time to configure your Raspberry Pi so that you can use it.
|
||||
|
||||
# Setting up your Pi
|
||||
|
||||
Before we can start using the ESCAPE board we need to enable the interfaces that the board uses on your Raspberry Pi.
|
||||
|
||||
The ESCAPE board is controlled using the I2C interface. Any expansion boards attached to your ESCAPE board are controlled using the SPI interface.
|
||||
|
||||
## Enable I2C and SPI in Pixel
|
||||
|
||||
If you are using the graphical interface on your Raspberry Pi then click on your main menu icon, move down to *Preferences* and click on the *Raspberry Pi Configuration* menu item. Once open click on the *Interfaces* tab and you should see something like in the image below.
|
||||
|
||||

|
||||
|
||||
Make sure that the line labelled I2C is set to enabled.
|
||||
|
||||
If you have an expansion board then you'll need to enable the SPI interface as well on the line above, so click the *Enabled* setting next to the *SPI* label
|
||||
|
||||

|
||||
|
||||
Once you click Ok you may be promtped to reboot your Raspberry Pi - go ahead and reboot.
|
||||
|
||||
## Enable I2C and SPI on the command line
|
||||
|
||||
If you are only using the command line on your Raspberry Pi then you will need to use the text version of the Raspberry Pi configuration tool to enable the interfaces.
|
||||
|
||||
Type the following to bring up the configuration interface:
|
||||
|
||||
```bash
|
||||
$ sudo raspi-config
|
||||
```
|
||||
|
||||
Once the menu is showing, scroll down to the *Advanced Options* menu and press Enter.
|
||||
|
||||

|
||||
|
||||
Now we'll need to enable the I2C interface, so move down *I2C* menu and press Enter. You'll be asked if you want to enabled I2C - select *Yes* and you will see a confirmation and be returned to the main menu.
|
||||
|
||||

|
||||
|
||||
Go to the *Advanced Options* again and do the same for *SPI*
|
||||
|
||||

|
||||
|
||||
This time when you are returned to the main menu, move down to the *Finish* option (pressing the right arrow key twice will get you there) and press enter.
|
||||
|
||||
You have now enabled the interfaces you need to use your board.
|
||||
|
||||
## Reboot your Pi
|
||||
|
||||
Once you have enabled the interfaces you will need to reboot your Raspberry Pi so that the required libraries can be loaded. This is an important step and your code won't run correctly without it.
|
||||
|
||||
# Wiring up the ESCAPE board
|
||||
|
||||
Now that we have your ESCAPE board and Raspberry Pi setup, it's time to connect some motors and servos to it.
|
||||
|
||||

|
||||
|
||||
## Connecting Servos
|
||||
## Connecting Motors
|
||||
## Connecting the power
|
||||
## Connecting your RC receiver
|
||||
|
||||
# Programming the ESCAPE
|
||||
|
||||
## Installing the Python libraries
|
||||
|
||||
The Python libraries for the ESCAPE board and some example scripts are available via our GitHub repository. To install them open a terminal window on your Raspberry Pi (unless you are running with only the command line) and enter the following:
|
||||
|
||||
```bash
|
||||
$ git clone https://github.com/darkwaterfoundation/darkwater_python_escape.git
|
||||
```
|
||||
|
||||
Next you need to navigate into the new directory so enter:
|
||||
|
||||
```bash
|
||||
$ cd ./darkwater_python_escape
|
||||
```
|
||||
|
||||
And once in there we can install the libraries with:
|
||||
|
||||
```bash
|
||||
$ sudo python setup.py install
|
||||
```
|
||||
|
||||
### Example scripts
|
||||
|
||||
Once everything is installed we can have a play with the example scripts included in the download. As well as being useful to test each part of your board, they are also handy as a starting point when writing your own scrips.
|
||||
|
||||
Let's move into the examples directory and take a look at what is there.
|
||||
|
||||
```bash
|
||||
$ cd ./examples
|
||||
```
|
||||
|
||||
If you list the files in this directory, you should see a few test scripts
|
||||
|
||||
```bash
|
||||
$ ls -al
|
||||
```
|
||||
|
||||
#### escapemotortest.py
|
||||
|
||||
This script will start each motor port, in the forwards direction, in turn from left to right and then do the same backwards. To run the script enter the following:
|
||||
|
||||
```bash
|
||||
$ python escapemotortest.py
|
||||
```
|
||||
|
||||
#### escapeservotest.py
|
||||
|
||||
This script will move any servos connected to the servo headers left, then center, then right. To run the script enter the following:
|
||||
|
||||
```bash
|
||||
$ python escapeservotest.py
|
||||
```
|
||||
|
||||
## The Python API
|
||||
|
||||
Now you know everything works, it's time to write your own scripts. So create a new python script in your editor with a memorable name and add the following lines to import our libraries:
|
||||
|
||||
```python
|
||||
import time
|
||||
from darkwater_escape import dw_Controller, dw_Motor, dw_Servo
|
||||
```
|
||||
|
||||
### Create a controller
|
||||
|
||||
The **dw_controller** object controls access to all the elements on the ESCAPE board, so the first thing we need to do is create a controller - we pass in the address of the ESCAPE board as a parameter - the default address is 0x61
|
||||
|
||||
```python
|
||||
dw = dw_Controller( addr=0x61 )
|
||||
```
|
||||
|
||||
Now that we have the controller created, we can access all the connectors on the board.
|
||||
|
||||
### Select a Motor
|
||||
|
||||
There are 6 motor ports on the ESCAPE board numbered 1 to 6 from left to right (with the ports facing you ).
|
||||
|
||||
If we want to control a motor on port number 1 then we need to request the motor object for that port from our controller - this is very easily done with a single line
|
||||
|
||||
```python
|
||||
m1 = dw.getMotor(1)
|
||||
```
|
||||
|
||||
### Motor driving
|
||||
|
||||
There are two main commands that you can give a motor - to move in a direction and to stop.
|
||||
|
||||
We'll start with the main command to stop the motor
|
||||
|
||||
#### off()
|
||||
|
||||
The off command will switch off the motor
|
||||
|
||||
```python
|
||||
m1.off()
|
||||
```
|
||||
|
||||
#### setMotorSpeed( *speed* )
|
||||
|
||||
We can also stop the motor by using the second command and passing a speed of 0
|
||||
|
||||
```python
|
||||
m1.setMotorSpeed(0)
|
||||
```
|
||||
|
||||
The **setMotorSpeed** command allows you to specify the speed of each motor - there are two different speed ranges the first goes from *-255* to *255*, the second from *1000* to *2000*.
|
||||
|
||||
If you are familiar with radio control vehicles and ESC motors then you will recognise the second range.
|
||||
|
||||
For now we'll concentrate on the first range.
|
||||
|
||||
To get your motor going forwards at full speed you should set its speed at 255
|
||||
|
||||
```python
|
||||
m1.setMotorSpeed(255)
|
||||
```
|
||||
|
||||
To get your motor going backwards at full speed you should set its speed to -255
|
||||
|
||||
```python
|
||||
m1.setMotorSpeed(-255)
|
||||
```
|
||||
|
||||
The numbers from 0 to the maximum in each direction will drive the motor at a slower speed, so for half speed forwards we'd use
|
||||
|
||||
```python
|
||||
m1.setMotorSpeed(125)
|
||||
```
|
||||
|
||||
And for a slow speed backwards we can use
|
||||
|
||||
```python
|
||||
m1.setMotorSpeed(-50)
|
||||
```
|
||||
|
||||
#### Alternate speed range
|
||||
|
||||
The spped range above is easy to use as you can quickly see what speed is forwards, backwards and stopped. ESC powered motors use a different range that goes from 1000 to 2000, with 1500 (the middle point) being stop.
|
||||
|
||||
Both the ESCAPE and 640 boards can use either range, but if you are primarily working with ESC powered motors and Radio Control inputs then you should use this range as it makes programming a lot easier.
|
||||
|
||||
To get your motor going forwards at full speed you should set its speed to 2000
|
||||
|
||||
```python
|
||||
m1.setMotorSpeed(2000)
|
||||
```
|
||||
|
||||
For full speed reverse you should set the speed to 1000
|
||||
|
||||
```python
|
||||
m1.setMotorSpeed(1000)
|
||||
```
|
||||
|
||||
And to stop the motor we can set the speed to the mid point which is 1500
|
||||
|
||||
```python
|
||||
m1.setMotorSpeed(1500)
|
||||
```
|
||||
|
||||
As before, any number between 1500 and the maximum in each direction will drive the motor at a slower speed, so for half speed forward you'd set the speed to 1750
|
||||
|
||||
```python
|
||||
m1.setMotorSpeed(1750)
|
||||
```
|
||||
|
||||
and half speed in reverse would be 1250
|
||||
|
||||
```python
|
||||
m1.setMotorSpeed(1250)
|
||||
```
|
||||
|
||||
### Select a Servo
|
||||
|
||||
There are six servo ports on the ESCAPE board. They are numbered from 1 to 6 with number 1 to the left hand side and number 6 the closest to the power connector.
|
||||
|
||||
You select a servo in the same manner as you select motors, by requesting a servo object from the controller - to select the first servo we use:
|
||||
|
||||
```python
|
||||
s1 = dw.getServo(1)
|
||||
```
|
||||
|
||||
### Servo control
|
||||
|
||||
Once you have a servo object there are currently three commands you can run.
|
||||
|
||||
#### off()
|
||||
|
||||
The off command will switch off your servo and stop any signals being sent to it.
|
||||
|
||||
```python
|
||||
s1.off()
|
||||
```
|
||||
|
||||
#### setPWMuS( *microseconds* )
|
||||
|
||||
This command will allow you to set the PWM pulse to the Servo in microseconds.
|
||||
|
||||
Most standard servos use a parameter value of 1000 for fully counter-clockwise, 2000 for fully clockwise, and 1500 for the middle - though you may have a wider range on your servo, so you should check the technical documentation for it to get the finer details.
|
||||
|
||||
```python
|
||||
s1.setPWMuS(1500) # middle
|
||||
s1.setPWMuS(2000) # fully clockwise
|
||||
s1.setPWMuS(1000) # fully counter clockwise
|
||||
```
|
||||
|
||||
#### setPWMmS( *milliseconds* )
|
||||
|
||||
This command allows you to specify the PWM pulse in milliseconds rather than seconds.
|
||||
|
||||
```python
|
||||
s1.setPWMmS(1.5) # middle
|
||||
s1.setPWMmS(2.0) # fully clockwise
|
||||
s1.setPWMmS(1.0) # fully counter clockwise
|
||||
```
|
||||
|
||||
## Installing the C++ libraries
|
||||
|
||||
The C++ libraries for the ESCAPE board and some example scripts are available via our GitHub repository. To install them open a terminal window on your Raspberry Pi (unless you are running with only the command line) and enter the following:
|
||||
|
||||
```bash
|
||||
$ git clone https://github.com/darkwaterfoundation/darkwater_cplus_escape.git
|
||||
```
|
||||
|
||||
Once they are download we can navigate into the new directory and take a look around - so enter:
|
||||
|
||||
```bash
|
||||
$ cd ./darkwater_cplus_escape
|
||||
```
|
||||
|
||||
Let's list the contents of that new directory by typing
|
||||
|
||||
```bash
|
||||
$ ls -al
|
||||
```
|
||||
|
||||
You should see two directories (and a README.md file which contains this content), called **darkwater** and **examples**.
|
||||
|
||||
The **darkwater** directory contains all of the classes needed to control your board and the **examples** directory contains a selection of demo code we've put together to show you how they are used.
|
||||
|
||||
### Examples
|
||||
|
||||
Take a look in the examples directory and you will see the following available demos.
|
||||
|
||||
#### Motor
|
||||
|
||||
The Motor example will start each motor in turn from 1 through to 6 in a forwards direction, then stop them and do the same in reverse. To build this demo type the following:
|
||||
|
||||
```bash
|
||||
$ cd ./Motor
|
||||
$ make
|
||||
```
|
||||
|
||||
Once you are returned to the command prompt you can run the program with the command:
|
||||
|
||||
```bash
|
||||
$ sudo ./Motor
|
||||
```
|
||||
|
||||
#### Servo
|
||||
|
||||
The servo example will move each of the six servos backwards and forwards six times. To build this demo type the following:
|
||||
|
||||
```bash
|
||||
$ cd ./Servo
|
||||
$ make
|
||||
```
|
||||
|
||||
Once it is compiled you can run it with the command:
|
||||
|
||||
```bash
|
||||
$ sudo ./Servo
|
||||
```
|
||||
|
||||
#### PPM
|
||||
|
||||
The PPM example will read the input from a PPM radio control receiver connected to the CPPM header on the ESCAPE board, interpret the first 6 channels and move the corresponding servos.
|
||||
|
||||
To build this demo type the following:
|
||||
|
||||
```bash
|
||||
$ cd ./PPM
|
||||
$ make
|
||||
```
|
||||
|
||||
Once compiled, attach your CPPM receiver to the CPPM connector (see here CPPM set up) and run the program - you will see the output for each channel on the screen as it runs. Attaching servos to the Servo rail will allow you to control them individually by moving the sticks on your RC transmitter.
|
||||
|
||||
```bash
|
||||
$ sudo ./PPM
|
||||
```
|
||||
|
||||
#### AccelGyroMag
|
||||
|
||||
If you have a 9DoF expansion board on your ESCAPE board or are using a SOAR board then this example will read and output the Gyroscope, Accelerometer and Compass readings.
|
||||
|
||||
To compile and run it, type the following
|
||||
|
||||
```bash
|
||||
$ cd ./AccelGyroMag
|
||||
$ make
|
||||
$ sudo ./AccelGyroMag
|
||||
```
|
||||
|
||||
## The C++ API
|
||||
|
||||
If you take a look at the code in each of the examples you should be able to get an idea of how the ESCAPE board API works. We'll go into more detail of each of the available commands below.
|
||||
|
||||
The first thing we need to do for our program is to import the required libraries - so near the top of your new program you will put
|
||||
|
||||
```c
|
||||
#include "darkwater/DWESCAPE.h"
|
||||
#include "darkwater/Util.h"
|
||||
#include <stdlib.h>
|
||||
```
|
||||
|
||||
If you will be using the CPPM header for input then you will also need to add:
|
||||
|
||||
```c
|
||||
#include <pigpio.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
```
|
||||
|
||||
For this example, we'll include everthing in a *main* function for neatness - have a look at the PPM example code for an alternate set up.
|
||||
|
||||
```c
|
||||
int main()
|
||||
{
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
### Create a controller
|
||||
|
||||
The **DWESCAPE** object controls access to all the elements on the ESCAPE board, so the first thing we need to do is create a controller - we pass in the address of the ESCAPE board as a parameter - the default address is 0x61 so if you haven't changed the address then you can leave this out.
|
||||
|
||||
```c
|
||||
DWESCAPE dw(0x61);
|
||||
dw.initialize();
|
||||
```
|
||||
|
||||
Now that we have the controller created, we can access all the connectors on the board.
|
||||
|
||||
### Select a Motor
|
||||
|
||||
There are 6 motor ports on the ESCAPE board numbered 1 to 6 from left to right (with the ports facing you ).
|
||||
|
||||
If we want to control a motor on port number 1 then we need to request the motor object for that port from our controller - this is very easily done with a single line
|
||||
|
||||
```c
|
||||
DW_Motor *dw1 = dw.getMotor(1);
|
||||
```
|
||||
|
||||
### Motor driving
|
||||
|
||||
There are two main commands that you can give a motor - to move in a direction and to stop.
|
||||
|
||||
We'll start with the main command to stop the motor
|
||||
|
||||
#### off()
|
||||
|
||||
The off command will switch off the motor
|
||||
|
||||
```c
|
||||
dw1->off()
|
||||
```
|
||||
|
||||
#### setMotorSpeed( *speed* )
|
||||
|
||||
We can also stop the motor by using the second command and passing a speed of 0
|
||||
|
||||
```c
|
||||
dw1->setMotorSpeed(0);
|
||||
```
|
||||
|
||||
The **setMotorSpeed** command allows you to specify the speed of each motor - there are two different speed ranges the first goes from *-255* to *255*, the second from *1000* to *2000*.
|
||||
|
||||
If you are familiar with radio control vehicles and ESC motors then you will recognise the second range.
|
||||
|
||||
For now we'll concentrate on the first range.
|
||||
|
||||
To get your motor going forwards at full speed you should set its speed at 255
|
||||
|
||||
```c
|
||||
dw1->setMotorSpeed(255);
|
||||
```
|
||||
|
||||
To get your motor going backwards at full speed you should set its speed to -255
|
||||
|
||||
```c
|
||||
dw1->setMotorSpeed(-255)
|
||||
```
|
||||
|
||||
The numbers from 0 to the maximum in each direction will drive the motor at a slower speed, so for half speed forwards we'd use
|
||||
|
||||
```c
|
||||
dw1->setMotorSpeed(125)
|
||||
```
|
||||
|
||||
And for a slow speed backwards we can use
|
||||
|
||||
```c
|
||||
dw1->setMotorSpeed(-50)
|
||||
```
|
||||
|
||||
#### Alternate speed range
|
||||
|
||||
The spped range above is easy to use as you can quickly see what speed is forwards, backwards and stopped. ESC powered motors use a different range that goes from 1000 to 2000, with 1500 (the middle point) being stop.
|
||||
|
||||
Both the ESCAPE and 640 boards can use either range, but if you are primarily working with ESC powered motors and Radio Control inputs then you should use this range as it makes programming a lot easier.
|
||||
|
||||
To get your motor going forwards at full speed you should set its speed to 2000
|
||||
|
||||
```c
|
||||
dw1->setMotorSpeed(2000)
|
||||
```
|
||||
|
||||
For full speed reverse you should set the speed to 1000
|
||||
|
||||
```c
|
||||
dw1->setMotorSpeed(1000)
|
||||
```
|
||||
|
||||
And to stop the motor we can set the speed to the mid point which is 1500
|
||||
|
||||
```c
|
||||
dw1->setMotorSpeed(1500)
|
||||
```
|
||||
|
||||
As before, any number between 1500 and the maximum in each direction will drive the motor at a slower speed, so for half speed forward you'd set the speed to 1750
|
||||
|
||||
```c
|
||||
dw1->setMotorSpeed(1750)
|
||||
```
|
||||
|
||||
and half speed in reverse would be 1250
|
||||
|
||||
```c
|
||||
dw1->setMotorSpeed(1250)
|
||||
```
|
||||
|
||||
### Select a Servo
|
||||
|
||||
There are six servo ports on the ESCAPE board. They are numbered from 1 to 6 with number 1 to the left hand side and number 6 the closest to the power connector.
|
||||
|
||||
You select a servo in the same manner as you select motors, by requesting a servo object from the controller - to select the first servo we use:
|
||||
|
||||
```c
|
||||
DW_Servo *s1 = dw.getServo(1);
|
||||
```
|
||||
|
||||
### Servo control
|
||||
|
||||
Once you have a servo object there are currently three commands you can run.
|
||||
|
||||
#### off()
|
||||
|
||||
The off command will switch off your servo and stop any signals being sent to it.
|
||||
|
||||
```c
|
||||
s1->off();
|
||||
```
|
||||
|
||||
#### setPWMuS( *microseconds* )
|
||||
|
||||
This command will allow you to set the PWM pulse to the Servo in microseconds.
|
||||
|
||||
Most standard servos use a parameter value of 1000 for fully counter-clockwise, 2000 for fully clockwise, and 1500 for the middle - though you may have a wider range on your servo, so you should check the technical documentation for it to get the finer details.
|
||||
|
||||
```c
|
||||
s1->setPWMuS(1500); // middle
|
||||
s1->setPWMuS(2000); // fully clockwise
|
||||
s1->setPWMuS(1000); // fully counter clockwise
|
||||
```
|
||||
|
||||
#### setPWMmS( *milliseconds* )
|
||||
|
||||
This command allows you to specify the PWM pulse in milliseconds rather than seconds.
|
||||
|
||||
```c
|
||||
s1->setPWMmS(1.5); // middle
|
||||
s1->setPWMmS(2.0); // fully clockwise
|
||||
s1->setPWMmS(1.0); // fully counter clockwise
|
||||
```
|
||||
|
||||
## Compiling your code
|
||||
|
||||
Unlike with Python, we need to take an extra step with C++ and compile our code so that it can be run on the Raspberry Pi.
|
||||
|
||||
To do that, and to make it easier to re-compile as you update, we will create a *makefile*. The *makefile* is a little script that knows the location of all the libraries we want to include in our program and knows how to compile them together to make a single exectuable.
|
||||
@@ -13,7 +13,7 @@
|
||||
<script src='/flatdoc/flatdoc.js'></script>
|
||||
|
||||
<!-- Flatdoc theme -->
|
||||
<link href='/flatdoc/theme-dark/style.css?2' rel='stylesheet'>
|
||||
<link href='/flatdoc/theme-dark/style.css?3' rel='stylesheet'>
|
||||
<script src='/flatdoc/theme-dark/script.js?1'></script>
|
||||
|
||||
<!-- Highlight.js -->
|
||||
@@ -26,7 +26,7 @@
|
||||
<!-- Initializer -->
|
||||
<script>
|
||||
Flatdoc.run({
|
||||
fetcher: Flatdoc.github('darkwaterfoundation/docs', 'expansions.md')
|
||||
fetcher: Flatdoc.github('darkwaterfoundation/docs', 'expansionadding.md')
|
||||
});
|
||||
|
||||
$(document).on('flatdoc:ready', function() {
|
||||
@@ -37,17 +37,17 @@
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body role='flatdoc' class='big-h3'>
|
||||
<body role='flatdoc' class='big-h3 large-brief no-literate'>
|
||||
|
||||
<div class='header'>
|
||||
<div class='left'>
|
||||
<h1><a href='/index.html'>Dark Water Documentation</a></h1>
|
||||
<ul>
|
||||
<li><a href='/640gettingstarted.html'>640</a></li>
|
||||
<li><a href='/escapegettingstarted.html'>ESCAPE</a></li>
|
||||
<li><a href='/640.html'>640</a></li>
|
||||
<li><a href='/escape.html'>ESCAPE</a></li>
|
||||
<!--<li><a href='/soar.html'>Soar</a></li>-->
|
||||
<li><a href='/expansionadding.html'>Expansions</a></li>
|
||||
|
||||
<li><a href='https://community.darkwater.io/'>Support</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class='right'>
|
||||
|
||||
@@ -1,3 +1,109 @@
|
||||
# Expanding your boards
|
||||
|
||||
### Adding an expansion board
|
||||
Each of the boards has an area on the right hand side for adding an expansion board.
|
||||
|
||||
### 640 board
|
||||
|
||||
The expansion area on the blue 640 board has solder already applied to it to make it easier to add your expansion board.
|
||||
|
||||

|
||||
|
||||
### ESCAPE board
|
||||
|
||||
The expansion area on the blue ESCAPE board has solder already applied to it to make it easier to add your expansion board.
|
||||
|
||||

|
||||
|
||||
### SOAR board
|
||||
|
||||
The expansion area on the blue SOAR board doesn't have solder pre-applied, so adding an expansion board will to this will be slightly different.
|
||||
|
||||

|
||||
|
||||
# Required equipment
|
||||
|
||||
To add an expansion board you will need a few tools and bits and pieces.
|
||||
|
||||
### Solering iron
|
||||
|
||||
I assume you already own a soldering iron, but in case you don't, we recommend getting an iron with a digital temperature control. They may be slightly more expensive than the soldering irons that just plug into the power socket but if you are going to be doing a lot of soldering then it's worth it in the end.
|
||||
|
||||
### Solder
|
||||
|
||||
We use Lead Free solder here, but if you prefer leaded then that should be fine as well.
|
||||
|
||||
### Flux pen
|
||||
|
||||
A Flux pen is a *must have* item really - you will never regret buying one. We use this one - [Electrolube SMF12P Surface Mount Rework Flux Pen 12ml](https://www.rapidonline.com/electrolube-smf12p-surface-mount-rework-flux-pen-12ml-single-87-4426)
|
||||
|
||||
### Flux remover
|
||||
|
||||
Flux, whilst useful, can leave nasty sticky areas on your board. You should always use flux remover on your board once you've soldered it to remove it and make things nice again.
|
||||
|
||||
We use this one - [Ambersil 30216-AB Flux Remover 400ml](https://www.rapidonline.com/ambersil-30216-ab-flux-remover-400ml-87-7352)
|
||||
|
||||
### Tweezers
|
||||
|
||||
A good set of tweezers so you can hold the exapnsion board.
|
||||
|
||||
# Adding your board
|
||||
|
||||
The expansion boards have small notches on the side (that are called castellated vias) that we need to solder to the pads on the main board. Soldering these maybe new to you and seem a bit daunting - don't worry though as it's not as difficult as it looks.
|
||||
|
||||
### Sparkfun tutorial
|
||||
|
||||
We recommend watching this video by Sparkfun before you get started as it goes through the process we'll describe later in a lot of detail.
|
||||
|
||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/rGvvwXrv310" frameborder="0" allowfullscreen></iframe>
|
||||
|
||||
### Expansion orientation
|
||||
|
||||
You'll notice a small white dot next to the expansion area on your main board. If you place the expansion board along side you should be able to see a similar white dot in one corner (labelled **Z**).
|
||||
|
||||

|
||||
|
||||
When you place the expansion board on the main board, you should line these two dots up.
|
||||
|
||||
### Soldering the first pad
|
||||
|
||||
Add some flux to each of the pads on your main board.
|
||||
|
||||
If your main board is the SOAR board then you will need to add a bit of solder to one of the pads - we recommend the right hand pad on the same row as the white dot. Once you've added some solder, add some more flux over the top of it.
|
||||
|
||||
### Attaching the board
|
||||
|
||||
Now add some flux to the edges and pads of the expansion board. Once you have done that, pick the exapnsion board up with your tweezers, making sure that it is still in the correct orientation.
|
||||
|
||||
Hold the exapnsion board on the main board and try to line up the small notches on the expansion board with the pads one the main board.
|
||||
|
||||
Once you are happy, apply some heat with your soldering iron to the first pad you picked earlier and you should see the solder flow and join the two boards together.
|
||||
|
||||
Remove the iron and let the joint cool down, then let go of the exapnsion board with your tweezers.
|
||||
|
||||
If the board is slightly mis-aligned then you can apply some more flux to the first pad, re-heat it with your soldering iron and move the exapnsion board with your tweezers until it is lined up.
|
||||
|
||||
Again, make sure you remove the soldering iron **before** you let go with the tweezers so the solder hardens and keeps the expansion board in place.
|
||||
|
||||
### Solder the rest of the pads
|
||||
|
||||
Now the first pad is soldered and the two boards joined, it's time to solder the rest of the pads. Make sure you have flux applied to each pad and notch (add some more if you are unsure - it won't hurt).
|
||||
|
||||
Melt a small amount of solder on the end of your soldering iron and touch the next pad, you should see the solder reflow and the flux will pull it to the expansion board and join them.
|
||||
|
||||
Continue with each pad in the same way (with a little bit of solder on the end of your iron). Leave the pad next to the white dot until last.
|
||||
|
||||
### Ground pad
|
||||
|
||||
The ground pad ( the one next to the white dot ) is the trickiest to solder as it is connected to the *ground plane* on the main board and will take a bit longer to heat up.
|
||||
|
||||
Add more flux to that pad (and the exapnsion board pade and notch) and, with some solder on your iron, place the tip so that the end touches the expansion board and a bit of the body touches the main pad.
|
||||
|
||||
You'll need to leave it there for a little bit longer than you did with the other pads, but it will heat up after a few seconds and you'll see the solder flow in the same manner.
|
||||
|
||||

|
||||
|
||||
Congratulations - you have now attached your expansion board.
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ input {
|
||||
line-height: 1.6;
|
||||
font-size: 15px;
|
||||
color: #272724;
|
||||
background: #272724;
|
||||
background: #ffffff;
|
||||
}
|
||||
@media (max-width: 480px) {
|
||||
body,
|
||||
|
||||
BIN
images/battery640.png
Normal file
|
After Width: | Height: | Size: 60 KiB |
BIN
images/expansionedge.jpg
Normal file
|
After Width: | Height: | Size: 92 KiB |
BIN
images/expansionorientation.jpg
Normal file
|
After Width: | Height: | Size: 73 KiB |
BIN
images/expansionside.jpg
Normal file
|
After Width: | Height: | Size: 73 KiB |
BIN
images/motors640.png
Normal file
|
After Width: | Height: | Size: 61 KiB |
BIN
images/only640.png
Normal file
|
After Width: | Height: | Size: 55 KiB |
BIN
images/onlyescape.png
Normal file
|
After Width: | Height: | Size: 73 KiB |
BIN
images/rc640.png
Normal file
|
After Width: | Height: | Size: 67 KiB |
BIN
images/servo640.png
Normal file
|
After Width: | Height: | Size: 74 KiB |
BIN
images/smallbuggy.jpg
Normal file
|
After Width: | Height: | Size: 1.1 MiB |
11
index.html
@@ -13,7 +13,7 @@
|
||||
<script src='/flatdoc/flatdoc.js'></script>
|
||||
|
||||
<!-- Flatdoc theme -->
|
||||
<link href='/flatdoc/theme-dark/style.css?2' rel='stylesheet'>
|
||||
<link href='/flatdoc/theme-dark/style.css?3' rel='stylesheet'>
|
||||
<script src='/flatdoc/theme-dark/script.js?1'></script>
|
||||
<!-- Extra theme bits -->
|
||||
<link href='/flatdoc/support/theme.css' rel='stylesheet'>
|
||||
@@ -41,9 +41,9 @@
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body role='flatdoc' class='large-brief'>
|
||||
<body role='flatdoc' class='large-brief no-literate'>
|
||||
|
||||
<div class='title-area title-card' style='background-image: url(//darkwater.io/content/uploads/2016/04/bubbles.jpg)'>
|
||||
<div class='title-area title-card' style='background-image: url(//docs.darkwater.io/images/smallbuggy.jpg)'>
|
||||
<div class='in'>
|
||||
<div class='headline'>
|
||||
<h1>Dark Water Documentation</h1>
|
||||
@@ -57,10 +57,11 @@
|
||||
<div class='left'>
|
||||
<h1><a href='/index.html'>Dark Water Documentation</a></h1>
|
||||
<ul>
|
||||
<li><a href='/640gettingstarted.html'>640</a></li>
|
||||
<li><a href='/escapegettingstarted.html'>ESCAPE</a></li>
|
||||
<li><a href='/640.html'>640</a></li>
|
||||
<li><a href='/escape.html'>ESCAPE</a></li>
|
||||
<!--<li><a href='/soar.html'>Soar</a></li>-->
|
||||
<li><a href='/expansionadding.html'>Expansions</a></li>
|
||||
<li><a href='https://community.darkwater.io/'>Support</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class='right'>
|
||||
|
||||
26
readme.md
@@ -10,13 +10,15 @@ The 640 (Six for Zero) board is a DC and Stepper motor control board capable of
|
||||
|
||||

|
||||
|
||||
- [Getting started](/640gettingstarted.html) setting up your 640 board ready for use
|
||||
- [Wiring everything up](/640wiring.html) connecting your power, motors and servos
|
||||
- [Programming in Python](/640python.html) the Python API and how to use it
|
||||
- [Programming in C++](/640cplusplus.html) controlling the board in C++
|
||||
- [Getting started](/640.html#getting-started) find out about your 640 board
|
||||
- [Setup your 640](/640.html#setup-your-640) setting up your 640 board ready for use
|
||||
- [Setting up your Pi](/640.html#setting-up-your-pi) setting up your Raspberry Pi
|
||||
- [Wiring everything up](/640.html) connecting your power, motors and servos
|
||||
- [Programming in Python](/640.html#programming-the-640-installing-the-python-libraries) the Python API and how to use it
|
||||
- [Programming in C++](/640.html#programming-the-640-installing-the-c-libraries) controlling the board in C++
|
||||
- [Set up RC Input]() reading input from your RC receiver
|
||||
- [Expanding](/expansionadding.html) adding extra expansion boards
|
||||
- [Get Advanced](/640advanced.html) more advanced things you can do
|
||||
- [Get Advanced]() more advanced things you can do
|
||||
|
||||
[Pre-Order a 640 board >](https://darkwater.io/product/640-dc-motor-control-board/)
|
||||
|
||||
@@ -26,13 +28,15 @@ The ESCAPE (ESC-cape) board was designed to provide a method of using brushless
|
||||
|
||||

|
||||
|
||||
- [Getting started](/escapegettingstarted.html) setting up your ESCAPE board ready for use
|
||||
- [Wiring everything up](/escapewiring.html) connecting your power, motors and servos
|
||||
- [Programming in Python](/escapepython.html) the Python API and how to use it
|
||||
- [Programming in C++](/escapecplusplus.html) controlling the board in C++
|
||||
- [Getting started](/escape.html#getting-started) find out about your ESCAPE board
|
||||
- [Setup your ESCAPE](/escape.html#setup-your-escape) setting up your ESCAPE board ready for use
|
||||
- [Setting up your Pi](/escape.html#setting-up-your-pi) setting up your Raspberry Pi
|
||||
- [Wiring everything up](/escape.html) connecting your power, motors and servos
|
||||
- [Programming in Python](/escape.html#programming-the-escape-installing-the-python-libraries) the Python API and how to use it
|
||||
- [Programming in C++](/escape.html#programming-the-escape-installing-the-c-libraries) controlling the board in C++
|
||||
- [Set up RC Input]() reading input from your RC receiver
|
||||
- [Expanding](/expansionadding.html) adding extra expansion boards
|
||||
- [Get Advanced](/escapeadvanced.html) more advanced things you can do
|
||||
- [Get Advanced]() more advanced things you can do
|
||||
|
||||
[Pre-Order an ESCAPE board >](https://darkwater.io/product/escape-esc-powered-motor-control-board/)
|
||||
|
||||
@@ -42,7 +46,7 @@ The SOAR board is a holder for advanced sensors. It is ideal for use with differ
|
||||
|
||||

|
||||
|
||||
- [Getting started](/soargettingstarted.html) setting up your SOAR board ready for use
|
||||
- [Getting started](/soar.html) setting up your SOAR board ready for use
|
||||
- [Adding an expansion board](/expansionadding.html) adding an expansion board
|
||||
- [Reading data]() reading the sensor data
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<script src='/flatdoc/flatdoc.js'></script>
|
||||
|
||||
<!-- Flatdoc theme -->
|
||||
<link href='/flatdoc/theme-dark/style.css?2' rel='stylesheet'>
|
||||
<link href='/flatdoc/theme-dark/style.css?3' rel='stylesheet'>
|
||||
<script src='/flatdoc/theme-dark/script.js?1'></script>
|
||||
|
||||
<!-- Highlight.js -->
|
||||
@@ -37,7 +37,7 @@
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body role='flatdoc' class='big-h3'>
|
||||
<body role='flatdoc' class='large-brief no-literate'>
|
||||
|
||||
<div class='header'>
|
||||
<div class='left'>
|
||||
@@ -46,8 +46,8 @@
|
||||
<li><a href='/640.html'>640</a></li>
|
||||
<li><a href='/escape.html'>ESCAPE</a></li>
|
||||
<!--<li><a href='/soar.html'>Soar</a></li>-->
|
||||
<li><a href='/expansions.html'>Expansions</a></li>
|
||||
|
||||
<li><a href='/expansionadding.html'>Expansions</a></li>
|
||||
<li><a href='https://community.darkwater.io/'>Support</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class='right'>
|
||||
|
||||
89
soar.md
@@ -1,38 +1,73 @@
|
||||
# Introduction
|
||||
# Getting started
|
||||
|
||||
The Soar board holds a 9 Degrees of Freedom IMU chip and a Barometer.
|
||||

|
||||
|
||||
## Getting started
|
||||
## Board layout
|
||||
## Setup
|
||||
Welcome to the SOAR board - this is a very simple board designed to hold our small expansion sensors.
|
||||
|
||||
# Programming the Soar
|
||||
Whilst you may decide to connect an expansion sensor directly to your control board - if you think that you may change motor drivers at some point, then this board gives you the option of keeping your sensors separate.
|
||||
|
||||
## Python
|
||||
## Setup your SOAR
|
||||
|
||||
### Introduction
|
||||
### Import libraries
|
||||
### Reading the Compass
|
||||
### Reading the Magnetometer
|
||||
### Reading the Gyroscope
|
||||
### Reading the Barometer
|
||||
The first thing you should do is add the expansion sensor to your SOAR board - it is a lot easier to solder it on when the SOAR board is flat on your desk.
|
||||
|
||||
## Node.JS
|
||||

|
||||
|
||||
### Introduction
|
||||
### Import libraries
|
||||
### Reading the Compass
|
||||
### Reading the Magnetometer
|
||||
### Reading the Gyroscope
|
||||
### Reading the Barometer
|
||||
Our guide to adding the [expansion board is here](/expansionadding.html).
|
||||
|
||||
## C++
|
||||
### Attach the header
|
||||
|
||||
### Introduction
|
||||
### Install prerequisites
|
||||
### Reading the Compass
|
||||
### Reading the Magnetometer
|
||||
### Reading the Gyroscope
|
||||
### Reading the Barometer
|
||||
For this example we'll show you how to connect a stackable header, as it's the most complex.
|
||||
|
||||
Due to the length of the stackable headers pins, it can sometimes be a hassle to get them through the holes on the board.
|
||||
|
||||
We've found that if you slide up the spacer on the stackable header so that it is near the top, you can get the pins into the boards header holes a lot easier and then slide the spacer back down again.
|
||||
|
||||

|
||||
|
||||
Once you have your header in place, use some plasticine to make sure the board is level and then solder away. You should solder a single pin first, then make sure the header is level - if it isn't then apply the soldering iron to the pin again and move the header until it is correct.
|
||||
|
||||

|
||||
|
||||
*Note* - the image above shows the SOAR board ready for the header to be soldered **without** the expansion sensor attached - you can assemble the board in this order if you want (some people prefer it), but it's easier to add the expansion sensor first in our opinion.
|
||||
|
||||
Now that your board is set up, it's time to configure your Raspberry Pi so that you can use it.
|
||||
|
||||
# Setting up your Pi
|
||||
|
||||
Before we can start using the SOAR board we need to enable the interface that the board uses on your Raspberry Pi.
|
||||
|
||||
The SOAR board is controlled using the SPI interface.
|
||||
|
||||
## Enable SPI in Pixel
|
||||
|
||||
If you are using the graphical interface on your Raspberry Pi then click on your main menu icon, move down to *Preferences* and click on the *Raspberry Pi Configuration* menu item. Once open click on the *Interfaces* tab and you should see something like in the image below.
|
||||
|
||||

|
||||
|
||||
Make sure that the line labelled SPI is set to enabled.
|
||||
|
||||
Once you click Ok you may be promtped to reboot your Raspberry Pi - go ahead and reboot.
|
||||
|
||||
## Enable SPI on the command line
|
||||
|
||||
If you are only using the command line on your Raspberry Pi then you will need to use the text version of the Raspberry Pi configuration tool to enable the interfaces.
|
||||
|
||||
Type the following to bring up the configuration interface:
|
||||
|
||||
```bash
|
||||
$ sudo raspi-config
|
||||
```
|
||||
|
||||
Once the menu is showing, scroll down to the *Advanced Options* menu and press Enter.
|
||||
|
||||

|
||||
|
||||
Now we'll need to enable the SPI interface, so move down to the *SPI* menu and press Enter. You'll be asked if you want to enabled SPI - select *Yes* and you will see a confirmation and be returned to the main menu.
|
||||
|
||||
When you are returned to the main menu, move down to the *Finish* option (pressing the right arrow key twice will get you there) and press enter.
|
||||
|
||||
You have now enabled the interface you need to use your board.
|
||||
|
||||
## Reboot your Pi
|
||||
|
||||
Once you have enabled the interfaces you will need to reboot your Raspberry Pi so that the required libraries can be loaded. This is an important step and your code won't run correctly without it.
|
||||
@@ -13,7 +13,7 @@
|
||||
<script src='/flatdoc/flatdoc.js'></script>
|
||||
|
||||
<!-- Flatdoc theme -->
|
||||
<link href='/flatdoc/theme-dark/style.css?2' rel='stylesheet'>
|
||||
<link href='/flatdoc/theme-dark/style.css?3' rel='stylesheet'>
|
||||
<script src='/flatdoc/theme-dark/script.js?1'></script>
|
||||
<!-- Extra theme bits -->
|
||||
<link href='/flatdoc/support/theme.css' rel='stylesheet'>
|
||||
@@ -24,7 +24,7 @@
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.4.0/highlight.min.js"></script>
|
||||
|
||||
<!-- Meta -->
|
||||
<meta content="Dark Water" property="og:title">
|
||||
<meta content="Tutorial - Building the Quadcopter" property="og:title">
|
||||
<meta content="Dark Water Foundation documentation." name="description">
|
||||
|
||||
<!-- Initializer -->
|
||||
@@ -41,16 +41,17 @@
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body role='flatdoc' class='large-brief'>
|
||||
<body role='flatdoc' class='big-h3 large-brief no-literate'>
|
||||
|
||||
<div class='header'>
|
||||
<div class='left'>
|
||||
<h1><a href='/index.html'>Dark Water Documentation</a></h1>
|
||||
<ul>
|
||||
<li><a href='/640gettingstarted.html'>640</a></li>
|
||||
<li><a href='/escapegettingstarted.html'>ESCAPE</a></li>
|
||||
<li><a href='/640.html'>640</a></li>
|
||||
<li><a href='/escape.html'>ESCAPE</a></li>
|
||||
<!--<li><a href='/soar.html'>Soar</a></li>-->
|
||||
<li><a href='/expansionadding.html'>Expansions</a></li>
|
||||
<li><a href='https://community.darkwater.io/'>Support</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class='right'>
|
||||
|
||||