I don't see a bypass capacitor for the ATTINY85. You need one per chip.
I bought some Digisparks (the fig2 kind) 8-10 years ago, but the PDFs you linked to contain really useful information that I hadn’t seen before. Thanks so much for that.
Once I’ve got the basic sensor setup working then I’ll share the larger sketch that converts these values into a speedometer, which is what the Nano sketch did.
why do you want to go to an Attiny85, a Nano has basically the same footprint as a Nano, so could fit behind it or a Pro Mini, its 328 core?
Size. The whole circuit, including the 4-digit segment displays, is mounted to a 5x7cm prototype board. The attiny85 fits perfectly and provides exactly the number of pins I need.
I don't see a bypass capacitor for the ATTINY85. You need one per chip.
Thanks. The caps on the power rail are mounted directly under the ATTINY85, but I can definitely add another bypass closer to the max7219 as well.
Please, let me know the types of your input sensors and the nature of theiri output signals.
Yes, the aim is that each bypass cap is closer to it's chip than any other component, to prevent each chip from causing interference on the power lines which might affect other chips.
These were shared in the original post.
In both cases, the PCBs the sensors are mounted on add almost no value. You could buy the components themselves and attach them directly to your prototype board, saving space and money.
The reed switch board appears to include a pull-up/pulldown resistor, so it's output should not be floating at any time. It will, being mechanical, bounce, so software or hardware debouncing is required. But you could simply buy a reed switch and connect it between the ATTINY pin and ground.
The hall effect sensor is presumably an analog sensor. The board also contains a comparator which turns the analog output into a digital one, with adjustable trigger threshold. It probably does not need debouncing. @Grrrmachine are you using the analog output or the digital output?
Digital hall effect sensors are available, potentially making the comparator chip unnecessary when connected directly to your prototype board. But then I don't know how adjusting the trigger threshold could be achieved.
If OP is using a fresh ATtiny85, then PPin-1 is a RESET/-pin and it should be tied to Vcc.
Fuse bits values for a fresh ATtiny85:
EF = 0xFF //self-programmiing is inhibited
HF = 0xDF //EF7 = 1 makes PPin-1 to work as RESET/-pin
LF = 0x62 //internal 8 MHz and is divide by 8
Not directly. Use a 10K pull-up. Otherwise the Nano being used as the ISP would not be able to reset the ATTINY to commence programming, and could even be damaged.
@Grrrmachine
If using Digispark Clone Board for developing your project, I see the following setup is a feasible one. (You need an exact copy of ATtiny85 of the original Digispark Board, which is to be placed in the empty socket of the following Clone Board.)
Thanks for the input again.
I’ll temporarily add a 10k resistor to PB5>5V to stabilise it all, but the long term goal was to use PB5 as an GPIO pin with a button that would switch the display between the two sensors (PB3 and PB4). I haven’t implemented that yet since I was struggling to get reliable signals through those input pins.
I used off-the-shelf PCBs for those sensors to reduce the chance of a fault in the sensors while I was prototyping. I want to use Hall sensors in the long term because there’s less mechanical interference compared to the reed switches, but I’m not committed 100% to either solution, nor to analog vs digital input signals yet.
My primary consideration is the robustness of the design. The end goal is a portable unit that attaches to a bicycle, so stability and ruggedness are my primary metrics. Once this prototype works, I’ll move to live testing and reiterate the design from there.
To use PB5 as a digital IO line, you have to change Fuse Bits accordingly. Once, you convert the RESET/-pin into an IO line, you will not be able to program it using Arduino as ISP Programmer. You have to use Parallel Programmer to restore RESET/-pin.
yes, and then I can’t upload new sketches using ISP either…
Right! So, do it at the last when you will not upload anymore sketch.
If you find that you are running shortage of pins, you can use TM1637, which requires only two wires instead of three needed for MAX7219. Leave the RESET/-pin of the ATtiny85 as it is.
Are you acquiring analog or digtal signal from Hall-effect sensor?
I can use both: this board has both digital and analog outputs, probably based on the design @PaulRB described.
Here’s a video of that Hall Sensor working in analog mode with your code @GolamMostafa , so you can see that it works!
Exellent!
Which code of mine -- is it from the pdf I have provided?
sorry, I got my wires crossed again
@xfpd provided stable code that was good enough for me to troubleshoot my circuit, which showed me where the fault was.
Somehow I missed what that fault was and how you fixed it!
My board was built correctly. Original versions of my code worked correctly. But the wiring between the board and the sensors had some sort of fault that caused the sensor pin to float.
However, whenever I tested the wiring with a multimeter it worked, so I started playing with my code to find the solution there. It wasn’t until @xfpd provided me with another sketch, which resulted in exactly the same problems as I was originally having, that I realised it must be a wiring instead of a coding issue.
I rebuilt the cable that connects the prototype board to the sensor inputs (JST-XT connectors), and it all works perfectly with the test sketch. This gives me a stable base to return to the code I wrote for the Nano, to see how far I can extend these functionalities within the limitations of the attiny85.



