You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+99-5Lines changed: 99 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
# Prototype with Orange using Live Objects
2
-
### Discover Orange [**Live Objects**](https://liveobjects.orange-business.com) using dedicated SDK for **Python and uPython compatible** boards and systems.
2
+
### Discover Orange [**Live Objects**](https://liveobjects.orange-business.com) using dedicated SDK for **Python 3 and uPython compatible** boards and systems.
3
3
4
4
This code wraps all the functions necessary to make your object work with Live Objects.
5
5
@@ -23,7 +23,7 @@ Code uses MQTT connection to exchange data with Live objects under the hood to k
@@ -236,12 +236,55 @@ You need to override specific methods - e.g. `connect` which is depended on type
236
236
All specific functions are placed in `services.py`.
237
237
If your board needs function supporting its equipment you need to put it in this file.
238
238
239
+
## VL6180X Sensor use-case ##
240
+
241
+
We can connect sensor using I<sup>2</sup>C to board supporting Python like **Raspberry Pi**.
242
+
243
+
The [VL6180X](https://www.st.com/en/imaging-and-photonics-solutions/vl6180x.html) is the latest product based on ST’s patented FlightSense™technology.
244
+
This is a ground-breaking technology allowing absolute distance to be measured independent of target reflectance.
245
+
Instead of estimating the distance by measuring the amount of light reflected back from the object (which is significantly influenced by color and surface),
246
+
the VL6180X precisely measures the time the light takes to travel to the nearest object and reflect back to the sensor (Time-of-Flight).
247
+
Description from st.com.
248
+
249
+
### Prerequisites ###
250
+
251
+
#### Enabling I<sup>2</sup>C ####
252
+
Enable (if needed) **I<sup>2</sup>C** interface on your Raspberry Pi using terminal and command:
253
+
```bash
254
+
sudo raspi-config
255
+
```
256
+
and selecting: **3 Interface Options** -> **P5 I2C** -> **\<Yes\>**
Example of development module using VL6180X you can find [here](https://kamami.pl/en/kamod-kamami-peripheral-modules/559362-kamodvl6180x-a-module-with-distance-gesture-and-als-sensor.html). Below diagram shows how to connect it to Raspberry Pi.
266
+
267
+

268
+
269
+
#### Adding VL6180X Python module ####
270
+
Necessary module by [Adafruit](https://learn.adafruit.com/adafruit-vl6180x-time-of-flight-micro-lidar-distance-sensor-breakout/python-circuitpython) can be installed using `pip`
2.[umqttsimple, umqttrobust and ssl](https://github.com/micropython/micropython-lib)
287
+
2.[umqttsimple, umqttrobust and ssl](https://github.com/micropython/micropython-lib) (for your convenience they are included in `micropython` folder)
245
288
3.[PuTTY](https://www.putty.org/) (for Windows)
246
289
247
290
### Installation steps ###
@@ -264,6 +307,7 @@ You can use one of example ones (`1_send_data.py`, ...) renaming it to `main.py`
264
307
> ampy -pCOMXX put main.py
265
308
```
266
309
310
+
267
311
4. Connect to device and check if it's working using PuTTY
268
312
269
313
Ctrl + D soft resets device
@@ -274,25 +318,75 @@ You can use one of example ones (`1_send_data.py`, ...) renaming it to `main.py`
274
318
275
319
After all steps content of the device should look like below:
276
320
```commandline
277
-
> ampy -pCOMXX ls
321
+
> ampy --port COMx ls
278
322
/LiveObjects
279
323
/boot.py
280
324
/main.py
281
325
/umqttrobust.py
282
326
/simple.py
283
327
284
-
> ampy -pCOMXX ls LiveObjects
328
+
> ampy --port COMx ls LiveObjects
285
329
/LiveObjects/Connection.py
286
330
/LiveObjects/__init__.py
287
331
/LiveObjects/hal.py
288
332
/LiveObjects/credentials.py
289
333
/LiveObjects/services.py
290
334
```
335
+
where COMx means port on your computer (e.g. COM8) with connected microPython board.
291
336
292
337
## Example for LoPy / GPy ##
293
338
294
339
You can do the steps as above but better is to use [Pymakr plug-in](https://pycom.io/products/supported-networks/pymakr/) for **Visual Studio Code** or **Atom** delivered by [Pycom](https://pycom.io/).
295
340
Plug-in supports code development, its upload to the board and communication with board.
296
341
342
+
## VL6180X Sensor use-case ##
343
+
344
+
Sensor described in this [section](#vl6180x-sensor-use-case) can be used on boards supporting microPython.
345
+
346
+
### Prerequisites ###
347
+
348
+
#### Wiring ####
349
+
You need to connect I<sup>2</sup>C interface (SCL & SDA) and power lines on the board with corresponding pins on the sensor.
350
+
You need to be aware that **boards can use different GPIOs for I<sup>2</sup>C** purposes. Set of typical pairs is placed
351
+
in function `get_i2c()` in file `hal.py`. If your board uses other GPIO pins, you need to add them to the tuple `typical_gpio`.
352
+
```Python
353
+
defget_i2c():
354
+
import machine
355
+
typical_gpio = ([22, 23], [5, 4], [22, 21])
356
+
...
357
+
```
358
+

359
+
360
+
Example of wiring ESP32 board with GPIO22 and GPIO21 (_source: https://randomnerdtutorials.com/esp32-pinout-reference-gpios/_)
361
+
362
+

363
+
364
+
#### How to use ####
365
+
1. You need to upload additional library for VL6180X support (it is placed in `micropython` folder):
366
+
```commandline
367
+
> ampy -pCOMXX put vl6180x_micro.py
368
+
```
369
+
2. Copy `7_distance_and_light_sensor.py` as `main.py` and upload it into board.
370
+
371
+
After above operations you can see:
372
+
```commandline
373
+
> ampy --port COMx ls
374
+
/LiveObjects
375
+
/boot.py
376
+
/main.py
377
+
/umqttrobust.py
378
+
/simple.py
379
+
/vl6180x_micro.py
380
+
381
+
> ampy --port COMx ls LiveObjects
382
+
/LiveObjects/Connection.py
383
+
/LiveObjects/__init__.py
384
+
/LiveObjects/hal.py
385
+
/LiveObjects/credentials.py
386
+
/LiveObjects/services.py
387
+
```
388
+
3. Connect to device and check if it's working using PuTTY.
389
+
390
+
297
391
## Troubleshooting ##
298
392
If you are getting 'MQTT exception: 5' check your api key
0 commit comments