This is the schematic (and a 1"x2.2" board concept, work in progress) that i came up with for the realtime filament diameter sensor we discussed last week ( https://plus.google.com/101189457349966331973/posts/i9SMKjWFZAh ). On the 123D Circuits site, you can switch between the schematic and layout with the icons top-right above the schematic area.
Here’s what in there:
Core components: An AtTiny85 and a SS495 or SS49E analog hall sensor
Connectivity to the main board either with the currently implemented analog voltage equal to the filament diameter, plus a “fault” pin when the sensed diameter is too large or too small. Or through I²C, as suggested by @Whosa_whatsis
A single tactile button to run through the calibration procedure (e.g. insert the ends of a few drill bits of different, known sizes)
A 5mm LED for feedback during the calibration procedure. Same pin is used as the fault output.
The analog voltage is generated with a biased lowpass, mapping the 8-bit PWM output to low-ripple (<100uV) voltages between ~1.45 and 2.15V for a theoretical resolution of roughly 3µm, better than what the controller’s ADC can sample.
0.1" headers spot, either for standard pin headers or 0.1" spring terminals (kf141r)
I used 123D circuits because it’s an extremely accessible and share-happy tool, even if it can be tedious to use and buggy, which is why the schematic can look weird at times. But it includes a super-simple way of ordering boards, while still letting you export your board files.
What’s your opinion on the limited output range? Are 2.15 to 1.45mm enough for what’s nominally 1.75mm filament?
Would you rather have a single configuration that handles 1.75mm and 3mm, at the expense of losing an enormous amount of resolution (0.02mm / 20µm at full range)?
Can you make it possible to switch between ranges appropriate for 1.75mm and 3mm filaments with a jumper somewhere? I think that would be the best way to handle the two filament sizes.
@Whosa_whatsis that would require at least an extra resistor (moot point) and a way to tell software which range it should now be using (extra button press during calibration?)
@Stephanie_A it would make things quite a bit simpler for the sensor, that’s for sure. But it does make the software side more complex…
Anybody up for implementing an I²C protocol into Marlin (and preferably other firmwares, too)?
@Carlos_Arroba we’ve already discussed the advantages and disadvantages of optical sensors in last week’s thread.
Anyways, the mechanical side will be based on a proven concept using near-zero-force rollers and a contactless hall sensor setup.
Right now, i just want to figure out the electronic and software side.
@Thomas_Sanladerer If you’ve got a pin available, you should be able to detect the presence/absence of the resistor, but on a tiny85 you’re probably running low. Have you already had to disable the reset pin to make it work?
@Whosa_whatsis good point. I am using all six IO pins, but could probably cheat a bit by cramming the hall sensor and button onto a single pin (and avoid having to HV program the AtTiny).
The idea with the added resistor was that it would change the bias of the voltage divider. But since we have a very slow low-pass in there as well, we could simply use the PWM_OUT pin (would have to swap what’s connected to PB1 and PB3 or PB4) as an ADC input and determine the bias at runtime.
@Colin_Faulkingham yes, the library is there, but does Marlin already fully support sensors through wire/I²C/TWI?
Are you letting the choice of microcontroller influence your design?
I thought we had agreed that two channels was a good idea over a single channel design. Following this methodology you would need two boards to implement a two channel solution.
Given that the cost of hardware is not just component cost but also assembly and test, packaging and shipping etc. It might be better to choose a more capable microcontroller and build in two channel support from the start. You can decide whether to provide dual analogue outputs or a single time I multiplexed one. It will simplify I2C wiring and reduce cost over two separate boards.
Over my many years of electronic design I have had managers impose their choice of technology onto projects purely for coolness, always-wanted-to-use-one-of-these or part cost going against sensible engineering decisions. Invariably they brought additional problems to the solution or did not realise the cost benefit they were supposed to.
In short… the simplest solution is not always the best.
The cost increase for a Tinyx4 instead of 85 would be negligible for the part, but might be visible in the board size and so forth. If you could get X and Y sensing onto one board that way, it would probably pay back.
So the question is, do we need the analog output in there at all? I’d be inclined to leave it in, as that’s the one way that is 100% implemented and working.
@Thomas_Sanladerer Keep it even if it is only for hanging a multimeter onto for test/standalone calibration purposes. Probably a good idea to make a test point available for probing.