Giter VIP home page Giter VIP logo

neato-serial's Introduction

Neato-serial

Serial interface for Neato robot vacuum cleaners. Transforms your non-connected Neato into a connected one. Tested on XV Signature Pro and Raspberry Pi, should work on others. Demo video. Uses hub-ctrl.c.

Hardware required

  • Raspberry Pi (2, 3 and Zero tested and confirmed working) or any other device that runs Python and has some sort of GPIO and USB connectivity.
  • A mini usb cable to connect your Raspberry Pi to Neato
  • A micro usb cable to power your Raspberry Pi
  • A 5V step-down voltage regulator. I used one from Pololu but any should do. Make sure it can handle at least 16V as that is what Neato will be providing to power your Raspberry Pi from.
  • A 5V relay (optional). I used a Grove Relay from Seeed but any 5v relay should do. The package also allows for direct USB connection, without a relay.

Setup

  • Connect to your step-down voltage regulator to Neato's 16V connection. See image below to find the right connector on the Neato motherboard: direct
  • Connect the output of the step-down voltage regulator (that should be 5V) to your Raspberry Pi's USB connector for power. Do not use the GPIO to power the Raspberry Pi directly.
  • Connect a mini usb cable from the Raspberry Pi to Neato.
  • If using a relay:
    • connect it to the 5V, GND and GPIO 2 of your Raspberry Pi. If you use another GPIO make sure to reflect that in the configuration file (see below)
    • cut open the mini usb cable that you used to connect the Raspberry Pi to Neato, reconnect all wires except the red one (power). Run the red wire through the relay. See image below.

Setup - 2021 update (Internal housing) - RobertD502

Hardware Used:

  1. Raspberry Pi ZeroW (Will sit on top of Neato motherboard in the upper left hand corner)
  2. 5V step-down voltage regulator - if using this exact voltage-regulator, I recommend removing the pot (little wheel in the upper right-hand corner) before soldering the 5V pad on the back as there have been reports of voltage variation when it is kept. The pot can be removed by applying heat to the side of it at the top with a soldering iron.
  3. 5V Relay
  4. Kapton Tape to prevent any shorts
  5. 3-Wire JST Connector (optional) - I wired a JST connector to the Neato MiniUSB side and another to the Raspberry Pi MicroUSB port to allow me to disconnect the Pi if needed in the future. This is completely optional and a personal preference.
  6. Ferule + Ferule Crimping tool (optional) - It is good practice to add ferules to wires which will be held in place by screw terminals instead of leaving exposed bare wires.

Wiring

  • Remove the two wires from the Neato's 16V connector and solder an additional wire to each of the pins. Place the wires back into the connector (See image below). direct
  • Voltage-Regulator Wiring:
    • If using the voltage-regulator mentioned above, be sure to remove the pot and solder the 5V pads on the back of voltage-regulator.
    • Solder the live wire (red wire) from Neato's 16V connector (previous step) to the port labeled IN+ on the voltage-regulator.
    • Solder the ground wire (black wire) from Neato's 16V connector to the port labeled GND on the voltage-regulator.
  • Power to the Raspberry Pi ZeroW:
    • Solder an additional wire to the port labeled GND on the voltage-regulator and the other end to the test point labeled PP6 on the underside of the Raspberry Pi ZeroW (see image below).
    • Solder a wire to the port labeled VO+ on the voltage-regulator and the other end to the test point labeled PP1 on the underside of the Raspberry Pi ZeroW (see image below).
    • The port labeled EN on the voltage-regulator will not be used
    • direct
  • Wiring Raspberry Pi ZeroW to Relay
    • You can either use dupont connectors to connect the Pi to the relay or solder wires to the pins on the underside of the Pi.
    • Connect your relay to the 5V, GND and GPIO 2 of your Raspberry Pi. If you use another GPIO make sure to reflect that in the configuration file (see Configuration Section). If using a relay with screw-terminals, I recommend using ferules on the ends of the wires going into the relay screw terminals. Also, be sure to use enough wire length to allow the wires to reach from the upper-left side of the motherboard where the Pi will sit to a hole near the left wheel where the relay will sit (See image below).
    • Solder another wire (preferably red) to the test point labeled PP1 on the underside of the Raspberry Pi ZeroW and place the other end into the COM port of the relay.
    • We will come back to the relay in the next steps.
    • direct
  • Wiring Pi ZeroW MicroUSB port to Neato's MiniUSB port:
    • Warning: When soldering to the pads on Neato's motherboard, DO NOT use high heat as these pads are weak and will pull off of the motherboard if not handled with care. Also, add some hot glue to the top of the wires/connections (once all 3 soldered connections are made) to help alleviate wire strain and prevent the pads from getting pulled up.
    • If you are using JST connectors that I mentioned in the hardware section, choose either a male or female connector for the Raspberry Pi side and the opposite for Neato side ( Female connector on Pi & Male connector on Neato side or Male connector on Pi & Female connector on Neato side).
    • If using JST connectors:
      • Solder the green wire (D+) of your JST connector to the small round pad above the component labeled D13 (see image below)
      • Solder the white wire (D-) of your JST connector to the small round pad above the component labeled D13 and to the left of the previously soldered green wire (see image below)
      • Solder the red wire (VCC) of your JST connector to the right-side of the resistor labeled R90 (see image below)
      • Be sure to add hot glue to the connections at the Neato's motherboard to alleviate wire strain and prevent pads from lifting
      • With a new JST connector, solder the green wire (D+) to the test point labeled PP22 on the underside of the Raspberry Pi ZeroW (image of test points located above)
      • Solder the white wire (D-) to the test point labeled PP23 on the underside of the Raspberry Pi ZeroW (image of test points located above)
      • Solder the red wire (VCC) to a separate wire (be sure to add heat shrink tubing over the connection point of the two wires)- the other end of this wire goes into the relay port labeled NO
    • If not using JST connectors:
      • Solder a wire (preferably green) to the small round pad above the component labeled D13 (pad labeled as D+ in image below). Solder the other side of the wire to the test point labeled PP22 on the underside of the Raspberry Pi ZeroW (image of test points located above)
      • Solder a wire (preferably white) to the small round pad above the component labeled D13 (pad labeled as D- in image below). Solder the other side of the wire to the test point labeled PP23 on the underside of the Raspberry Pi ZeroW (image of test points located above)
      • Solder a wire (preferably red) to the right-side of the resistor labeled R90 (labeled as VCC in image below). Insert the other end of this wire into the relay port labeled NO
      • Be sure to add hot glue to the connections at the Neato's motherboard to alleviate wire strain and prevent pads from lifting
    • direct
  • Wrapping up:
    • Cover the underside of the Raspberry Pi ZeroW and the entire voltage-regulator with Kapton tape to prevent any shorts from occuring.
    • direct direct

Installation

  • install the requirements using provided requirements.txt: pip install -r requirements.txt
  • install python-systemd by running sudo apt-get install python3-systemd
  • create config.yaml by copying the config.yaml.example provided and setting the correct values. See below for settings.

Configuration

Configuration values:

  • serial:
    • serial_device: the device Neato is connected to. Multiple devices can be provided here, since after the USB connected has been temporarily switched off the device name might change. Example value: /dev/ttyACM0,/dev/ttyACM1

    • timeout_seconds: timeout in seconds to use for the serial connection. Example value: 0.1

    • usb_switch_mode: specifies if you connected Neato directly through a USB cable or through a relay.

      Options: direct or relay:

      • direct. Tested on Raspberry Pi 2 and 3. Does not work on Raspberry Pi zero since usb port cannot be turned off - use relay instead. Connect your Pi and Neato directly using an USB cable: direct

        This option does require elevated permissions (sudo) for the script since it needs to disable the usb port and (depending on config) reboot the Pi.

      • relay. Switches the USB connection using a relay. Tested to work on Raspberry Pi zero and others. This is the only method that works on Raspberry Pi zero. Be sure to also specify the GPIO the relay is connected to with relay_gpio. Connect a 5V relay to your Raspberry Pi. Cut your USB wire and re-connect all the cables except the red one. Wire the red cable through the relay (one side into Common and the other into NO if you have three connectors on your relay). I used a Grove Relay from Seeed but any relay should do. direct

      Example value: direct

    • relay_gpio: specifies the GPIO the relay is connected to when using usb_switch_mode: relay.

    • reboot_after_usb_switch: specifies to reboot after usb has been switched off. Usefull if your Raspberry Pi does not reconnect after the USB has been disabled and enabled. Use with caution and only when running this script as a service. Example value: True

  • mqtt:
    • host: MQTT host
    • username: MQTT username
    • password: MQTT password
    • port: MQTT port. Example value: 1883
    • discovery_topic: auto-discovery topic. Example value: hass Uncomment this and add your Home Assistant auto-discovery topic if you intend to have Home Assistant add the vacuum automatically. If you intend to manually (legacy method) set the vacuum up in Home Assistant leave this commented out - See sample configuration under Usage section if using legacy method.
    • command_topic: MQTT topic for receiving commands. Example value: vacuum/command
    • state_topic: MQTT topic for publishing state. Example value: vacuum/state
    • publish_wait_seconds: Delay in seconds before updating state again. Example value: 5

Usage

Two modes are available (start either using python3 xx.py).

  • interactive console mode: neatoserial.py
  • mqtt mode: neatoserialmqtt.py, for integration in MQTT scenario. Built for integration with Home Assistant via MQTT Vacuum component but should be usable elsewhere as well. Run this script as a service using systemctl to get the integration working (see provided neatoserialmqtt.service file).
  • Sample configuration for Home Assistant:
    • If you defined a discovery-topic in the configuration file, you do not need to do this.
vacuum:
  - platform: mqtt
    name: "Neato"
    supported_features:
      - turn_on
      - turn_off
      - send_command
      - battery
      - status
      - locate
    command_topic: "vacuum/command"
    battery_level_topic: "vacuum/state"
    battery_level_template: "{{value_json.battery_level}}"
    charging_topic: "vacuum/state"
    charging_template: "{{value_json.charging}}"
    cleaning_topic: "vacuum/state"
    cleaning_template: "{{value_json.cleaning}}"
    docked_topic: "vacuum/state"
    docked_template: "{{value_json.docked}}"
    send_command_topic: "vacuum/command"
    payload_turn_on: "Clean"
    payload_turn_off: "Clean Stop"
    payload_locate: "PlaySound 19"
    fan_speed_topic: "vacuum/state"
    fan_speed_template: "{{value_json.fan_speed}}"

Commands

See the Neato programmers manual for available commands. It seems that some commands are not listed in the manual:

- `Clean Stop` stops the vacuum.
- `Clean Spot` tells the vacuum to do a spot clean

neato-serial's People

Contributors

jeroenterheerdt avatar robertd502 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

neato-serial's Issues

Great project! Just some suggestions for newbies like me.

Great project!
I can give my XV-21 a new life when the LCD is dead a couple of months ago, and stops all of sudden during cleanings after battery replacement. Neato-serial is one of my best findings in 2018!

Yesterday, I fresh installed raspbian stretch on a rPi0w, and git cloned neato-serial. It took some time for me to finally make it work. It would be smoother for others, with not much of linux and python knowledge, including myself.

  1. Python version and required packages
  • Stetch default is python 2.7, but neato-serial runs on python 3. (Currently 3.5)
  • So, python 3 including pip3 should be installed for "pip3 install -r requirements.txt"
  • Documentation may need to change to install packages at least "git, python3-pip, python-systems"
  1. Code
  • Yaml didn't like \t in the file. So, it might be better just use " "(space) in "config.yaml.example".
  • It took me so long to find this out in "neatoserialmqtt.service" it may need to include this
    "User=pi" to make it as serviced right after boot.
  1. Link(s) or other source(s) that newbies can utilize to run as systemd service.

Again, I like this project so much and I'm happy with this for sure!
Just a little suggestion for others' possible time saving.

Happy new year, 2019!

MQTT messages sometimes not delivered after Home Assistant reboots

I started to notice that MQTT messages will sometimes fail to be delivered to Home Assistant if HA is rebooted. This doesn't always occur and I haven't been able to pin down the exact conditions since sometimes MQTT messages from the Neato are still being delivered after a HA reboot and at other times they are not. I tailed the log for the neatoserialmqtt.service and notice that it reports that it is continuing to send messages although the MQTT broker isn't receiving them. Whenever this happens, I manually connect to my broker and can see that the "vacuum/state" topic is not present. The only way to get MQTT messages to properly arrive to the broker and be seen by HA again is to restart the neatoserialmqtt service at which point the "vacuum/state" topic reappears and everything is functioning again. I'm not sure if this problem is specifically due to the broker on HA, but I did notice that the only MQTT device experiencing this problem is the Neato.

In case anyone else runs in to this problem, what I have done is:

  1. Generated a ssh key in HA and placed the files in /config/ssh.
  2. I then added the contents of the generated id_rsa.pub file on HA to the authorized_keys file on the pi running the neatoserialmqtt service.
  3. In HA, I created a shell command which restarts the neatoserialmqtt service when it is called:
    restart_bedroom_neato_mqtt_service: ssh -i /config/ssh/id_rsa -o StrictHostKeyChecking=no [email protected] -t 'sudo systemctl restart neatoserialmqtt.service'
  4. I then created an automation that runs the shell command if the vacuum's attribute "status" is "Unknown" for 30 seconds.

Mounting Options

First of all thank you for creating this. I was able to utilize this to get my old Neato XV Signature Pro integrated into Home Assistant instead of having to go out and buy another Neato Botvac D5.

This post isn't about an issue per se- I was just curious as to how you went about mounting all of the devices to your neato. I noticed that if any of the devices (pi, relay, voltage regulator) are anywhere in the view of the LiDAR, the neato just goes in circles and fails to clean. So, I just wanted to see what kind of mounting you/anyone else has come up with to get around this. Mounting on top of the LiDAR within a box is an option, but that may be problematic as it will get knocked as the neato tries to go under tight spaces.

Thanks again for all the great work!

Video

Hey, I thought the video might be useful, but doesn't seem to be on one drive. Do you have a mirror?

Alternatively, if you just have some pictures of the connection, would help me out!

Cheers

Thoughts on using other USB host

Hi,
thanks for creating this great repo!
I've followed your instructions and put a pi zero w into my XV Signature Pro and it works, but seems to have some issues with connecting and re-connecting the USB port. So I wanted to put some more work into this.

My main thought was, that putting a Pi Zero into the robot is a bit overkill and maybe not the most reliable solution?
My idea was to use the USB host mode of a Pi Pico W. This should be able to connect the robots USB port and switch the power if needed.
The functionality can still be exposed easily via MQTT.

What do you think of this plan? Do you see any problems with it?

Legacy or State config with Home Assistant?

I have this somewhat working with in Home Assistant. I am using mqtt and I can see it running on the Pi 3 and I can see the charge status and dock status in HA however, it does not respond to any commands I give it thru HA. Should I be using the legacy or state vacuum mqtt config in HA? Neither seem to work. I can't get the mqtt service to run on the Pi either but that is a separate issue.

Pi zero cant connect

So ill be honest I have no idea when it comes to linux and these pi's but the end goal is to get my neato working with HA. I believe I have everything installed but here is the error I get when i try and run the neatoserial.py .
pi@raspberrypi:~/neato-serial $ sudo python3 neatoserial.py Traceback (most recent call last): File "neatoserial.py", line 2, in <module> from config import settings File "/home/pi/neato-serial/config.py", line 2, in <module> import yaml ImportError: No module named 'yaml' pi@raspberrypi:~/neato-serial $ python3 neatoserial.py Could not connect to device /dev/ttyACM0. Trying next device. Could not connect to device /dev/ttyACM0. Trying next device. Could not connect to device /dev/ttyACM1. Trying next device. Could not connect to device /dev/ttyACM1. Trying next device. Enter commands. Enter 'exit' to quit ?

Serial connection is extremely slow

Hi,

Since my neato recently started acting up, I decided to play around with it and stumbled across your repository. thanks for your work!

From what I see right now, with my current configuration sending commands in real time from a raspberry pi is just not possible - it takes something in the order of 2 s to issue any command. Now, communication via the serial port is slow, but.. this slow? I don't get it. This is the part of the code where you configure the serial device:

            self.ser = serial.Serial(self.device, 115200,
                                     serial.EIGHTBITS, serial.PARITY_NONE,
                                     serial.STOPBITS_ONE,
                                     timeout)

how did you come up with that baudrate/bytesize? Do you know of any way to make it faster (10x would start to be ok)?
greetings from the NL!

How to connect Raspi to BotVac physically?

I have a BotVac 85 on which I want to integrate my pi zero W (permanently) and experiment with this mod.
The problem is I can’t seem to find/successfully make a usb connector that will fit under the dust bin.

I’ve spotted a couple of non-raspi mods that utilize the serial solder tabs on the main board as in the image link below. However, I’m too much of a n00b to figure out if it would work if I soldered the leads of a cut Micro-USB otg cable directly on there, and too scared I might fry the board if it doesn’t.

Does anybody know of a solution to this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.