wokwi-features
wokwi-features copied to clipboard
Resistor divider simulation
Resistor dividers are useful for connecting multiple buttons to a single analog input pin, as described here. This is particularly useful for MCUs with limited number of IO pins, such as the ATtiny85.
Currently, Wokwi includes a very basic analog simulation: You can connect a single part (e.g. a potentiometer or an analog temperature sensor) to one or more analog input pins. However, if you add any resistors to your analog circuit, the simulator will ignore them.
Let's simulate them!
Great idea. I agree. I am not great on GiHub, but is there a formal way to vote?
Thank you! The way the vote is on the features page, using VotePowers. You can vote for any feature as many times as you want. I'm still working on a more detailed FAQ that explains how this works, but here is a quick explainer.
This would be great.
In the interim would it be possible to make the potentiometer have hot keys for values so we can simulate the same thing? At the moment Home = 0, End = 1023. It would be great to add other keys and mappings for that device, eg 1 = 100, 2 = 200 etc so we can simulate buttons on a voltage divider by just connecting the potentiometer and pressing one of the hot keys?
In the interim would it be possible to make the potentiometer have hot keys for values so we can simulate the same thing?
Sounds like a good suggestion. There's also page-up/page-down that jump up/down, but not to a specific point. If anyone is interested in hacking on this, you can add a new keyboard event listener here, and then check if the key is 1, 2, 3, etc. and modify the value accordingly.
While waiting for this, there's some workaround: you can achieve a similar functionality by implementing a custom chip (see #301 for details). Here's one example showing how to use a custom chip to simulate multiple analog buttons connected to a single analog input:
https://wokwi.com/projects/339700374803841619
The custom chip works well BTW. Thanks for the suggestion.
Oddball suggestion, but instead of implementing further simulation in the backend, maybe borrow the simulator from https://github.com/SEVA77/circuitjs1?
P.S. This is an awesome project. I'm so glad I found it.
Thanks for the suggestion @kubark42!
The funny thing about "circuitjs1" is that it's actually implemented in Java and compiled to JavaScript.
In any case, we already have a solution for the analog simulation part of this feature. The main challenge is how to integrate it into the existing simulation framework while keeping the performance high and not breaking existing projects which rely on the current behavior of resistors.
Right now, this feature is #8 in the requested feature list, let's see how long until it makes it to the top :-)
2 years later, still not implemented
1.5 months later, and now it's number 6 on the list
Prioritization should happen for important things and urgent things. It isn't a great optic when it takes 2 years to do something as simple as a resistor divider. Maybe it's a heck of a lot of work on the backend, and that's why it isn't happening. But if prioritization comes down only to votes, then low-hanging fruit never gets prioritized. Typos and documentation errors will endure effectively indefinitely if only the most highly voted features get implemented.
Looking at the prio list, some things are jaw-droppingly difficult, such as an offline simulator. Le'ts hope that resistor dividers are easy and can find their way into the queue before the devs tackle offline support and its almost infinite number of computer configurations.
I'm wondering - how much work time do you estimate the resistor divider would take?
Nothing against you, but this functionality of voltage dividers is already in the worst simulator TinkerCAD... That does not have other important features for which I switched to Wokwi.
Dont know how simulation in Wokwi works, if it is not like "circuit" simulation, but more cpu only simulation with peripherals.