Difference between revisions of "TinyPS2"
Jump to navigation
Jump to search
Blwikiadmin (talk | contribs) |
Blwikiadmin (talk | contribs) |
||
Line 60: | Line 60: | ||
[[file:ATtiny45-85.png]] | [[file:ATtiny45-85.png]] | ||
− | === TinyPS2V01 === | + | === TinyPS2V01 (Arduino UNO) === |
* [https://www.pjrc.com/teensy/td_libs_PS2Keyboard.html PJRC PS/2 library] | * [https://www.pjrc.com/teensy/td_libs_PS2Keyboard.html PJRC PS/2 library] | ||
Line 75: | Line 75: | ||
* [https://www.pjrc.com/teensy/td_libs_PS2Keyboard.html PJRC PS/2 library] | * [https://www.pjrc.com/teensy/td_libs_PS2Keyboard.html PJRC PS/2 library] | ||
* [https://docs.arduino.cc/learn/built-in-libraries/software-serial Software Serial library] | * [https://docs.arduino.cc/learn/built-in-libraries/software-serial Software Serial library] | ||
+ | * [https://github.com/land-boards/lb-Arduino-Code/tree/master/LBCards/TinyPS2/TinyPS2V02 Main sketch] | ||
+ | ** Didn't run when first tried | ||
+ | ** Maybe PS2Keyboard library does not work on ATTiny85? | ||
+ | *** Proper interrupt support for ATTiny85? | ||
+ | * Verified KBD data, clocks are reaching ATTiny85 | ||
* Code | * Code | ||
<pre> | <pre> | ||
Line 118: | Line 123: | ||
* Test routine | * Test routine | ||
− | * | + | ** Sends out A-Z in serial line at 9600 baud (~100uS bit time) |
* [https://docs.arduino.cc/learn/built-in-libraries/software-serial Software Serial library] | * [https://docs.arduino.cc/learn/built-in-libraries/software-serial Software Serial library] | ||
− | * | + | ** Verifies SoftwareSerial works |
+ | |||
+ | * Test with [https://github.com/land-boards/lb-Arduino-Code/tree/master/LBCards/TinyPS2/TinyPS2V04 TinyPS04 sketch] | ||
+ | ** 2 mS off/on on serial output pin verifies delay(2) | ||
+ | *** Caught missing bootloader (sets speed fuses) | ||
+ | |||
+ | === TinyPS04 === | ||
+ | |||
+ | * Test with [https://github.com/land-boards/lb-Arduino-Code/blob/master/LBCards/TinyPS2/TinyPS2V03/TinyPS2V03.ino TinyPS04 sketch] | ||
== Programming Card == | == Programming Card == |
Revision as of 15:14, 4 May 2022
Contents
Features
- PS/2 keyboard or mouse to TTL Level Serial converter
- ATTiny85
- 8 KB of flash
- 8-MHz internal RC oscillator that can be used as the default clock
- 512 bytes of EEPROM
- 512 bytes of SRAM
- 9600 baud
- 49x49mm ODAS form factor
- 4-40 mounting holes
- Current measurement
- 1 mA (without keyboard)
- 13 mA (including keyboard)
TinyPS2
Connectors
J1 - TTL Serial Connector
- 5V
- SERTX
- N/C
- GND
J2 - PS/2
- Standard PS/2 Mini-DIN-6 connector
H2 - In-System Programming Header
- SPI connector to download ATTiny85
- 2x3 header
- Program ATTiny85 without PS/2 keyboard attached
- Pinout
- KBCLK
- VCC
- SERTX
- KBDAT
- RST*
- GND
Firmware
TinyPS2V01 (Arduino UNO)
- PJRC PS/2 library
- Read PS/2 print to screen
- Resources (Arduino UNO)
Sketch uses 3334 bytes (10%) of program storage space. Maximum is 32256 bytes. Global variables use 377 bytes (18%) of dynamic memory, leaving 1671 bytes for local variables. Maximum is 2048 bytes.
TinyPS2V02
- Read PS/2 keyboard, write Serial (9600 baud)
- PJRC PS/2 library
- Software Serial library
- Main sketch
- Didn't run when first tried
- Maybe PS2Keyboard library does not work on ATTiny85?
- Proper interrupt support for ATTiny85?
- Verified KBD data, clocks are reaching ATTiny85
- Code
#include <SoftwareSerial.h> #include <PS2Keyboard.h> const int DataPin = 0; const int IRQpin = 1; #define rxPin 3 #define txPin 2 // Set up SoftwareSerial and PS/2 objects SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin); PS2Keyboard keyboard; void setup() { pinMode(rxPin, INPUT); pinMode(txPin, OUTPUT); mySerial.begin(9600); keyboard.begin(DataPin, IRQpin); } void loop() { if (keyboard.available()) { // read the next key char c = keyboard.read(); mySerial.write(c); } }
- Resources (ATTiny85)
Sketch uses 3126 bytes (38%) of program storage space. Maximum is 8192 bytes. Global variables use 241 bytes (47%) of dynamic memory, leaving 271 bytes for local variables. Maximum is 512 bytes.
TinyPS2V03
- Test routine
- Sends out A-Z in serial line at 9600 baud (~100uS bit time)
- Software Serial library
- Verifies SoftwareSerial works
- Test with TinyPS04 sketch
- 2 mS off/on on serial output pin verifies delay(2)
- Caught missing bootloader (sets speed fuses)
- 2 mS off/on on serial output pin verifies delay(2)
TinyPS04
- Test with TinyPS04 sketch
Programming Card
- Programming procedure is taken from here
- Add ATTiny Board support to Preferences, Path =
https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json
- Select ATTiny85, 8 Mhz
- Burn bootloader - Otherwise clock is way off
- ATProgHead
- Running Arduino as ISP
Other People's Videos
Schematic
Issues
- Missing pull-up resistors on PS/2
- Rev 2 - add pull-up resistors
- (There's pullups in the part so this may not be needed)
- Missing C3 cap in sequence
- Rev 2 - change C4 => C3