Mercurial > d1-mini-16ch-servo
changeset 3:fceb49bdbb05 draft
Add documentation
| author | Radomir Dopieralski <sheep-devel@sheep.art.pl> |
|---|---|
| date | Fri, 24 Mar 2017 13:16:47 +0100 |
| parents | 6eb21ffb8849 |
| children | 8495ecde2bdf |
| files | .hgignore docs/Makefile docs/assembly.rst docs/conf.py docs/connecting.rst docs/images/IMG_20170320_111414.jpg docs/images/IMG_20170320_112712.jpg docs/images/IMG_20170320_112839.jpg docs/images/IMG_20170320_112918.jpg docs/images/IMG_20170320_113010.jpg docs/images/IMG_20170320_113027.jpg docs/images/IMG_20170320_113203.jpg docs/images/IMG_20170320_130558.jpg docs/images/IMG_20170320_131501.jpg docs/index.rst docs/make.bat docs/overview.rst docs/power.rst docs/programming.rst |
| diffstat | 19 files changed, 1161 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Fri Mar 24 13:16:47 2017 +0100 @@ -0,0 +1,5 @@ +syntax: glob +*~ +.*.swp +*.DS_Store +docs/_build
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/Makefile Fri Mar 24 13:16:47 2017 +0100 @@ -0,0 +1,216 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = _build + +# User-friendly check for sphinx-build +ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) +$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) +endif + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . +# the i18n builder cannot share the environment and doctrees with the others +I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . + +.PHONY: help +help: + @echo "Please use \`make <target>' where <target> is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " applehelp to make an Apple Help Book" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " texinfo to make Texinfo files" + @echo " info to make Texinfo files and run them through makeinfo" + @echo " gettext to make PO message catalogs" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " xml to make Docutils-native XML files" + @echo " pseudoxml to make pseudoxml-XML files for display purposes" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + @echo " coverage to run coverage check of the documentation (if enabled)" + +.PHONY: clean +clean: + rm -rf $(BUILDDIR)/* + +.PHONY: html +html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +.PHONY: dirhtml +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +.PHONY: singlehtml +singlehtml: + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +.PHONY: pickle +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +.PHONY: json +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +.PHONY: htmlhelp +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +.PHONY: qthelp +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/D1Mini16-channelServoShield.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/D1Mini16-channelServoShield.qhc" + +.PHONY: applehelp +applehelp: + $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp + @echo + @echo "Build finished. The help book is in $(BUILDDIR)/applehelp." + @echo "N.B. You won't be able to view it unless you put it in" \ + "~/Library/Documentation/Help or install it in your application" \ + "bundle." + +.PHONY: devhelp +devhelp: + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/D1Mini16-channelServoShield" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/D1Mini16-channelServoShield" + @echo "# devhelp" + +.PHONY: epub +epub: + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +.PHONY: latex +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." + +.PHONY: latexpdf +latexpdf: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +.PHONY: latexpdfja +latexpdfja: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through platex and dvipdfmx..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +.PHONY: text +text: + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." + +.PHONY: man +man: + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +.PHONY: texinfo +texinfo: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo + @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." + @echo "Run \`make' in that directory to run these through makeinfo" \ + "(use \`make info' here to do that automatically)." + +.PHONY: info +info: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo "Running Texinfo files through makeinfo..." + make -C $(BUILDDIR)/texinfo info + @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." + +.PHONY: gettext +gettext: + $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale + @echo + @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." + +.PHONY: changes +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." + +.PHONY: linkcheck +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." + +.PHONY: doctest +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." + +.PHONY: coverage +coverage: + $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage + @echo "Testing of coverage in the sources finished, look at the " \ + "results in $(BUILDDIR)/coverage/python.txt." + +.PHONY: xml +xml: + $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml + @echo + @echo "Build finished. The XML files are in $(BUILDDIR)/xml." + +.PHONY: pseudoxml +pseudoxml: + $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml + @echo + @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/assembly.rst Fri Mar 24 13:16:47 2017 +0100 @@ -0,0 +1,100 @@ +Assembly +******** + +To protect the boards during transport, they ship only partially assembled. +Before you can use them, you need to solder the stacking headers on them. + +.. warning:: + + Soldering the headers is a necessary step, and can't be skipped. Just + inserting the headers without soldering will not provide a robust + electrical connection that is required for this shield to work properly. + + +.. image:: images/IMG_20170320_131501.jpg + :align: center + + +Stacking Headers +================ + +You should have received a pair of 8-pin stacking headers with your board. They +let you put this shield either on top or on the bottom of the D1 Mini, and stack more shields on top (or bottom) of that. + +.. note:: + + If you want to, you can instead use normal male or female headers, or even + connect the shield to the microcontroller board by soldering the wires or + male headers to both boards directly. In either case, the procedure is + similar. + + +Start by putting the headers on your board, or any other already assembled +shield. This will hold them in place straight and make it easier to work. + + +.. image:: images/IMG_20170320_112712.jpg + :align: center + + +Then place the shield on the headers, making sure that every pin goes into its +hole. You might need to use tweezers to help you insert all the pins. + + +.. image:: images/IMG_20170320_112839.jpg + :align: center + + +Next, connect your soldering iron, wait for it to get hot, and put it on one of the pins, so that it touches both the pin and the board. + + +.. image:: images/IMG_20170320_112918.jpg + :align: center + + +Wait a couple of seconds for the pin to get hot, and then touch the pin and the board with the solder wire. Let the solder flow into the hole around the pin. Then remove the solder wire and the soldering iron, and move to the next pin. + +Repeat that for each of the 16 pins. Done. + + +External Power Source +===================== + +If you want to power your servos from a different power source than the +microcontroller board, you need to remove the drop of solder from the jumper +next to the power connector, and solder the connector or wires for the power to +the two additional holes. The square hole is minus, the round one is plus. + + +.. image:: images/IMG_20170320_113010.jpg + :align: center + + +Address Selection Jumpers +========================= + +On the back of the board, there are six jumpers, labeled A0 to A5, which let +you change the default I²C address of the board. By default, they are all set +to 0, which sets the address to the value of 0x40. If you plan to stack several +of those boards together on the same microcontroller board, you need to change +their addresses, so that every one of them has a different one. There are 64 +possible combinations. + + +.. image:: images/IMG_20170320_113027.jpg + :align: center + + +.. warning:: + + Be careful to not connect a jumper both to the top and bottom pads, as that + will result in an electric short, a lot of smoke and possibly permanently + damaged shield, microcontroller board, battery or any other power source + used (including your computer, if you powered it from USB). + + It is recommended to check the connections with a multimeter before + applying power to the device. + + +.. image:: images/IMG_20170320_113203.jpg + :align: center
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/conf.py Fri Mar 24 13:16:47 2017 +0100 @@ -0,0 +1,289 @@ +# -*- coding: utf-8 -*- +# +# D1 Mini 16-channel Servo Shield documentation build configuration file, created by +# sphinx-quickstart on Tue Mar 21 09:14:04 2017. +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys +import os + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +#sys.path.insert(0, os.path.abspath('.')) + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +#needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'sphinx.ext.intersphinx', +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# source_suffix = ['.rst', '.md'] +source_suffix = '.rst' + +# The encoding of source files. +#source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'D1 Mini 16-channel Servo Shield' +copyright = u'2017, Radomir Dopieralski' +author = u'Radomir Dopieralski' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = u'1.0' +# The full version, including alpha/beta/rc tags. +release = u'1.0' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = ['_build'] + +# The reST default role (used for this markup: `text`) to use for all +# documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] + +# If true, keep warnings as "system message" paragraphs in the built documents. +#keep_warnings = False + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = False + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = 'alabaster' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +#html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +#html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# "<project> v<release> documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +#html_logo = None + +# The name of an image file (relative to this directory) to use as a favicon of +# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# Add any extra paths that contain custom files (such as robots.txt or +# .htaccess) here, relative to this directory. These files are copied +# directly to the root of the documentation. +#html_extra_path = [] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_domain_indices = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +#html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +#html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +#html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a <link> tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = None + +# Language to be used for generating the HTML full-text search index. +# Sphinx supports the following languages: +# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' +# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' +#html_search_language = 'en' + +# A dictionary with options for the search language support, empty by default. +# Now only 'ja' uses this config value +#html_search_options = {'type': 'default'} + +# The name of a javascript file (relative to the configuration directory) that +# implements a search results scorer. If empty, the default will be used. +#html_search_scorer = 'scorer.js' + +# Output file base name for HTML help builder. +htmlhelp_basename = 'D1Mini16-channelServoShielddoc' + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { +# The paper size ('letterpaper' or 'a4paper'). +#'papersize': 'letterpaper', + +# The font size ('10pt', '11pt' or '12pt'). +#'pointsize': '10pt', + +# Additional stuff for the LaTeX preamble. +#'preamble': '', + +# Latex figure (float) alignment +#'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, 'D1Mini16-channelServoShield.tex', u'D1 Mini 16-channel Servo Shield Documentation', + u'Radomir Dopieralski', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# If true, show page references after internal links. +#latex_show_pagerefs = False + +# If true, show URL addresses after external links. +#latex_show_urls = False + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_domain_indices = True + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, 'd1mini16-channelservoshield', u'D1 Mini 16-channel Servo Shield Documentation', + [author], 1) +] + +# If true, show URL addresses after external links. +#man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, 'D1Mini16-channelServoShield', u'D1 Mini 16-channel Servo Shield Documentation', + author, 'D1Mini16-channelServoShield', 'One line description of project.', + 'Miscellaneous'), +] + +# Documents to append as an appendix to all manuals. +#texinfo_appendices = [] + +# If false, no module index is generated. +#texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +#texinfo_show_urls = 'footnote' + +# If true, do not generate a @detailmenu in the "Top" node's menu. +#texinfo_no_detailmenu = False + + +# Example configuration for intersphinx: refer to the Python standard library. +intersphinx_mapping = {'https://docs.python.org/': None}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/connecting.rst Fri Mar 24 13:16:47 2017 +0100 @@ -0,0 +1,35 @@ +Connecting +********** + +To use the shield, simply plug it on top or bottom of the D1 Mini, making sure +that the notched corners of both boards align. + +.. note:: + + It is physically possible to plug the shield up-side-down, but it will not + work then. Fortunately, since the pins that provide power will then not be + connected to the shield, it shouldn't result in any kind of damage. + + +.. image:: images/IMG_20170320_111414.jpg + :align: center + + +Next, connect the servo plugs vertically into the servo sockets, paying +attention to the order of wires: the brown or black wire needs to go to the +bottom pin, and the white or yellow wire to the top. + + +.. image:: images/IMG_20170320_130558.jpg + :align: center + + +You can stack this shield with any other shields that either don't use the pins +D1 and D2, or use them for I²C and have a different address than set on this +shield. If you want to stack more than one servo shield on the same board, you +have to change their addresses with the jumpers on the back. + +.. note:: + + This means that you can't use it with the RGB and Relay shields, as they + use those pins for other purposes than I²C communication.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/index.rst Fri Mar 24 13:16:47 2017 +0100 @@ -0,0 +1,34 @@ +.. D1 Mini 16-channel Servo Shield documentation master file, created by + sphinx-quickstart on Tue Mar 21 09:14:04 2017. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +D1 Mini 16-channel Servo Shield Instruction Manual +================================================== + +This is an instruction manual for the 16-channel servo shield for the D1 Mini +series of microcontroller boards. This shield lets you control up to 16 hobby +servos, or anything else that takes a similar PWM signal. This board is +designed to plug on top or bottom of the small ESP8266-based microcontroller +boards produces by WeMos, such as D1 Mini, D1 Mini Pro and D1 Mini Lite. + + +Contents: + +.. toctree:: + :maxdepth: 2 + + overview + assembly + connecting + programming + power + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/make.bat Fri Mar 24 13:16:47 2017 +0100 @@ -0,0 +1,263 @@ +@ECHO OFF + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set BUILDDIR=_build +set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . +set I18NSPHINXOPTS=%SPHINXOPTS% . +if NOT "%PAPER%" == "" ( + set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% + set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% +) + +if "%1" == "" goto help + +if "%1" == "help" ( + :help + echo.Please use `make ^<target^>` where ^<target^> is one of + echo. html to make standalone HTML files + echo. dirhtml to make HTML files named index.html in directories + echo. singlehtml to make a single large HTML file + echo. pickle to make pickle files + echo. json to make JSON files + echo. htmlhelp to make HTML files and a HTML help project + echo. qthelp to make HTML files and a qthelp project + echo. devhelp to make HTML files and a Devhelp project + echo. epub to make an epub + echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter + echo. text to make text files + echo. man to make manual pages + echo. texinfo to make Texinfo files + echo. gettext to make PO message catalogs + echo. changes to make an overview over all changed/added/deprecated items + echo. xml to make Docutils-native XML files + echo. pseudoxml to make pseudoxml-XML files for display purposes + echo. linkcheck to check all external links for integrity + echo. doctest to run all doctests embedded in the documentation if enabled + echo. coverage to run coverage check of the documentation if enabled + goto end +) + +if "%1" == "clean" ( + for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i + del /q /s %BUILDDIR%\* + goto end +) + + +REM Check if sphinx-build is available and fallback to Python version if any +%SPHINXBUILD% 1>NUL 2>NUL +if errorlevel 9009 goto sphinx_python +goto sphinx_ok + +:sphinx_python + +set SPHINXBUILD=python -m sphinx.__init__ +%SPHINXBUILD% 2> nul +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +:sphinx_ok + + +if "%1" == "html" ( + %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/html. + goto end +) + +if "%1" == "dirhtml" ( + %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. + goto end +) + +if "%1" == "singlehtml" ( + %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. + goto end +) + +if "%1" == "pickle" ( + %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can process the pickle files. + goto end +) + +if "%1" == "json" ( + %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can process the JSON files. + goto end +) + +if "%1" == "htmlhelp" ( + %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can run HTML Help Workshop with the ^ +.hhp project file in %BUILDDIR%/htmlhelp. + goto end +) + +if "%1" == "qthelp" ( + %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can run "qcollectiongenerator" with the ^ +.qhcp project file in %BUILDDIR%/qthelp, like this: + echo.^> qcollectiongenerator %BUILDDIR%\qthelp\D1Mini16-channelServoShield.qhcp + echo.To view the help file: + echo.^> assistant -collectionFile %BUILDDIR%\qthelp\D1Mini16-channelServoShield.ghc + goto end +) + +if "%1" == "devhelp" ( + %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. + goto end +) + +if "%1" == "epub" ( + %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The epub file is in %BUILDDIR%/epub. + goto end +) + +if "%1" == "latex" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. + goto end +) + +if "%1" == "latexpdf" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex + cd %BUILDDIR%/latex + make all-pdf + cd %~dp0 + echo. + echo.Build finished; the PDF files are in %BUILDDIR%/latex. + goto end +) + +if "%1" == "latexpdfja" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex + cd %BUILDDIR%/latex + make all-pdf-ja + cd %~dp0 + echo. + echo.Build finished; the PDF files are in %BUILDDIR%/latex. + goto end +) + +if "%1" == "text" ( + %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The text files are in %BUILDDIR%/text. + goto end +) + +if "%1" == "man" ( + %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The manual pages are in %BUILDDIR%/man. + goto end +) + +if "%1" == "texinfo" ( + %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. + goto end +) + +if "%1" == "gettext" ( + %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The message catalogs are in %BUILDDIR%/locale. + goto end +) + +if "%1" == "changes" ( + %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes + if errorlevel 1 exit /b 1 + echo. + echo.The overview file is in %BUILDDIR%/changes. + goto end +) + +if "%1" == "linkcheck" ( + %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck + if errorlevel 1 exit /b 1 + echo. + echo.Link check complete; look for any errors in the above output ^ +or in %BUILDDIR%/linkcheck/output.txt. + goto end +) + +if "%1" == "doctest" ( + %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest + if errorlevel 1 exit /b 1 + echo. + echo.Testing of doctests in the sources finished, look at the ^ +results in %BUILDDIR%/doctest/output.txt. + goto end +) + +if "%1" == "coverage" ( + %SPHINXBUILD% -b coverage %ALLSPHINXOPTS% %BUILDDIR%/coverage + if errorlevel 1 exit /b 1 + echo. + echo.Testing of coverage in the sources finished, look at the ^ +results in %BUILDDIR%/coverage/python.txt. + goto end +) + +if "%1" == "xml" ( + %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The XML files are in %BUILDDIR%/xml. + goto end +) + +if "%1" == "pseudoxml" ( + %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml. + goto end +) + +:end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/overview.rst Fri Mar 24 13:16:47 2017 +0100 @@ -0,0 +1,26 @@ +Overview +******** + +.. image:: images/IMG_20170320_111414.jpg + :align: center + +This shield is a relatively simple breakout board for the PCA9685 chip. Apart +from that chip, it only contains the bare minimum of components necessary to +make it work, and all the necessary connections. The goal is to make it as +convenient as possible to connect hobby servos to the ESP8266. + +The board has the standard size and shape of D1 Mini shields, with the servo +sockets broken out as angled headers, protruding on the sides, so that the +boards can be easily stacked with each other or with other shields. Up to 64 +such shields can be used with a single microcontroller, provided that they have +different addresses set. + +The chip takes care of continuously generating the signal that is expected by +the hobby servos, freeing the microcontroller from this task. The +microcontroller only needs to get involved when you want to change the position +of any of the servos -- it sends a command then, and from that moment the +shield will generate the signal for the new position for that servo. + +This shield is 100% compatible with other servo controllers using PCA9685 chip, +and can be used as a drop-in replacement for them. All the available libraries +and examples should work exactly the same.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/power.rst Fri Mar 24 13:16:47 2017 +0100 @@ -0,0 +1,162 @@ +Power +***** + + +Servo Power Requirements +======================== + +Powering hobby servos is trickier than with most other electronic components +(except maybe for electric motors), mostly because the high power required. An +average hobby servo can easily draw more than 500mA of current at 5V -- which +is the limit that you can get with a USB connection. If you connect 16 such +servos to your computer's USB port, it will either shut down instantly or get +fried, depending on how good the protection circuits are in your computer. + + +.. warning:: + + If you try to power hobby servos from your computer's USB port, you risk + permanently damaging your computer. + + +This also makes the common alkaline batteries unsuitable: not only their +voltage will drop with such a high current draw, but they will also get +discharged and very quick and possibly damaged. + +You have several other options for powering your servos, but before you decide, +you need to check how much current they draw. You can either refer to the data +provided by the manufacturer (the maximum current draw is usually called "stall +current"), or you can use a multimeter to measure the it. In either case, you +have to add up all the power requirements of all your servos together, and look +for a solution that can provide that much power. + + +Effects of Inadequate Power +=========================== + + +As has been said already, in the extreme case, drawing too much current can +damage whatever source of power you are using. In less extreme cases it can +lead to it getting hot, and to voltage drops. Voltage drops will make your +microcontroller board work unreliably and possibly restart. They can also make +the servos behave pretty much randomly -- buzzing, moving to random positions, +or refusing to work at all. + +If you are experiencing problems with your project that magically go away when +you disconnect the servos, make sure your are powering everything properly. + + +Alkaline Batteries +================== + + +This type of batteries is usually completely inadequate for powering hobby +servos or other electric motors. With the high current draw necessary, their +voltage will drop a lot and they will get discharged and/or damaged very +quickly. Since they are not rechargeable, this is an expensive prospect. + +You can get away with powering a small hobby servo (like the 9g ones made of +transparent blue plastic) from alkaline batteries, but it's not the best way. + + +Nickel Batteries +================ + + +The NiCd, NiMH and NiMg batteries, commonly available as "rechargeable +batteries" for things such as digital cameras, are good for powering a couple +of servos. A single cell has the voltage of 1.2V, and servos typically accept +from 4.8V to 6V, so using four such cells directly powering the servos is +right. They are rechargeable, so even though the initial cost is higher, you +will save in the long run. + + +Lithium Batteries +================= + + +The LiPo batteries are commonly used in radio-controlled toys, and they can +provide very high current. They are also quite light compared to their +capacity, so they are perfect for anything that walks or flies. Unfortunately, +a single cell has voltage between 3.6V and 4.2V, which may be not enough for +powering the servos directly (though it may still work). The two-cell (also +called 2S) batteries have twice that voltage: between 7.2V and 8.4V -- which +usually is too much for the hobby servos. The solution is to use a buck +converter for the higher voltage, or a boost converter for the lower. See +below. + +Lithium batteries are a bit tricky in handling, and can be dangerous when +mishandled (remember the exploding cellphones?). They require a special +charger, and if you discharge them below 3.6V, you risk damaging them +permanently. They are definitely an advanced device. + + +Voltage Converters +================== + +If the battery pack that you are using doesn't have the correct voltage for +your servos, you can use a voltage converter. Those come in two kinds: buck +converters take higher voltage and drop it to the required output, and boost +converters take lower voltage and "boost" it to the set value. There are also +converters that have both a buck and a boost converter inside, and they can +deal with any input voltage (within their range, of course). They are commonly +called "BEC" or "UBEC" in the radio control hobby communities. + +Using a voltage converter is a good way to get exactly the voltage you need, +and to get the most out of the batteries -- it will give you the same voltage +no matter how discharged the battery is. Some even come with a battery +protection circuit, that shuts off the battery when it gets discharged too much +-- which is very handy for LiPo batteries. + +However, voltage converters also have their limits for the current they can +handle. When choosing a converter for your project, make sure that it can +handle the current that your servos are going to draw. (Of course, the battery +also has to be able to handle that.) + + +Power Banks +=========== + + +The portable battery packs commonly used to recharge USB devices such as +smartphones usually contain inside a LiPo battery, a boost converter and a +recharging circuit. They can often provide as much as 2A of current, which +should be enough for powering a couple of servos moving at once. They are also +relatively easy to handle, and the built-in protection makes them safer than +raw LiPo batteries. + + +Phone and Laptop Chargers +========================= + + +If your project is not mobile, it is convenient to simply power it from a wall +socket. You will need a power unit for that. + +The phone chargers are very easy to obtain, but you have to be careful to check +how much current they can provide. The cheap chargers often don't have any kind +of protection, and will simply melt or burn if you try to draw too much. The +better ones have a protection circuit that will shut them off. + +If you need more power, a laptop power unit, or a power unit from any other +appliance may be suitable, provided that they give the right voltage (between +4.8V and 6V) and enough current. Connecting a unit with higher voltage than +your servo (and microcontroller board) accepts will result in damaging them. +Even if the effect is not instant, powering them with too high voltage can +damage them over time, so make sure you get the right model. + + +Tips and Tricks +=============== + + +If you can, try not to move all the servos at once in your program, but instead +move a few at a time. This way you can lower the amount of current necessary +for them and avoid current spikes and voltage drops. In particular, at startup, +don't just switch all the servos on and move them to their home positions, but +instead switch them on one by one, with some delay between them. + +If you have some current spikes, but otherwise your current needs are lower, it +may help to add a large electrolytic capacitor across the servo power -- in the +range of 10-100µF. It will act as a buffer, providing extra current when there +is a spike, and will help avoid voltage drops.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/programming.rst Fri Mar 24 13:16:47 2017 +0100 @@ -0,0 +1,31 @@ +Programming +*********** + +Arduino +======= + +To use this shield with the Arduino environment, you can use any of the +libraries for PCA9685-based controllers, such as the `Adafruit PWM`_ library. + +.. _Adafruit PWM: https://github.com/adafruit/Adafruit-PWM-Servo-Driver-Library + +Refer to the examples and documentation provided with that library. + + +MicroPython +=========== + +If you are using the ESP8266 port of MicroPython, there is also a `MicroPython +library`_ you can use with this shield. + +.. _MicroPython library: https://github.com/adafruit/micropython-adafruit-pca9685 + + +Nodemcu +======= + +I don't know about any libraries available for Nodemcu for this chip at the +moment. However, you can use direct I²C communication to control it. Refer to +the datasheet_ for description of the commands available. + +.. _datasheet: https://cdn-shop.adafruit.com/datasheets/PCA9685.pdf
