Skip to content

Commit

Permalink
deploy: 3fcaa79
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikUmble committed Nov 17, 2024
0 parents commit 5776fe7
Show file tree
Hide file tree
Showing 103 changed files with 7,643 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .buildinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file records the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 0d34b26585006095a78d690cb4db54a9
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file added .doctrees/bluetooth.doctree
Binary file not shown.
Binary file added .doctrees/environment.pickle
Binary file not shown.
Binary file added .doctrees/faq.doctree
Binary file not shown.
Binary file added .doctrees/index.doctree
Binary file not shown.
Binary file added .doctrees/movement.doctree
Binary file not shown.
Binary file added .doctrees/sensors.doctree
Binary file not shown.
Binary file added .doctrees/usage.doctree
Binary file not shown.
Empty file added .nojekyll
Empty file.
9 changes: 9 additions & 0 deletions _downloads/051422046cba6049b278a5cebcee1f0c/blink_LED.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from machine import Pin
import time

LED = Pin(6, Pin.OUT)

while True:
LED.off()
time.sleep(2)
LED.on()
Binary file not shown.
Binary file added _images/IR_assembled.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _images/bootload.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _images/lightblue_characteristic_view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _images/lightblue_connected_view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _images/lightblue_devices_view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _images/openmv_green.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _images/openmv_unconnected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _images/parts.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _images/rp2040_white_button.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _images/top_view.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _images/wheels.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 72 additions & 0 deletions _sources/bluetooth.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
.. _Bluetooth:

Bluetooth
=========
Using Bluetooth Low Energy (BLE) to communicate with the NanoNav.

Quick Example
-------------

.. code-block:: python
from nanonav import BLE
import time
# Create a Bluetooth object
ble = BLE(name="NanoNav")
ble.send(43)
response = ble.read()
# wait until something changes, indicating a response
while response == 43:
response = ble.read()
time.sleep(0.5)
print("Received: ", response)
Usage
-----

.. autoclass:: nanonav.BLE
:members:

.. note::
Just as a heads up, we've noticed that occasionally the value stored on the BLE characteristic gets corrupted. Wherever you call the `read` method, it's a good idea to verify that
the value is within the range you expect (and not ``None``), and if not, consider requesting the value again.

Connecting from Mobile
----------------------

Various mobile apps are available for communicating with Bluetooth Low Energy. We recommend LightBlue which is available for both iOS and Android.
After downloading and installing it, you will need to turn your phone's Bluetooth on and open the app (no pairing is needed for Bluetooth Low Energy).

If the NanoNav is waiting for a BLE connection, you will see it as one of the connection options in LightBlue. You may need to scroll down to find it.

.. note::
On some versions of iOS, the BLE devices are automatically renamed, and NanoNav's connection may show up as "Arduino" or something else. If you find yourself in this
situation, it can be helpful to search for the Arduino's MAC address instead, which means identifying the device once in LightBlue and keeping track of its MAC address for future connections.

.. image:: images/lightblue_devices_view.png
:width: 400
:alt: LightBlue Application with Bluetooth connections available

After clicking the connect button, you will see a screen like this, which gives information about the connection.

.. image:: images/lightblue_connected_view.png
:width: 400
:alt: LightBlue Application after connecting to device

It is possible to configure the BLE for more complex behavior, but with this kit we only need to send small numbers back and forth with the Arduino. Click on the
option at the bottom (highlighted in red in the above screenshot) to open the portal where you can perform this simplified communication with NanoNav.

.. image:: images/lightblue_characteristic_view.png
:width: 400
:alt: LightBlue display of BLE characteristic, with options to read or write values to it

You can think of a BLE connection as a secret whiteboard that you and your friend share. There is always some number written on it, and each of you
can look at (read) whatever is on it whenever you like, and can also change (write to) it whenever you like. Inside the LightBlue app, as shown in the
above picture, you can click the :blue:`Read Again` button as often as you would like, but the value will only
change when you (or NanoNav) writes to it. And you can send a number as often as you want in LightBlue, but NanoNav will not know unless you program it to
read the value periodically. (Actually, you can setup BLE interrupts for NanoNav to run code when something changes in the BLE connection, similar to the :py:meth:`~nanonav.BLE.on_connected` and :py:meth:`~nanonav.BLE.on_disconnected`, but we think
you'll have an easier time getting your code to work as expected by avoiding that kind of programming for now).
If interested in learning about other bluetooth capabilities beyond the scope of NanoNav, see `here <https://docs.micropython.org/en/latest/library/bluetooth.html>`_.
29 changes: 29 additions & 0 deletions _sources/faq.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FAQ
===

No questions yet.

Troubleshooting
===============

Arduino not connecting to OpenMV
--------------------------------

If your Arduino is not connecting to OpenMV, either because OpenMV is loading forever, or because the cursor is flickering between loading and a pointer, you should reset your board. Do this by double tapping the button on top of the Arduino. This will reset the board. Wait for OpenMV to update. When OpenMV updates, it should offer to load the latest firmware. Agree and load the firmware, and hopefully the Arduino will connect.

If this doesn't work, it's probably because your code has a frequently repeating while loop which keeps the Arduino occupied. Keep trying to reset the board by double pressing the top button, or open Finder or FileExplorer, open the board's external drive, and replace its main.py (your code) with a basic main.py such as :download:`blink_LED.py <../../tests/installation_check/blink_LED.py>`. This should enable the Arduino to connect.

If you still cannot get the Arduino to connect, it could be a problem on your computer. Try changing the port you're using to connect to the Arduino.

Strange problems with code which was just working
-------------------------------------------------

When you run in laptop mode from OpenMV, sometimes the code gives you errors the first 2 times you try to run. We're not sure why this happens, but these errors always go away after the third attempt.

If when running in solo mode, the Arduino behaves strangely when running code which you know works, it could be because you are out of storage. This will not happen until your code files are at least 30 KB in total!!! If your code files are not 30 KB or larger in total, what you're experiencing is an ordinary bug. If you suspect that you make be out of storage, try to shrink your code by removing comments and making functions more efficient. Every character counts, because it's the storage of your .py files which is running out. Try removing excess newlines or whitespace.

Issues
------

Found a bug? Create an issue on GitHub. Submit `here <https://github.com/Bram-Hub/NanoNav/issues>`_ with as much information as you can provide
about the context of the bug.
21 changes: 21 additions & 0 deletions _sources/index.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.. NanoNav documentation master file, created by
sphinx-quickstart on Mon Apr 15 12:52:38 2024.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to NanoNav's documentation.
===================================

Check out the :doc:`usage` section to get started.

Contents
--------

.. toctree::

usage
bluetooth
movement
sensors
faq

51 changes: 51 additions & 0 deletions _sources/movement.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
.. _Movement:

Movement
=========
Working with NanoNav's motors.

Introduction
------------

To complete the Wumpus challenge, NanoBot will have to navigate the board by moving and turning. It does this by sending power to the motors, which then turn the wheels. Speed of the motors is controlled by the amount of power you send. However, because most microcontrollers can only send LOW or HIGH voltage (0V or 3.3V in the Arduino's case), power is controlled by a process called Pulse Width Modulation (PWM), which is explained in more detail `here <https://learn.sparkfun.com/tutorials/pulse-width-modulation/all>`_ if you're interested.

Sensors called encoders are used to track the rotation of the motors accurately. Encoders track rotation in ticks. You can read more `here <https://howtomechatronics.com/tutorials/arduino/rotary-encoder-works-use-arduino/>`_ if you're interested, but all you have to know is that a positive change in ticks corresponds to a forward rotation of the motor, and a negative change to a backward rotation of the motor.

You don't have to use encoders in your solution, though they do provide greater accuracy.


Quick Example
-------------

.. code-block:: python
from nanonav import NanoBot
import time
# Create a NanoBot object
robot = NanoBot()
# Move forward for 2 seconds
robot.m1_forward(30)
robot.m2_forward(30)
time.sleep(2)
# Stop
robot.stop()
robot.sleep(2)
# Move backward for 2 seconds
robot.m1_backward(30)
robot.m2_backward(30)
time.sleep(2)
# Stop
robot.stop()
Usage
-----

.. autoclass:: nanonav.NanoBot
:members:
:exclude-members: ir_left, ir_right

44 changes: 44 additions & 0 deletions _sources/sensors.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
.. _Sensors:

Sensors
=======
Using the IR sensors on NanoNav.

Introduction
------------
To best interact with its environment, your NanoNav kit comes with infrared sensors that can be used for detecting how reflective the surface under it is.

Quick Example
-------------

.. code-block:: python
from nanonav import NanoBot
import time
# Create a NanoBot object
robot = NanoBot()
while True:
# Repeatedly print the IR sensor values
print(f'left: {robot.ir_left()} right: {robot.ir_right()}')
time.sleep(0.5)
Note that this code snippet uses `print` which means it will only
work while connected to a computer.

Calibration
-----------
Initially, and if you ever notice the IR sensors not detecting the white line correctly,
you may need to calibrate the sensors. The below video (for a very similar IR sensor model)
shows how to do this.

.. raw:: html

<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/fHBPYWRgEH8?si=n_tW8sT_w2ZMGEE9" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>

Usage
-----

.. automethod:: nanonav.NanoBot.ir_left
.. automethod:: nanonav.NanoBot.ir_right
Loading

0 comments on commit 5776fe7

Please sign in to comment.