-->
Page 1 of 6

Wireless ESP01s payload drop servo works reliably from lipo

PostPosted: Sat Sep 15, 2018 9:09 pm
by HermannSW
This is first video of work-in-progress lightweight servo bom drop mechanism. The ESP-01s running MicroPython, SG37 servo, 150mAh 25C lipo and 3.3V step-down converter as shown (14.6g sofar) will be attached to Eachine E52 drone (86.5g). The enabled WebREPL will be accessed from mobile Raspberry Pi ZeroW via webrepl_client.py providing remote Micropython shell on ground. "payload" module will have two functions, lock() and drop():
https://forum.micropython.org/viewtopic ... 180#p29865

I had to connect servo VCC to lipo VCC. While the 3.8V-4.2V from lipo are still outside of servo operating range 4.8V-6.0V, this setup works reliably. Because servo connector is connected to ESP-01s GND and GPIO-0 pins, GPIO-0 is low on power on. I had to solder small switch connecting GPIO-0 and VCC to avoid running ESP-01s into flash mode. For details see attached 8MP photo of the scene.


Re: Wireless ESP01s payload drop servo works reliably from l

PostPosted: Thu Sep 20, 2018 9:17 pm
by HermannSW
Instead of Fritzing I used my own tool GraphvizFiddle based on Graphviz for creating the schematic. Graphviz does the layout automatically, I only specified the components (clusters), pins (nodes) and connections (edges). You can edit the schematic via this (1926 bytes long) URL that was created using GraphvizFiddle's Share button.
Image


P.S:
This is the Graphviz .dot file encoded in the URL:
Code: Select all// ESP-01s servo payload drop mechanism
//
graph {
  size="8,5"
  rankdir=LR
  graph [ranksep=1.5]
  edge [ penwidth=3]
  node [shape=box]
  subgraph cluster_vr {
    label = "3.3V step-down"
    node [shape=none]
    Vi
    GNDv [label="GND"]
    Vo
  }
  subgraph cluster_servo {
    label = "SG37 servo"
    node [shape=none]
    GNDs [label="GND"]
    VCCs [label="VCC"]
    PWM
  }
  subgraph cluster_jst {
    label = "JST connector"
    node [shape=point label=""]
    GNDj
    VCCj
  }
  subgraph cluster_lipo {
    label = "1S lipo"
    node [shape=none]
    GNDl [label="GND"]
    VCCl [label="VCC"]
  }
  subgraph cluster_esp01s {
    label = "ESP-01s"
    node [shape=none]
    GNDe [label="GND"]
    GPIO0
    VCCe [label=VCC]
    button [shape=ellipse]
    edge [color="#ff0000"]
    VCCe -- RESET -- CH_PD
  }
  {
    edge [color="#ff0000"]
    Vo -- VCCe -- button
    VCCl -- VCCj -- Vi -- VCCs
  }
  button -- GPIO0 [color="#0000ff"]
  GNDv -- GNDe -- GNDs
  GNDe -- GNDj -- GNDl
  PWM -- GPIO0 [color="#ffff00"]
}

Re: Wireless ESP01s payload drop servo works reliably from l

PostPosted: Wed Sep 26, 2018 9:30 am
by HermannSW
This 2549 byte long URL makes use of Graphviz record structures to represent the location of the pins on the different objects. The initial automatic layout was fine, but I made some are edges end at a specific node port (n,ne,e,se,s,sw,w,nw) to make it nicer. Advantage of using records is that now node names can all be VCC for the different objects, since the prefixed record name makes them distinct (edge "esp01:GND:sw -- servo:GND:w" connects GND of esp01 and servo, starting at esp01 southwest port and ending on servo west port):
Image

Re: Wireless ESP01s payload drop servo works reliably from l

PostPosted: Wed Sep 26, 2018 1:53 pm
by HermannSW
Before completing the hardware side with the wire that will trigger the payload drop, here the Micropython payload module software side. The servo has superglued tiny plastic cubes D, R and P. The O cube will be superglued to drop payload. I had to remove the original wooden cubes with holes with the plastic cubes in order to reduce friction of the moving wire:
Image


I did play with payload module while I developed it. Before last change I left webrepl_client.py wireless session to the ESP-01s for copying the modified module (I had to turn off PWM for the following file copy to succeed, by "payload.pwm0.duty(0)" command before leaving).

This is the last version of the module:
Code: Select all$ cat payload.py
import machine

pwm0 =  machine.PWM(machine.Pin(0), freq=50)

def lock():
    pwm0.duty(50)


def drop():
    pwm0.duty(100)


drop()
$



Now copy new version to ESP-01s module:
Code: Select all$ ./webrepl_cli.py payload.py 192.168.4.1:
Password:
op:put, host:192.168.4.1, port:8266, passwd:abcd.
payload.py -> /payload.py
Remote WebREPL version: (1, 9, 4)
Sent 134 of 134 bytes
$



Since the "payload" module was imported already in previous session, it had to reloaded. Reloading a module is no standard MicroPython functionality for now. I had added reload() to ESP module boot.py, used the function from this posting:
https://forum.micropython.org/viewtopic.php?f=2&t=413&sid=eb3d9fae5b4c51c661ec513e2983c6c8&start=30#p7609


Finally I tried the new module:
Code: Select all$ ./webrepl_client.py 192.168.4.1
Password:

WebREPL connected
>>> reload(payload)
<module 'payload'>
>>>



The final payload.drop() got executed, and now te O cube can be inserted between R and P cube, followed by payload.lock().