Overclock.net banner

141 - 158 of 158 Posts

·
Registered
Joined
·
562 Posts
I think that's the HID bootloader not atmel-dfu. i posted elsewhere and was pointed to ubaboot which is a similar size to halfkay.
 

·
Registered
Joined
·
562 Posts
I got the pcb flashed correctly with atmel-dfu thanks to the qmk discord guys. the mouse buttons register and i can install an optical sensor.
 

·
Registered
Joined
·
562 Posts
just got it running after hammering an allen key through the alps encoder. my firmware doesn't run for some reason but i made it backward compatible with bst_public. job for another day. it's lighter than my fk1+ now.
 

Attachments

·
Registered
Joined
·
562 Posts
I flashed an arduino sketch to test each button pin by flashing an led. it turns out all the f port pins on both pcbs are non functional, so that's why hardware debouncing is inoperative. I'm wondering if jlcpcb screwed up or edited the design without my knowledge, because the schematic looks perfect. I took my multimeter and there's continuity between all the f port pins, when they should be isolated from each other.

the schematic says portF is used for jtag. maybe the bootloader has activated it somehow.

edit: disabled jtag and all's good now. strange i've never seen the fix in the code before. I'll put it on the github in case anyone has the same problem.
 

·
Registered
Joined
·
562 Posts
I got a few requests for build instructions from reddit so here goes
This project was built in kicad nightly development edition on linux and files will not open on earlier versions. It's not necessary to install kicad to reproduce the project though, merely to modify it.

Grab the pcb files from here:
https://github.com/itsnoteasy/misc/blob/master/mouse8.zip

grab the firmware here:
https://github.com/itsnoteasy/forgotten_dreams/blob/master/bst_gplv3.zip

If you want to modify the files then you will need to use this python script which generates assembly files compatible with jlcpcb.

https://dubiouscreations.com/2019/10/21/using-kicad-with-jlcpcb-assembly-service/

So, go to this page https://jlcpcb.com/quote#/ and unzip your github file to a folder. then upload the nested gerbers.zip. I suggest using a lead free process and 1.0 mm pcb to reduce weight. Then click on smt assembly and set the quantity to 2, and click on assemble top side, then confirm.

next page upload the mouse8_bom_jlc.csv file and mouse8_cpl_jlc.csv file when asked to, then click next.
if it says confirmed on every component, then click next again, if not you'll have to follow the instructions in the dubiouscreations link and change out the missing part for an alternative.

now check the part rotations on the next page. I lined up the red dot on each symmetrical part with the left of the silkscreen part label. if the red dot is on the other side, you'll need to edit mouse8_cpl_jlc.csv in a text editor and subtract usually -90 from the problem part in a column on far right, then see what it looks like.
so if all is good, then save to cart to avail of any discounts, then order, choose the cheapest shipping too if you're not ridiculously wealthy. even on the cheapest postage packages arrive in 3 weeks to ireland. they're posted from germany which avoids customs charges.

parts you'll need
a hc-49U vertical 16.000mhz crystal or similar. you could save some money here by using an smt part but not a lot.
a jst ph 2.0 header. I bought a box of assorted types from aliexpress which was the cheapest for me. you can solder a cable directly if you want.
a g203/g102 replacement usb cable. this is pin compatible with the pcb.
3mm dim led, red colour ideally. using an ultrabright will exceed the pin current causing damage.
Button_Switch_SMD:SW_SPST_TL3342 you only need to use this once, so you can skip this and short the pads out with wire.
pmw3360 ic with lens(aliexpress). if you're handy you could pull one from another mouse, pmw3366 isn't compatible without rewriting the source code.
I like to use a selection of d2f-01f and d2fc-f7n for switches because they differ in height which can be useful when you need to adjust button actuation. sometimes i'll use shims underneath the switches or file down their bases.
a 7mm ec10 encoder of your choice. I have used cut down 11mm alps(abc legs folded over) but they don't match well to allen keys. I've had better results with ttc.
a shell and scroll wheel, also screws and mouse feet. avoid the wheels that are used in the hongsund io1.1, they lack the hole up the center and break the hex spline easily anyway. the shell is excellent though, durable, if heavier than the original.
1/16(ttc) or 5/64(alps) allen keys.
electric hand drill.
hacksaw.
sidecutters, metal files.

the crystal doesn't have a polarity, just solder it in. the silkscreen will prevent it from shorting out.
for the led, the negative, or cathode is the short leg. r7 is on the cathode leg. then solder it in.
jst pinout from right click button to left click button direction is shield(not connected), GND, VCC, D-, D+

I like to check the mcu is working before i solder in the 3360. so, to start with solder in the left and right click switches. then plug in the jst cable, assuming the jst socket is soldered in the correct orientation. then using a wire short the contact of the bootloader button twice to be sure with two seconds in between. Be sure to check the pmw3360 datasheet to discover the correct orientation. 3360 ic pin1 is on the right click button side of the pcb.

type in
dfu-programmer atmega32u4 erase --force [enter]

or if that doesn't work type in:
dfu-programmer atmega32u4 erase [enter]
dfu-programmer atmega32u4 flash bst3360.hex [enter]

then unplug and replug and you should have sensor response. Next use a metal file to mill out the base of the bottom cover to accept the lens. if you get fed up, at least get it level. then file the extrusion off the lens perimeter without damaging the lens. then drill a hole in the shell base so the lens can look through it. This allows the lift off distance to be reduced. ideal distance is 2.4mm to surface.

Disassembly of an io1.1 shell tends to break the side button hinges. to prevent this us a side cutters to cut a right angle from the forward vertical strut in the base immediately in front of where the hinge sits. cut in horizontally and cut down vertically on both sides to protect both buttons. this is the strut that breaks the hinges.

When drilling the mouse wheel for an allen key, mount the wheel in the drill chuck, and hold a drill bit in a hand pliers. in this way the drill bit self centers and will be in line. It's also helpful to hacksaw the allen key and wheel while it is rotating to ensure a square cut.

to enter bootloader mode, hold right click while plugging in the usb cable. there is a #define in main.c which changes the bootloader jump address, it is currently set for atmel-dfu.

If the primary switches bottom out you can remove any obstructing plastic with a sidecutters, and prop up the pcb to your liking by putting a ball of solder on the outer front switch pins.
 

·
Registered
Joined
·
41 Posts
Thanks so much for sharing this :)

I just looked at your schematic, and I am trying to understand it. But I am completely new to this, so my questions are incredibly amateur.

I've been trying to make a custom mouse too, based off the Teensy 2.0 + Tindie pmw3360 mod (just like BTS'). And when I look at the Teensy 2.0 + Tindie pmw3360 schematics vs yours, I don't understand why somethings are different.

For instance - why do you have x2 22pf capacitors connected to the 16mhz crystal? And why do you have 49.9Ω & 180Ω resistors attached to the 3360?

If I were to make a mouse PCB based off of the Teensy 2.0 & Tindie pwm3360 schematics, would that work? I understand that Teensy uses halfkay, but I assume I could use the atmel bootloader.

Thank you :)
 

·
Registered
Joined
·
562 Posts
the 22pf caps are load capacitors present on every microcontroller crystal. they're rf black magic that i don't understand. if you want to see a simple usb microcontroller device schematic there are lots of keyboards you can examine, such as the voyager series by ai03, plaid by hsgw etc.

the 49.9Ω & 180Ω resistors added together in parallel give 39.08 ohms, close to the 39ohms of the datasheet. it's often necessary to use multiple components to replace a rare or expensive part.

>If I were to make a mouse PCB based off of the Teensy 2.0 & Tindie pwm3360 schematics, would that work?
yes it would. my schematic is based off them, though the voltage regulator was switched out for a chinese domestic part. it's old now and might need to be updated to newer parts in stock.
I modded the code to support the atmel bootloader. I wouldn't advise you to make a mouse pcb if you merely want to do a mod, but you could make your own version of the tindie board with integrated mcu and jst plug. this would reduce weight, size and making wiring simpler while maintaining a good cost:return ratio.
 

·
lololol
Joined
·
4,371 Posts
the 49.9Ω & 180Ω resistors added together in parallel give 39.08 ohms, close to the 39ohms of the datasheet. it's often necessary to use multiple components to replace a rare or expensive part.
a 39ohm resistor is neither rare or expensive
but yea if you don't have it on hand, it's indeed annoying to order small quantities from digikey or wherever.


when i replaced 3360 with 3389 in my prototype m1k, i soldered in parallel 2 additional 39ohm resistors to make a 13ohm resistor
 

·
Registered
Joined
·
562 Posts
If you must know i did it because jlcpcb assembly had a reel change charge for extended components. i forget the exact cost but it was around 3 euro extra. the chinese voltage regulator was also an extended component last time i checked, which was after the plague.
 

·
Registered
Joined
·
41 Posts
Thanks for the replies :)

Regarding the crystal load capacitors - the 2 load capacitors values are 10pf on the Teensy; 20pf on the HSGW Plaid; & 22pf on your mouse. Did you have to make calculations to figure out the correct load capacitance (or am I overthinking)?

Also, what's happening on the left side of the atmega on your schematic, with all of those 4.7k resistors that are also connected to VCC then to the switches? Is that hardware switch debouncing?

Thank you!!
 

·
Registered
Joined
·
1,787 Posts
Discussion Starter #152
Thanks for the replies :)

Regarding the crystal load capacitors - the 2 load capacitors values are 10pf on the Teensy; 20pf on the HSGW Plaid; & 22pf on your mouse. Did you have to make calculations to figure out the correct load capacitance (or am I overthinking)?

Also, what's happening on the left side of the atmega on your schematic, with all of those 4.7k resistors that are also connected to VCC then to the switches? Is that hardware switch debouncing?

Thank you!!
The microcontroller should have a reference implementation in the datasheet or application notes, with the crystal and capacitor values specified.
 

·
Registered
Joined
·
562 Posts
I didn't make any calculations, I dropped out of school early so don't have a great grasp of circuit design. 22pf seems to be the more common value, perhaps the crystal package on the teensy changes the required load capacitance. some vusb keyboards use a 12mhz crystal so he may have used a different cap size for compatibility with the parts he had on hand.

>those 4.7k resistors
more or less yes. they're actually to increase wetting current to within the specs of the omron switch datasheet. it was an experiment to see if switch life could be extended. there's a conspiracy theory around that says the reason modern mice doubleclick so often is because they use lower switching voltage and less current to blow through the oxide on the switch contacts.
 

·
Registered
Joined
·
41 Posts
Thanks for the replies :)

So I have decided that I want to make your mouse & use the firmware!
I have noticed a few things after looking at your schematic.

Why did you connect the atmega AREF pin to VCC & not GND (like on Teensy 2.0)?
Why are there two resistors (20k & 33k) connected to the pmw3360 voltage regulator? Is it because you used a Chinese brand alternative? I actually have the same v.reg component used in the tindie 3360 module, so can I just connect it identically to the tindie schematic, or are the resistors & that particular v.reg important regarding your firmware?
If I were to only use just the left & right switches in my version (so no mouse-wheel, middle button, nor side buttons [don't ask why, lol]), would I have to adjust the resistor values or just leave them at 4.7k?

Sorry for so many questions. I just want to make sure I do nothing wrong. Thank you :)
 

·
Registered
Joined
·
562 Posts
> Why did you connect the atmega AREF pin to VCC & not GND (like on Teensy 2.0)?
looks like you found a mistake there.I'll have to correct it. it didn't stop it from working though as capacitors block dc.

>Why are there two resistors (20k & 33k)
the tindie pcb uses a fixed 1.9v regulator. the jlcpcb parts library had no such part available, only 1.8v fixed, so I chose to use an adjustable regulator instead, the two resistors set the voltage. the voltage calculation is given in the rt9179gb datasheet.
i wasn't sure whether to use high value resistors or low value, the datasheet didn't say. but it's stable at 1.93v so it turned out okay. there's also a good bit of spare current in the chip if the resistors draw too much. the 3360 chip runs from 1.8 to 2.1v so using a 1.8v reg could make it unstable if the voltage dipped a little.
if you are using the tindie regulator then use its circuit and vice versa. there are no firmware changes on different regulators.

>would I have to adjust the resistor values
no, wetting current is standardised across most switches. if you use less switches you'll need less resistors, one per pin.
 

·
Registered
Joined
·
2 Posts
Very interesting.

I am currently developing a universal input device firmware, for keyboards and mice, it's not quite ready but it is usable, my daily mouse is running on it. i will sooner or later design my own replacement boards for existing shells, but first the firmware needs to get to a mature state.
Just wanted to leave this here, so that maybe when any of you design new boards you might consider using my firmware.

https://github.com/openinput-fw/openinput

Regards.
 

·
Registered
Joined
·
562 Posts
there have been many requests for low latency stm32 firmware but nobody with the know how has stepped up as of yet. If you could get 8khz usb reports running I'd say you'll have a few builders.

I was playing around with qmk (qmk.fm/docs) and had keyboard/mouse firmware compiling for the 32u4, however i couldn't get any response from the cursor so I gave up. I used this firmware and changed the matrix scan for the direct pins method. https://gitlab.com/keyboards1/qmk_firmware/-/tree/master/keyboards/handwired/dactyl_manuform_r_track I don't have the code anymore but it wasn't a complex change.
 

·
Registered
Joined
·
2 Posts
i have yet to test performance, but it should not be a problem, i have the know how, i just don't have the time.

so far it is quite usable, i even game with it, but i am not picky, i'd game with a trackpad if i had to.
 
141 - 158 of 158 Posts
Top