How to use a Pro Micro as a cheap controller/converter

Wow! Nice write up! Thanks for sharing your experiments.
beltet
User avatar

Unread post24 Oct 2014, 23:46

User avatar
X
beltet
 
Posts: 836
Joined: 28 Jul 2013, 23:12
Location: Stockholm Sweden
Main keyboard: Custom NerD60
Main mouse: Saitek cyborg R.A.T 7
Favorite switch: Ergo MX Clear
DT Pro Member: -
 
Yes, very nice writeup. I have some bash and Python scripts that I use to program the Pro Micros. Here's the bash script, which I name something like burn.sh:

Code: Select all
#!/bin/bash
python reset.py /dev/ttyACM0
sleep 2
avrdude -patmega32u4 -cavr109 -P/dev/ttyACM0 -b57600 -D -Uflash:w:./Soarer_at2usb_v1.12_atmega32u4.hex:i

Here's the Python script which it invokes (reset.py):

Code: Select all
import serial, sys

serialPort = sys.argv[1]
print serialPort

ser = serial.Serial(
    port=serialPort,
    baudrate=1200,
    parity=serial.PARITY_NONE,
    stopbits=serial.STOPBITS_ONE,
    bytesize=serial.EIGHTBITS
)


ser.isOpen()
ser.close()             # close port

All you have to do is edit the bash script to reflect the hex file you wish to burn. It works every time without fail, and I so far haven't had occasion to go back and update the firmware.
quantalume

Unread post25 Oct 2014, 00:10

X
quantalume
 
Posts: 420
Joined: 12 Mar 2014, 19:14
Location: Houston, Texas
Main keyboard: IBM Bigfoot
Main mouse: CST trackball
Favorite switch: IBM Model F
DT Pro Member: -
 
Oh btw there is package called winAVR http://sourceforge.net/projects/winavr/ for windows and it incudes avrdude.

But when using pro micro you also need to install arduino IDE for leonardo drivers.


Then to othen point. Im gettin error when trying to flash avrdude: error: buffered memory access not supported. Matbe it isn't a butterfly/AVR109 but a AVR910 device?
macmakkara
User avatar

Unread post09 Nov 2014, 10:37

User avatar
X
macmakkara
 
Posts: 633
Joined: 18 Jun 2014, 22:19
Location: Finland
Main keyboard: HHKB
Main mouse: R. A. T. 9
DT Pro Member: -
 
Laser
User avatar
emacs -nw

Unread post09 Nov 2014, 11:19

User avatar
X
Laser
emacs -nw
 
Posts: 1343
Joined: 21 Oct 2013, 19:10
Location: Romania
Main keyboard: Plum TKL \w Topre domes (work) / Novatouch (home)
DT Pro Member: 0180
 
Oh didin't see that. Need to get new cable somewhere.
macmakkara
User avatar

Unread post09 Nov 2014, 11:28

User avatar
X
macmakkara
 
Posts: 633
Joined: 18 Jun 2014, 22:19
Location: Finland
Main keyboard: HHKB
Main mouse: R. A. T. 9
DT Pro Member: -
 
Maybe that's the problem I had with my FaceU which runs ps2avr and is not working properly with a cheap USB cable. Now it is working with a slightly more expensive cable. I don't know whether ps2avr and winAVR are related but it sounds like they are.
Nuum
User avatar

Unread post09 Nov 2014, 11:41

User avatar
X
Nuum
 
Posts: 1584
Joined: 16 Aug 2013, 22:38
Location: Stuttgart, Germany
Main keyboard: FaceU 60% (60g Clears), Phantom (Nixdorf Blacks)
Main mouse: Steelseries Kana V2/Logitech G9
Favorite switch: 60g MX Clears/Brown Alps/Buckling spring
DT Pro Member: 0084
 
 
Image
FaceU 60%

Too many switches, too little time (and money).

Nuum wrote:Maybe that's the problem I had with my FaceU which runs ps2avr and is not working properly with a cheap USB cable. Now it is working with a slightly more expensive cable. I don't know whether ps2avr and winAVR are related but it sounds like they are.

That's insane... I need to get some more mini USB cables! Maybe my face-u isn't dead after all! That'd be a bit of a pain after I went and bought a whole new PCB from matt3o. :lol:
scottc
User avatar

Unread post09 Nov 2014, 11:55

User avatar
X
scottc
 
Posts: 5581
Joined: 06 Oct 2013, 21:09
Location: Remote locations in Europe
Main keyboard: GH60-HASRO 62g Nixies, HHKB Pro1 HS, Novatouch
Main mouse: Steelseries Rival 300
Favorite switch: Nixdorf 'Soft Touch' MX Black
DT Pro Member: -
 
Yep and also there is some known problems with USB 3.0 and atmega32 without any solutions. If your using usb 3.0 test at usb 2.0 or with 2.0 usb hub. Didin't work for me.
macmakkara
User avatar

Unread post09 Nov 2014, 12:09

User avatar
X
macmakkara
 
Posts: 633
Joined: 18 Jun 2014, 22:19
Location: Finland
Main keyboard: HHKB
Main mouse: R. A. T. 9
DT Pro Member: -
 
I made a soarer's converter with a Pro micro last night and using a thin noodly micro usb cable caused the uC to brown out (voltage momentarily dropping low enough to reset the uC) when I connected the keyboard, and for some reason my Tipro still refuses to work with it, while the M works just fine!
chzel
User avatar

Unread post09 Nov 2014, 16:42

User avatar
X
chzel
 
Posts: 2388
Joined: 25 May 2014, 17:51
Location: Athens, Greece
Main keyboard: Phantom
Main mouse: Mionix Avior 7000
Favorite switch: Beamspring, BS, Vintage Blacks.
DT Pro Member: 0086
 
Got new cable today. Still no go... I think i need to install linux...
macmakkara
User avatar

Unread post12 Nov 2014, 16:01

User avatar
X
macmakkara
 
Posts: 633
Joined: 18 Jun 2014, 22:19
Location: Finland
Main keyboard: HHKB
Main mouse: R. A. T. 9
DT Pro Member: -
 
Sounds like someone who hasn't tried Linux! Good luck…
Muirium
User avatar
µ

Unread post12 Nov 2014, 16:03

User avatar
X
Muirium
µ
 
Posts: 22409
Joined: 03 Feb 2013, 10:11
Location: Edinburgh, Scotland
Main keyboard: IBM 4704 Kishsaver
Main mouse: Apple Magic Trackpad
Favorite switch: Gotta Try 'Em All
DT Pro Member: -
 
 
I have used linux daily when i did not game much. Actually i still have my arch install with xfce on my laptop but its really old and last update forked it. So it doesn't boot to xfce (can access console though). And i run Dedicated debian server. But im propably going to download debian and install it on my laptop.
macmakkara
User avatar

Unread post12 Nov 2014, 16:07

User avatar
X
macmakkara
 
Posts: 633
Joined: 18 Jun 2014, 22:19
Location: Finland
Main keyboard: HHKB
Main mouse: R. A. T. 9
DT Pro Member: -
 
Fair enough. I used to be much more into it before I tried it. Just haven't got the patience to manage a computer as closely as that. I'm not the right kind of mind for the terminal, apparently. Let alone programming… which always works so much better before I hit build! Anyway, enough grumbling. It's that trafficky time of day.
Muirium
User avatar
µ

Unread post12 Nov 2014, 16:12

User avatar
X
Muirium
µ
 
Posts: 22409
Joined: 03 Feb 2013, 10:11
Location: Edinburgh, Scotland
Main keyboard: IBM 4704 Kishsaver
Main mouse: Apple Magic Trackpad
Favorite switch: Gotta Try 'Em All
DT Pro Member: -
 
 
@Scott: What dd you do for earthing? I've got an AT I want to install one of these in as well. (My one and only Pro Micro has been sitting around waiting for a purpose while Teensies get all the fun.) But Model Fs are capsense and so pretty damn sensitive when it comes to earthing.

I'd like to know where to tap the earth connection to the Pro Micro. Or does it not matter so much once the case is done up?
Muirium
User avatar
µ

Unread post12 Feb 2015, 00:59

User avatar
X
Muirium
µ
 
Posts: 22409
Joined: 03 Feb 2013, 10:11
Location: Edinburgh, Scotland
Main keyboard: IBM 4704 Kishsaver
Main mouse: Apple Magic Trackpad
Favorite switch: Gotta Try 'Em All
DT Pro Member: -
 
 
I actually didn't do anything apart from wiring those four pins that I showed in the OP. I never actually mounted it in the case after all, I ended up taking it apart and using it for some other projects since I didn't need any Soarer converters at the time (which is no longer the case since I modded my AT's layout a week or two ago). It worked just fine for the time that I tested it like that on my AT, so I'd say you'd be alright!
scottc
User avatar

Unread post12 Feb 2015, 01:52

User avatar
X
scottc
 
Posts: 5581
Joined: 06 Oct 2013, 21:09
Location: Remote locations in Europe
Main keyboard: GH60-HASRO 62g Nixies, HHKB Pro1 HS, Novatouch
Main mouse: Steelseries Rival 300
Favorite switch: Nixdorf 'Soft Touch' MX Black
DT Pro Member: -
 
What I did on my M 122 was that I soldered it on top of the USB mini port on the teensy. I thought that it wouldn't be wise to combine GND and earth.

EDIT: I think it was like that... Not 100% sure... And I can't check either because the board ain't at home. I remembered it was quite a pain to get it onto it. But maybe I didn't have the right tools at the moment.
beltet
User avatar

Unread post14 Feb 2015, 01:01

User avatar
X
beltet
 
Posts: 836
Joined: 28 Jul 2013, 23:12
Location: Stockholm Sweden
Main keyboard: Custom NerD60
Main mouse: Saitek cyborg R.A.T 7
Favorite switch: Ergo MX Clear
DT Pro Member: -
 
Can't seem to get this to work. Im using a Pro Micro and have Data hooked up to PD1 and clock to PD0 and nothing happens when i hook up the converter exept it shows up in my hardwarelist as a keyboard.
I've added a 4K pull-up resistor to the data line from VCC and that made the keyboard light up when i hooked it up but its still not working. Do I need a pul-up resistor on the clock line aswell?

Ive changed the PS2_DATA_BIT to 1 and PS_CLOCK_BIT to 0 in the config on USART as the Pro Micro does not have PD5 (it does but thats one of the internal leds).
Yeitso

Unread post16 Mar 2015, 13:51

X
Yeitso
 
Posts: 3
Joined: 27 Jan 2015, 18:50
Main keyboard: Apple Desktop Bus Keyboard (1987)
Main mouse: Bloody TL-8
Favorite switch: MX-clear and ALPS Orange
DT Pro Member: -
 
What keyboard are you using with it? And are you sure you've got the polarity for VCC and GND right?

I had an embarassing mishap with those and this here AT recently. (I misread the AT port diagram, and had things horizontally flipped.) My Pro Micro survived, but all that would happen with the keyboard connected was some light in the lock LEDs.
Muirium
User avatar
µ

Unread post16 Mar 2015, 14:14

User avatar
X
Muirium
µ
 
Posts: 22409
Joined: 03 Feb 2013, 10:11
Location: Edinburgh, Scotland
Main keyboard: IBM 4704 Kishsaver
Main mouse: Apple Magic Trackpad
Favorite switch: Gotta Try 'Em All
DT Pro Member: -
 
 
I just changed to soarers converter without any soldering redone and it started working. So i guess somthing went wrong when i built the tmk firmware.
Yeitso

Unread post16 Mar 2015, 14:45

X
Yeitso
 
Posts: 3
Joined: 27 Jan 2015, 18:50
Main keyboard: Apple Desktop Bus Keyboard (1987)
Main mouse: Bloody TL-8
Favorite switch: MX-clear and ALPS Orange
DT Pro Member: -
 
Muirium wrote:What keyboard are you using with it? And are you sure you've got the polarity for VCC and GND right?

I had an embarassing mishap with those and this here AT recently. (I misread the AT port diagram, and had things horizontally flipped.) My Pro Micro survived, but all that would happen with the keyboard connected was some light in the lock LEDs.

Was it a momentary light on the lock LEDs, or did they remain turned on?
scottc
User avatar

Unread post16 Mar 2015, 14:47

User avatar
X
scottc
 
Posts: 5581
Joined: 06 Oct 2013, 21:09
Location: Remote locations in Europe
Main keyboard: GH60-HASRO 62g Nixies, HHKB Pro1 HS, Novatouch
Main mouse: Steelseries Rival 300
Favorite switch: Nixdorf 'Soft Touch' MX Black
DT Pro Member: -
 
It was the boot flash, but nothing more after that. might be somthing with my ISO layout?

I used the bundled spacefn layout when building the hex
Yeitso

Unread post16 Mar 2015, 14:53

X
Yeitso
 
Posts: 3
Joined: 27 Jan 2015, 18:50
Main keyboard: Apple Desktop Bus Keyboard (1987)
Main mouse: Bloody TL-8
Favorite switch: MX-clear and ALPS Orange
DT Pro Member: -
 
I've never used TMK on a Pro Micro so I can't be sure. Sorry about that.

I'm interested in what Mu encountered because I might've run into the same thing at one point without realising!
scottc
User avatar

Unread post16 Mar 2015, 15:07

User avatar
X
scottc
 
Posts: 5581
Joined: 06 Oct 2013, 21:09
Location: Remote locations in Europe
Main keyboard: GH60-HASRO 62g Nixies, HHKB Pro1 HS, Novatouch
Main mouse: Steelseries Rival 300
Favorite switch: Nixdorf 'Soft Touch' MX Black
DT Pro Member: -
 
If you need more than the 18 pins available, you can get two more by repurposing the onboard LED pins.

I just did an Atreus build with a Pro Micro clone and was exactly two pins short. I needed 15 pins for the matrix, 2 for the Trackpoint and 3 for indicator LEDs, totalling 20. So I desoldered the RX/TX LEDs and soldered wires to the end of the current limiting resistor connected to the controller.

There's also a reset button, so every pin except RAW on that little thing is connected to something.

resized-IMG_0399.jpg
jou
User avatar

Unread post16 Mar 2015, 21:41

User avatar
X
jou
 
Posts: 189
Joined: 15 Feb 2015, 22:30
Location: Switzerland
Main keyboard: Ergodox
Main mouse: Apple Magic Trackpad
Favorite switch: Not sure yet
DT Pro Member: -
 
scottc wrote:Was it a momentary light on the lock LEDs, or did they remain turned on?

Could have been a flash, or could have been constant dim lighting across all three LEDs. I had both of those with it, but I forget which way round. My next problem was the Pro Micro crapping out when I plugged too much other stuff into my USB hub. The keyboard was so picky! I cured that by swapping it out for a Teensy 2.

The Pro Micro's still loaded with Soarer's Converter though, so I'll just use it in something else. Has to be a smaller board than this one though. The big boys are always up on my standing desk with the hub.
Muirium
User avatar
µ

Unread post16 Mar 2015, 21:53

User avatar
X
Muirium
µ
 
Posts: 22409
Joined: 03 Feb 2013, 10:11
Location: Edinburgh, Scotland
Main keyboard: IBM 4704 Kishsaver
Main mouse: Apple Magic Trackpad
Favorite switch: Gotta Try 'Em All
DT Pro Member: -
 
I'm using TMK on a Pro Micro just fine. There are only a couple of things to remember:

- In the Makefiles, remember to always set:

Code: Select all
MCU = atmega32u4

Some have this set by default, but e.g. M0110 does not.

- In the Makefile, assuming you are using avrdude for programming as I am, also do:

Code: Select all
# Program Sparkfun Pro Micro using avrdude
PROGRAM_CMD = avrdude -p $(MCU) -P /dev/cu.usbmodem1421 -c avr109 -U flash:w:$(TARGET).hex

- I found a 10k pullup was necessary for older boards. Try with and without it.

- With the default bootloader, short RST to GND twice in succession. Then you have 8 seconds to flash!
XMIT
User avatar
[ XMIT ]

Unread post12 Apr 2015, 16:41

User avatar
X
XMIT
[ XMIT ]
 
Posts: 3405
Joined: 21 Dec 2014, 15:32
Location: Austin, TX area
Main keyboard: XMIT Hall Effect
Main mouse: CST L-Trac Trackball
Favorite switch: XMIT 60g Tactile Hall Effect
DT Pro Member: 0093
 
That tip for the Makefile is really nice. I hadn't thought of putting it in there at all. Of course, the device path might be different, though.

I haven't tried using a 10k pullup. I'll give it a go if I ever run into problems!
scottc
User avatar

Unread post12 Apr 2015, 17:04

User avatar
X
scottc
 
Posts: 5581
Joined: 06 Oct 2013, 21:09
Location: Remote locations in Europe
Main keyboard: GH60-HASRO 62g Nixies, HHKB Pro1 HS, Novatouch
Main mouse: Steelseries Rival 300
Favorite switch: Nixdorf 'Soft Touch' MX Black
DT Pro Member: -
 
I am having problems with avrdude:
avrdude: butterfly_recv(): programmer is not responding.

This error occurs when I try to run:
avrdude -p atmega32u4 -P YOUR_SERIAL_PORT -c avr109 -U flash:w:filename.hex
where I have replaced YOUR_SERIAL_PORT and filename.hex with proper ones.

Does someone know a solution for this?
santeri

Unread post18 Apr 2015, 15:41

X
santeri
 
Posts: 14
Joined: 18 Apr 2015, 15:32
DT Pro Member: -
 
Did you put your board into bootloader mode as mentioned in the OP?
scottc
User avatar

Unread post18 Apr 2015, 15:43

User avatar
X
scottc
 
Posts: 5581
Joined: 06 Oct 2013, 21:09
Location: Remote locations in Europe
Main keyboard: GH60-HASRO 62g Nixies, HHKB Pro1 HS, Novatouch
Main mouse: Steelseries Rival 300
Favorite switch: Nixdorf 'Soft Touch' MX Black
DT Pro Member: -
 
I think so yes. Does something flashy happen when I connect the GND and RST twice? In other words: How do I know if my pro micro is in boot mode?
santeri

Unread post18 Apr 2015, 15:49

X
santeri
 
Posts: 14
Joined: 18 Apr 2015, 15:32
DT Pro Member: -
 
Are you using Linux or Windows? In Linux, check the output of dmesg. You can use `watch "dmesg | tail"` or just run `while true; do clear; dmesg; sleep 5; done`. In Windows, you should see something like "Arduino Leonardo Bootloader" pop up in the device manager.

If you're using OS X, god only knows but it's possibly the same as Linux. I'm in an airport right now so I can't check since I don't have a boards with me.
scottc
User avatar

Unread post18 Apr 2015, 15:54

User avatar
X
scottc
 
Posts: 5581
Joined: 06 Oct 2013, 21:09
Location: Remote locations in Europe
Main keyboard: GH60-HASRO 62g Nixies, HHKB Pro1 HS, Novatouch
Main mouse: Steelseries Rival 300
Favorite switch: Nixdorf 'Soft Touch' MX Black
DT Pro Member: -
 
PreviousNext

Who is online

Users browsing this forum: Sangdrax and 34 guests