Hey all, I'm getting start with using LTSpice to simulate some simple circuits hooked up with my Arduino Uno.
I have a question as to how to simulate digital pins in INPUT, OUTPUT or INPUT_PULLUP modes. I don't want to simulate the entire arduino, but is there a way to easily simulate individual digital pins in something like LTSpice in one of the above states? I don't know enough about what's going on inside the Arduino or Atmega chips to know whether or not I can just simulate it with a resistor and diode, or how to include a pull-up resistor into the diagram. If anyone has any advice for how to easily simulate the input pins on the arduino or can point me towards some schematics I'd be really grateful.
So, essentially no current will flow into an output pin when it is turned off (low)? But when it is turned on (high) there is maybe a 30 or 40 ohm resistance?
Is there any resistance on the input pins? The Arduino docs suggest that there is, but the Atmega datasheets makes me think there is no resistance when configured as input.
Input pins make extremely small demands on the circuit that they are sampling, equivalent to a series resistor of 100 megohm in front of the pin.
If the Arduino docs is right then where would that 100 megaohm resistor be in terms of the pull-up resistor?
I think that going back and forth between the atmega docs and the arduino docs is confusing me..
Normally inputs can be modelled as 10^10 ohms for CMOS. At room temperature.
The 100M value is at max operating temperature as leakage currents rise exponentially
with temperature.
Unless you are running a very strange circuit you don't have to worry about these details,
its three ideal MOSFETs and a resistor (and two protection diodes if that matters).
For some simulations you need to take into account the input capacitance of the pins.
For digital I/O pins it is max 10pF.
For the analog ADC inputs it can be modelled as a 1...100kohm (datasheet is not clear about this) resistor in series with a 14pF (S/H) capacitor which is connected to Vcc/2 (see figure 24-8 in the atmel datasheet for ATmega 48/88/168/328)
Maybe this is helpfull to you.