Monday, October 31, 2022

Connecting the Raspberry Pi to the Robin Nano via GPIO pins

Since the Robin Nano board is mounted such that the USB port is only accessible outside the printer, I had to snake the USB cable out through one of the holes and around the printer to reach the port. For a clean installation, I need a way to let the Raspberry Pi connect to the nano using the GPIO pins.

USB port can only be reached from the outside

Currently, however, most of the easily accessible pins are already taken on my board as part of enabling SPI communication on the TMC2209 drivers.

Most easy to access pins are used
So I went hunting for pins that I could use and it turns out most of the pins on the TF connector can at least be used for SPI freeing up the pins on the WIFI connector that are most commonly used for RPI communication. So the plan now is to rewire the 5 SPI wires into a single 9-pin JST-XH connector and then use the WIFI pins for RPI.



Establishing Common Grounds

Before we can hookup I/O pins between separate devices, we need to ensure that they all have a common I/O ground. This is different from grounding the printer (which you should do as well). What I mean is that the negative terminal on the DC side of all the power supplies should be connected together. This ensures that the 24v line from the 24v PSU is actually 24 volts above any of the DC grounds and the 5v line from the 5v PSU is actually 5 volts above the same ground lines. When I had the USB cable connected, there was a ground wire that joined the PSU's together. Although, I could have added a ground wire as part of the wires connecting the RPI with the Robin Nano, its usually better practice to join the PSUs directly to minimize any current going over the ground GPIO pins.

In the end, I connected the GPIO pin14/15 (which are pins for a serial port) on the RPi4 to pins PA10/PA9 on the Robin Nano, respectively. Note that you must cross the wires so that the TX from one boards goes to the RX pin on the other board and vice versa. 

Klipper/RPi Configuration

Next, I had to build a new klipper firmware so that it would know to listen on the correct pins.
I ran through make menuconfig as per the klipper installation instructions being sure to use the same settings described in the top of my printer.cfg regarding booloader size, startup pins, etc. The difference this time, is I picked the serial connection to match the new pins we're using.




After this I: 
  1. saved the config
  2. ran "make" to build the image
  3. used the mks script to convert the image to one compatible with robin nano
  4. used Filezilla to get the file onto my computer
  5. copied image to sd card
  6. booted robin nano with sd card (the image file will get renamed with a *.CUR extension)
Next I had to configure printer.cfg to use the correct serial port. Klipper docs don't document this correctly. They assume you are using USB. Instead of using their command, use "ls /dev/serial*" but at this point the serial ports are not configured correctly. This doc proved helpful: https://docs.google.com/document/d/1kFasg5H_YDpIwc0PZpKph6RTX4BPROkNgTojQ0RWks8/edit

Basically, I first need to configure RPi to disable bluetooth, enable serial ports, disable shell on serial ports. This was done with a combination of editing /boot/config.txt and running raspi-config.
After all was set and done, I had 2 serial interfaces /dev/serial0 and /dev/serial1 with serial1 mapped to /dev/ttyS0 which is the one that corresponds to the GPIO pin 14/15.

Finally, in printer.cfg under the [mcu] section, I set the "serial" to "/dev/ttyS0". Restarted everything and then it all worked.
 

Wednesday, August 17, 2022

Crashplan Scripts on QNAP

 Looks like QNAP will delete/recreate many directories like /root when it reboots so you can't keep your crashplan scripts there. You can get around this by creating a shared directory. I made one called scripts which can be access by /share/scripts.

I put the update scripts there too so now I can ssh into the QNAP, cd to /share/scripts and run update_crashplan.sh.


Sunday, June 26, 2022

Refuting the Chinese Room Argument

This post assumes you already know about the Chinese Room Argument developed by John Searle.

Before I refute it, let's begin with a simple explanation of what the experiment entails:

  • A person who understands Chinese writes down a message using Chinese characters and places it into the mail slot of a room. The person cannot observe anything about the room's contents including what is going on inside of it.
  • Inside the room is John Searle, he has buckets of Chinese symbols and a book that describes for each combination of Chinese symbols, English instructions on how to arrange the Chinese symbols in the buckets onto a piece of paper which he send back out through the same mail slot. Searle, himself has no understanding of Chinese, he blindly follows the instruction in the book.
  • The person outside the room, reads the message from Searle and because it's content and the fact that it is written in Chinese is then convinced that there must be a person who understands Chinese in the room.
  • Because Searle never understands Chinese, he is only performing syntactic symbol manipulation. There is no semantics going on. Without semantics there can be no strong AI.
Let me now write the steps of the thought experiment down so it's clear before I make changes to them:
  1. Chinese speaker writes down message, places it in mail slot
  2. Searle looks at message, thumbs through book to find matching page
  3. Searle follows the instructions on the page to form a response
  4. Searle places the response back through the mail slot
  5. Chinese speaker reads Searle's message and concludes Searle understands Chinese
Now suppose we make a small alteration to the experiment, but in a way that you shall see is immaterial to the experiment itself.
  • Suppose that the room has a 2nd mail slot on the back wall that leads to a 2nd room. Just as the Chinese speaker cannot see into Searle's room, Searle cannot see into the 2nd room. Additionally, to the Chinese speaker, the original room and this room are identical (conceptually the original room is divided into 2 rooms internally).
  • The book that Searle uses is also different. It still contains all the same Chinese symbols except now, the place where there were English instructions is blank.
  • Searle however can now tear out that page from his book and place it into the 2nd mail slot and within a negligible amount of time, the page will be returned through the same slot with the previously missing English instructions. Assume these instructions match the instructions in the original experiment.
So now let's write these new steps down:
  1. Chinese speaker writes down message, places it in mail slot
  2. Searle looks at message, thumbs through book to find matching page
    1. Searle tears out the page and places it into 2nd mail slot
    2. The page is returned with the instructions on it
    3. Searle puts the page back into his book
  3. Searle follows the instructions on the page to form a response
  4. Searle places the response back through the mail slot
  5. Chinese speaker reads Searle's message and concludes Searle understands Chinese
As you can see, the additional steps we added are inconsequential to the experiment. Whether the page already had the instructions on it or whether Searle performs an extra step using purely syntactical operations to get that instruction, the result is the same. Searle still doesn't understand Chinese, so we must conclude there is no Chinese understanding going on and thus strong AI is false.

But wait! I haven't told you what was in the 2nd room

Inside the 2nd room was a person who understands both Chinese & English. He/she used their understanding of Chinese to formulate a response in Chinese, then used their understanding of English to create the necessary instructions for Searle to construct that response.

So what's the problem?

The Chinese room is an analog for a Turing Machine (aka digital computer). By having Searle in essence "be the computer", the idea is that if Searle never understands Chinese, then all computers for which he is an analog for would never understand Chinese either. The test requires that if Chinese understanding were to exist in the Chinese room, then it must be within Searle. Is that true though? Because, didn't we just show that understanding could definitively be in the Chinese room and entirely separate from Searle?

A test that fails to detect what it's meant to detect, shouldn't be used to infer anything.

Systems Reply?

Some may point to Searle's systems reply as a rebuttal. Namely that Searle could internalize the content of the book (with the instructions). However doing so results in the same conclusion that he made --> Searle doesn't understand Chinese and that's precisely the point. In this case, where we know Chinese understanding exists, we'd want Searle to then understand Chinese (not only that the same understanding of Chinese as the person in the 2nd room).

I don't believe the 2 experiments are truly identical, surely their difference is consequential

Okay, lets have the same person from the 2nd room go through the entire book filling out the instructions, then and only after doing all of them, he places the book in Searle's original room and leaves. The Chinese room starts off indistinguishably from the original. The room, book, people are all the same. The only difference being the author of the book. In the original it's a programmer, in the 2nd it's the person who understands Chinese and English.