Skip to content

joezappie/hip-simulator

Repository files navigation

hip-simulator

Watch the video

Setup Instructions

  1. In Micro Basic Motion Studio set the following settings:

    Roboclaw 1:

    Control Mode: Packet Serial
    Packet Serial Address: 128
    Baudrate: 230400
    

    Roboclaw 2:

    Control Mode: Packet Serial
    Packet Serial Address: 129
    Baudrate: 230400
    
  2. Connect you your raspberry PI via SSH over Putty.

  3. Install NodeJS:

    curl -sL https://deb.nodesource.com/setup_12.x | sudo bash -
    sudo apt install nodejs
    
  4. Run the following commands:

    sudo apt-get update
    sudo apt-get install git
    
  5. Checkout the hip simulator repository:

    git clone https://github.com/jrj2211/hip-simulator
    
  6. Install pigio:

    sudo apt-get install pigpio
    
  7. Enable I2C in the interface section of raspi config:

    sudo raspi-config
    
  8. Enable Serial UART Hardware

    sudo raspi-config
    > 3. Interface Options
    > P6. Serial Port
    Would you like a login shell accessible over serial: 
    > No
    Would you like the Serial port hardware to be enabled: 
    > Yes
    
  9. Change to the hip simulator directory:

    cd hip-simulator
    
  10. Run the command to install node dependencies:

npm install
  1. Compile the frontend GUI code:

    sudo npm run dist
    
  2. Start the node server:

    sudo npm start
    
  3. In your web browser, go to your raspberry pi’s IP address. The interface should come up.

Service

To make the system start on boot, create a service file:

sudo nano /etc/systemd/system/hipsimulator.service

Paste the following:

[Unit]
Description=Hip simulator controller
After=network.target

[Service]
Type=simple
WorkingDirectory=/home/pi/hip-simulator
ExecStart=/usr/bin/node /home/pi/hip-simulator/server.js

Environment=NODE_ENV=production
Restart=on-failure

[Install]
WantedBy=multi-user.target

Enable the service and start it

sudo systemctl enable hipsimulator
sudo systemctl start hipsimulator

Updating

To update the code, run the following git command:

cd  ~/hip-simulator
git pull origin main
npm run dist
sudo systemctl restart hipsimulator

Calibration

  • Rotaty Encoders

    To calibrate the rotary encoders, go to the web GUI. The values for each encoder is updated in real time so you can rotate them until they all read 0% at your home position.

    You also need to calibrate the max value of the encoder:

    1. Set the max in the config to 1
    2. Spin the encoder to the largest value you can get
    3. Copy that number as the max in the config
  • Load Cell

    To calibrate the load cell:

    1. Remove all weight from the load cell

    2. Copy the value from the GUI into loadcell.offset in the config.yaml

    3. Place a known amount of weight on the load cell

    4. Copy the value from the GUI

    5. Using that value calculate the scale to convert to pounds

      1 / (value / weight) = scale

    6. Choose number of decimal places to show in config.yaml

Wiring Documentation

image

  1. Roboclaw Wiring

In packet serial mode up to eight Roboclaw units can be controlled from a single serial port. The wiring diagram below illustrates how this is done. Each Roboclaw must have multi-unit mode enabled and have a unique packet serial address set. This can be configured using Motion Studio. Wire the S1 and S2 pins directly to the MCU TX and RX pins. Install a pull-up resistor (R1) on the MCU RX pin. A 1K to 4.7K resistor value is recommended. For model specific pinout information please refer to the data sheet for the model being used.

image

image

image

  1. ADS115 Wiring

image

  1. HX711 Wiring

image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages