So, how do I enter data into my raspi. Well, I've done a single button keyboard before using V-USB, but it would be obnoxious to use only a few buttons for a whole keyboard. Wait! I already have an entire keyboard on my laptop. If only I could use it with my raspi. That is where this project comes in.
In this project I used a python script to detect key press on the laptop and then send them via serial to an ATTINY2313 with V-USB that converts the serial data into key presses on the raspi.
Hardware:
The hardware is pretty simple. It is just an ATTINY2313 running at 20MHz with connections to a USB to serial converter and hardware to interface to USB.
Software:
To detect key presses on my laptop I have a python script running. It uses the msvcrt library, which only works in windows. It also cannot detect the CTRL, ALT, SHIFT, or CAPS keys by themselves. Though if you press SHIFT and a letter it will read it as a capital letter. The same goes for CTRL, though some keys overlap with other buttons (i.e. CTRL-H returns 8 which is that same as Backspace). This data is then sent to the microcontroller with serial. The ATTINY then receives this data and sends the corresponding character using V-USB.
Download
Demo:
Well done for getting featured on Hack a Day, very impressive - I hope you carry on with this hobby electronics blog.
ReplyDeleteWhy not just use a terminal program, like PuTTY ?
ReplyDeleteI am hoping to be able to do that in the future, however I do not have a router and cannot connect the raspi to my school's internet (it requires that you login via a browser and run some security software). Hopefully I can just connect it directly to my computer and get it to work from there, but I have read quite a few threads with people having issues connecting directly to Windows 7, so I figured that this would do in the mean time. Plus, being able to configure both sides and see what is happening would be helpful (I'm a linux noob). Not to mention it was a fun challenge and may prove to be useful in other situations.
DeleteIt is not that hard, use a cross over cable to link it to your PC, or buy a cheap $10 switch from a computer store and plug your PC & RPi into it. If you want to take the easy route, just enable internet sharing in windows, which will start a DHCP server that the RPi will use. If you want to do it the (IMO) better way, configure your Ethernet devices with static IPs (say: 192.168.0.1 & 192.168.0.2) and then you can easily SSH into the device using a SSH tool such as PuTTY.
Deletehonestly, you can use the atiny as ttl/usb serial converter to connect to the serial terminal of the raspberry, where you can use a real full terminal.
ReplyDeleteYou can just ssh or vnc into the raspberry pi. Then you won't need an extra mouse/keyboard/display. Your laptop will do the trick. Check here - http://blog.darshshah.org/2013/01/ssh-into-your-new-raspberry-pi.html and http://blog.darshshah.org/2013/03/install-vnc-in-raspberry-pi.html
ReplyDelete