Skip to main content

Arm driver

The arm driver handles the door opening, the drawer opening and the arm movement for the webcam in the caravan. It communicates with a nodemcu ESP8266 controller (https://www.amazon.co.uk/AZDelivery-NodeMcu-ESP8266-Development-including/dp/B074Q2WM1Y/)

The controller code can be found in the https://github.com/tlodge/fmundane-arduino repo in the arm directory. The controller handles the door and drawer opening (it does not communicate with the arm, which is done directly by the arm driver.

It listens for (GET) requests to the following:

/drawer/open

/drawer/close

/door/open

/door/close

/status

Note that the controller reads from the rear and front drawer switches and the door switch to determine the current state of the system.

Wiring

Two wires connect the nodeMCU controller to the Arduino GRBL NANO controller (https://www.amazon.co.uk/dp/B078S8BJ8T) on the stepper and servo control board (https://www.aliexpress.com/item/1005002035301194.html). The serial out pin is connected to the serial IN of the GRBL NANO control board. The nodeMCU then just sends serial GRBL commands to control the stepper. The second wire is between the nodeMCU ground and the GRBL NANO ground. The rest of the wires going to the controller are just from the switches.

The node (server) endpoints

endpointmethoddescriptionparams
/api/arm/expandGETRun through the full routine to end with the camera extended at the end of the arm (i.e. open door, open drawer, expand arm)
/api/arm/collapseGETRun through the full routine to end with the camera back in the box (collapse arrm, close drawer, close door)
/api/arm/scanGETOnce expanded, look left and right as though scanning faces.
/api/arm/lightsGETTurn the servo lights a particular colour.colour: an integer from 0-7:0=Off; 1=Red; 2=Green; 3=Blue; 4=Yellow; 5=Cyan; 6=Magenta; 7=White
/api/arm/flashGETFlash the servo lights various colours
  • colours : an array of colours e.g. [1,2] to flash red and green
  • speed : the time is ms between colour change
  • repetitions : the number of repetitions (i.e. how many times the lights flash)
/api/arm/yesGETNod the camera as though saying yes
/api/arm/noGETNod the camera as though saying no
/api/arm/homeGETMove the camera into the position it is first in when expanded.
/api/arm/pointGETPoint at various things in the caravansubject:
  • dyson: point at the dyson fan
  • windows: point left and right at the windows
  • door: point at the caravan door
  • screen: point (backwards) at the screen
  • down: look down
  • forward: reach forward
  • mad: spin and generally behave erratically
/api/arm/statusGETReturn status information on the drawer and the door.
/api/arm/toggledoorGETOpen / close the door