Simulating Circuits with Fritzing

A_glowing_LED

After many requests and years of waiting, Fritzing finally got a simulator!

The primary purpose of the simulator is to teach electronics to beginners, and its current capabilities are very limited (only analysis of DC circuits). However, it is fully functional, easy to use, and works on the breadboard and schematic view. In addition, it performs some checks to see if any parts are working outside their specifications.

In this blog post, we will teach how to use the simulator step by step.

Installation and enabling the simulator

The simulator is only available in Fritzing 0.9.10 or later versions. It is disabled by default. To enable it, go to Edit->Preferences (or +, File->Preferences in macOS), select the “Beta Features” tab, and check the “enable simulator” checkbox. Fritzing will save this option, and you will only need to activate the simulator once. Of course, you can still disable it anytime in the preferences dialog.

After the simulator is enabled, you will see a simulate button next to the share button at the bottom bar.

Running examples

Let’s start by opening the LED example. Go to File->Open Example->Simulator->Basic Circuits->LED.

This is a very simple circuit with an LED, a resistor, and a battery. Once the example is loaded, press the simulate button. The LED switches off as the resistance is too high, and very little current flows through the LED. Try to reduce the value of the resistor. For example, set the resistance to 30Ω. To do that, select the resistor and change the resistance property in the Inspector pane. As soon as the resistance is changed, the simulator will simulate the circuit again, and you will be able to see the light coming out of the LED. Now try changing the 3V battery to a 9V one (in the Inspector pane). The simulator recalculates the current that flows, and now this current is too high, so it breaks the LED and the resistor. This is indicated by a smoke symbol on top of the LED and the resistor. You can fix it by setting a higher resistance or changing the resistor’s power and the LED’s maximum current.

FIG1_simple_led_bb

Measuring voltages and currents

The simulator tries to recreate what you would experience when working with real hardware. Thus, you can use a multimeter to measure voltages, currents, and resistances. The best way of experiencing this is to start with the examples contained in File->Open Example->Simulator->Multimeter.

Let’s open the example called “How to measure DC voltages”. In this example, a multimeter is connected to measure the voltage of a battery. When you press the simulate button, the multimeter will show the battery’s voltage. Change the battery voltage, and you will observe how the multimeter’s display updates the voltage. Now, open the “How to measure DC currents” example. Change the value of the resistor to change the current that flows through the multimeter. Notice that the multimeter displays the numbers in engineering notation (e.g., 17.5 mA means 0.0175 A).

FIG2_measure_dc_voltage_bb.png

FIG2_measure_dc_current_bb.png

Breadboard view or schematics view

While the previous examples are shown in the breadboard view, the simulator can work in any view. You only need to wire one view, but of course, you can also wire all of them. For example, below, you can find a NAND gate being simulated in the schematics view and where the input signals are controlled with switches.

FIG6_nand_gate_schem

Error checking

As we have seen in the LED example, the simulator checks that the simulated devices are within their specifications. A smoke symbol is added on top of a device if it’s working outside its specifications.

Currently, we have implemented these tests:

  • Three probes connected to a multimeter or wrong probes connected (Err message on the screen appears)
  • Short circuit in batteries
  • Max current (diodes and LEDs, TODO: inductors)
  • Max power (resistors)
  • Reverse voltage (tantalum and electrolytic capacitors, IR sensors)
  • Max voltage (capacitors, motor, IR sensors)

Using the simulator from scratch

FIG3 fritzing simulator bin

You are encouraged to simulate your own circuits, but be aware that currently, only a few Fritzing parts contain simulation models. Thus, several parts cannot be simulated. The best solution to avoid problems is to use the “Sim Parts” (SIM) bin. In the bin selector, scroll down with the arrows until you find the SIM bin. All the parts included in this bin can be simulated.

If a circuit contains parts that do not have a simulation model, they will automatically be ignored in the simulation. In addition, they will be greyed out to indicate that they are not taken into account in the simulation. Notice that parts can also be grayed out even if they have a simulation model. This happens if the part is not connected to the rest of the circuit. In the example below, the resistor and the capacitor are not part of the circuit, and the temperature sensor does not have a simulation (SPICE) model.

Fig.4 unspiced parts greyed out
Fig.4 unspiced parts greyed out

The simulation model of a part is shown in the Inspector pane. So, if you are in doubt, check the SPICE field in the Inspector pane. If it cannot be simulated, it will be clearly indicated there. We can observe that if we select the temperature sensor in the previous example, as shown in the next figure.

FIG5_spice_info

Currently, only a few types of devices are supported:

  • Resistors
  • Capacitors
  • Inductors
  • Switches
  • Potentiometers
  • Diodes
  • LEDs
  • Transistors (Bipolar Junction and FET)
  • Multimeters
  • IR sensors
  • DC motor
  • Batteries
  • NAND gates

The status of the switches and potentiometers can be changed through a menu in the inspector pane. The switches change their images based on their status (pressed/released) in the breadboard view and the schematics view. Currently, the position of the knob in the potentiometers is not updated. The only output devices which the simulator handles are the LED and DC motors. LEDs change their color based on the current that flows through them. RGB LEDs are currently not supported. DC motors show an arrow if they are rotating (indicating their direction of rotation).

Notice that currently, the simulator can only simulate one circuit per file. If you have several independent circuits, you can merge them by connecting their grounds together.

Power symbols in the schematic view do not provide voltage. Add a DC power supply and connect it to a ground symbol and a power symbol.

Finally, you can stop the simulator by pressing the stop button. This is very handy when you are wiring your circuit. Of course, you can activate it later by pressing the simulate button.

Citing the simulator and academic paper

If you are interested in more specific details of the simulator and its use for teaching electronics online, please take a look at the paper: Andres Faiña, “Learning Hands-On Electronics from Home: A Simulator for Fritzing”, Accepted in the proceedings of the 25th International Conference Series on Climbing and Walking Robots (CLAWAR 2022). Available at https://arxiv.org/abs/2206.07146.

Warning

The simulator is still in beta status and could have bugs that let Fritzing crash. Please help us improve it by reporting them at the issue tracker. And of course, if you think you can help us with the development, you can contact us or send us a pull request. There are several parts that need SPICE models!

Andres Faiña and the Fritzing Team.

Fritzing 0.9.10 released

Fritzing 0.9.10 was released on Sunday, 22nd of May 2022. We tested it for Windows 10, Windows 11, macOS Monterey, macOS BigSur, macOS High Sierra, Ubuntu 18.04, Ubuntu 20.04, and Ubuntu 22.04.

Fritzing 0.9.10

Improvements

  • Add Japanese translation
  • Support image export in higher resolution
  • Update Bulgarian, Czech, French, German, Italian, Portuguese, Romanian, Russian, Slovenian, Slovak, Spanish, Turkish, Ukrainian, Vietnamese
  • Add a (hidden) beta version of a simulator

Simulation is one of the most requested features of Fritzing. For more than a decade, people have asked for Fritzing to simulate circuits.

There can be very different expectations about the scope of the simulation. The simulator is limited to the parts available in the simulation bin. If a part can not be simulated, it will be greyed out during the simulation.

The simulation was tested by several groups of students, and is now available as a beta feature. If you want to give it a try, you can enable it in Fritzings preferences.

Fixes

Fixed issues:

  • #3943
  • #3931
  • #3895
  • #3880
  • #3868 , #3820
  • #3863
  • #3850
  • #3830
  • #3825
  • #3738, #3602, #1869
  • #3715, #684
  • #3632, #3627, #3109
  • #3559
  • #2669, #1326
  • #2583, #2675

Parts

Modules Modules Voltage regulators

  • Several voltage regulators added
  • SeeedStudio Grove Beginner Kit
  • TDK Ultrasonic sensor module
  • Amica NodeMCU
  • About 90 parts received minor fixes

The release is available in our downloads section. We’d love to hear what you think! Write us via our contact form or check out our forum.

Thank you for using Fritzing!

New parts: Sony's Spresense Boards

We added Sony’s Spresense modules for Fritzing. Altogether, there are four new parts: the mainboard, the Arduino extension, the LTE extension, and the camera. In this post, we will have a closer look at the Spresense board. We will deploy a Hello World and a Camera example application.

The Spresense parts

spresense_ili9341

The parts are included with recent versions of Fritzing. We highly recommend using Fritzing with a version >= 0.9.7 .
What are the Spresense modules? First, there is the main module: Sony’s CXD5602 microcontroller runs a Cortex-M4F CPU with 6 cores, GPS. The low power consumption makes it suitable for battery-dependent use cases. There is a great choice of libraries supported, including Python, TensorFlow, Edge Impulse, Java, JavaScript, and Circuit Python for low power consumption. Together with GPS, LTE, Wifi, BLE extensions, this makes them suitable for IoT and AI applications.

Then, there is the extension board. It adds Audio input for up to 8 channels, 3.5mm headphone output, an SD-Card slot, an extra USB connector, and the well-known Arduino shield headers.

The third module is the 5MP camera board. With 24mm x 25mm, it is very compact. It connects to the Spresense main module with a flat cable.

And then there is the CXD5602PWBLM1 board, the LTE extension. It adds LTE capabilities to the main module. Also, it has a 3.5mm headphone output, up to four digital microphone inputs, an extra USB connector, and general IO headers.

See the Spresense developer site for more details.

Getting started

For testing, we have set up Ubuntu 21.04 VM and prepared the Software Development Kit with the setup guide from Spresense.

If you are also using a VM, make sure that both, host and guest machine have the “dialout” group for your user account, so you can access the Spresense board when connected to USB. The board should be visible as “Silicon Labs CP210x” with lsusb when the board is connected. If all looks good, we should be able to connect with minicom.

fritzing@ubuntu: ~

fritzing@ubuntu: ~ $ lsusb
Bus 001 Device 027: ID 10c4:ea60 Silicon Labs CP210x UART Bridge
Bus 001 Device 002: ID 80ee:0021 VirtualBox USB Tablet
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
fritzing@ubuntu: ~ $ minicom -D /dev/ttyUSB0 -b 115200

The connection with minicom will open a NuttShell on our Spresense board. No, this is not yet the ‘Hello World’ we are looking for.

fritzing@ubuntu: ~

Welcome to minicom 2.8

OPTIONS: I18n
Port /dev/ttyUSB0, 23:39:12

Press CTRL-A Z for help on special keys


NuttShell (NSH) NuttX-10.1.0
nsh> echo "Hello World"
Hello World
nsh>

Hello World

Running Hello World on a console is a bit lame. How about using an actual LCD for that? For this, we use an ILI9341 from Adafruit (about $10). We connect it as shown in the Fritzing project below:

spresense_ili9341

To address the ILI9341 display, the Spresense board needs to know how it is connected. Add the following configuration to the Nuttx kernel, by storing it at ‘spresense/sdk/configs/devices/ili9341_on_spi5/defconfig’

# spresense/sdk/configs/devices/ili9341_on_spi5/defconfig
-NXFONTS_PACKEDMSFIRST=n
+LCD_ILI9340=y
+LCD_ILI9340_IFACE0=y
+LCD_ILI9340_IFACE0_RLANDSCAPE=y
+MMCSD_HAVE_WRITEPROTECT=n
+MQ_MAXMSGSIZE=64
+NX=y
+NXFONTS_DISABLE_16BPP=n
+NXFONT_SERIF22X29=y
+NX_BLOCKING=y
+NX_DISABLE_16BPP=n
+CXD56_DMAC_SPI5_TX=y
+CXD56_DMAC_SPI5_TX_CH=4
+CXD56_DMAC_SPI5_TX_MAXSIZE=1516
+CXD56_DMAC_SPI5_RX=y
+CXD56_DMAC_SPI5_RX_CH=5
+CXD56_DMAC_SPI5_RX_MAXSIZE=1516
+LCD_ON_MAIN_BOARD=y
+LCD_ILI9341=y
+LCD_ILI9341_NINTERFACES=1
+LCD_LCDDRV_SPIIF=y
# The display can run at much higher speeds. But signal quality on the breadboard and the wires can
# vary a lot, so we limit it to 2MHz. Still fast enough for our purpose at 320x200x16 
+LCD_LCDDRV_SPEED=2000000

With the config file in place, we can now build the kernel and flash the Spresense board. We configure it to build the nxhello example and our custom ili9341 setup. Then we run make. If all was successful, we flash the board. Using the default speed of 115600 did not work reliable, but with a higher speed of 460800 (or other high values), flashing works quite reliable. Don’t forget to source ~/spresenseenv/setup, as described in the Spresense getting started documentation.

fritzing@ubuntu: ~

fritzing@ubuntu: ~ $ source ~/spresenseenv/setup
fritzing@ubuntu: ~ $ tools/config.py examples/nxhello device/lcd_ili9341_on_sp5 && make -j && tools/flash.sh -c /dev/ttyUSB0 -b 460800 nuttx.spk
make[1]: Entering directory '/home/kjell/spresense/nuttx'
make[2]: Entering directory '/home/kjell/spresense/nuttx'
Create .version
make[3]: Entering directory '/home/kjell/spresense/nuttx/boards'
make[3]: Leaving directory '/home/kjell/spresense/nuttx/boards'
make[3]: Entering directory '/home/kjell/spresense/sdk/apps'
make[4]: Entering directory '/home/kjell/spresense/sdk/apps/platform'
make[4]: Leaving directory '/home/kjell/spresense/sdk/apps/platform'
make[4]: Entering directory '/home/kjell/spresense/sdk/apps/builtin'
make[4]: Leaving directory '/home/kjell/spresense/sdk/apps/builtin'
make[3]: Leaving directory '/home/kjell/spresense/sdk/apps'
make[3]: Entering directory '/home/kjell/spresense/nuttx/graphics'
.
.
.
>>> Install files ...
install -b 460800
Install nuttx.spk
|0%-----------------------------50%------------------------------100%|
######################################################################

196432 bytes loaded.
Package validation is OK.
Saving package to "nuttx"
updater# sync
updater# Restarting the board ...
reboot


After the nuttx.spk file has been flashed to the Spresense board, connect to it via minicom again, and run ‘nxhello’.

Camera demo

In the previous section, we have wired up a display and verified it works. Now the fun part, just connect the camera. Instead of ‘nxdemo’, we now build the camera example.

tools/config.py examples/camera device/lcd_ili9341_on_sp5
make -j 
tools/flash.sh -c /dev/ttyUSB0 -b 460800 nuttx.spk

Connect to the board with minicom, and call ‘camera 0’. This will show images from the camera on our display. Even though we have reduced the video signal to 2MHz, we get quite a fluent update rate.

Since we are filming a 320x240 display, the video can not represent the capabilities of the camera. Here is a picture directly recorded with the board: Link to full size image

Other examples

There are many more example applications.

Zmodem

With the zmodem driver and minicom, it is easy to transfer files from the board to your PC.

GPS

Show your coordinates. The GPS demo needs a few minutes for the first fix. This is normal. To shorten the time, you need assisted GPS or you have to load ephemeral data. Maybe the GPS chip can already cache that data? We didn’t try.

TensorFlow

TensorFlow lite should allow some cool projects in connection with the camera. We didn’t get to try this one yet.

Do you have any ideas for the board? Have you already build any projects? We are looking forward to your comments in the forum.

References

Fritzing 0.9.9 released

Fritzing 0.9.9 was released on Sunday, 24th of September 2021. We tested it for Windows 10, Windows 11 (preview), macOS BigSur, macOS High Sierra, Ubuntu 18.04, Ubuntu 20.04, Ubuntu 21.04, Fedora 34.

Fritzing 0.9.9

Improvements

Fritzing can now remember uploads to our Fab. There will be a clickable symbol next to the file name in the “Recent files” list. Some keyboard shortcuts where added: Ctrl+F for search, and [, and ] for rotation.

Fixes

A regression for Power labels in the schematic view was fixed. Some old bugs when resizing strip- and perfboards have been fixed. Several of the core parts have have been fixed, including lots of SVG exports.

For details, see the Changelog for Fritzing 0.9.9

The release is available in our downloads section. We’d love to hear what you think! Write us via our contact form, check out our forum.

Thank you for using Fritzing!