

Tinyterm wrong server update#
Update this post is also available in Japanese. Stdin is not redirected, so it takes input from the original terminal device, eventually mapping back to my keyboard. Putting it all together we have the tinyterm command, which runs its arguments as a subprocess, sending the child’s stdout and stderr to the LCD. The lcdWriter‘s Write method has a little bit of smarts to deal with making the LCD look like a 16 x 4 terminal, rather than a linear stream of characters, handles scrolling the screen, and obscures the odd addressing scheme of the video memory inside the HD44780. Using an lcdWriter type (more on that in the next slide), Tinyterm spawns a child process and redirects Stdout and Stderr to the LCD. So, could I connect a UNIX process’s output to the LCD screen transparently ?Įnter Tinyterm, a simple Go program that does just that.
Tinyterm wrong server code#
I adapted some Python code to work with my Go I2C type which gave me a set of LCD primitives to work with. To interface between the HD44780 I’m using a cheap PCF8574 I 2C IO expander which takes any byte received over I 2C and maps it directly to its output pins. The LCD I was using is based on the Hitachi HD44780 standard which has a baroque protocol using many pins and is completely incompatible with I 2C. Driving an I 2C device from userspace in Go is pretty straight forward open the device, then use an ioctl to tell the kernel to bind the file descriptor to a remote I 2C device. Now the hardware was done, it was time to write some code. The next step was to connect up a real I 2C device to the bus and see if I could detect it with i2cdetect.Īlthough both the LCD and the laptop are 5 volt devices I wasn’t sure how much current the laptop could source on pin 9, so I opted to buffer the devices using a Freetronics level shifter which effectively isolates the laptop from the high current LED backlight on the LCD panel. I 2C adapter talking to an I 2C IO expander Importantly, I 2C is also used as the protocol to detect an external monitor, where it goes under the name DDC2b. If you’ve used the lmsensors package in Linux, or have heard of SMBus, this is basically a variant of I 2C.
Tinyterm wrong server serial#
It’s has been used inside every PC and laptop for decades as a slow speed serial protocol for interfacing with simple devices like temperature sensors.

I 2C isn’t just used on microcontrollers like the Arduino. If you’re patient you can bit bang the protocol using a few resistors and tack switches. The I 2C bus is a low speed two wire serial bus mainly used for connecting sensors and microcontrollers together.īut, you don’t even need a microcontroller to use I 2C. The first piece of the puzzle is the I 2C bus. There are several parts to this presentation. It was inspired by a recent post on Hack-a-Day. This talk is about a experiment to see if I could drive I 2C devices from Go through my laptop’s VGA port. You can find the original slides online at. This post is about Tinyterm, a silly hack that I presented as a lightning talk at last month’s Sydney Go User group 1.
