Hot answers tagged

136

There are a whole slew of Arduino simulators out there, many free, and some paid products as well. The CodeBlocks Arduino development environment includes a free Arduino simulator, still under development but functional. Simuino simulates the Arduino Uno and Mega pins - not a pretty-looking realistic simulator, but it works. The Python based Arduino ...


90

I like to use circuits.io aka TinkerCAD for this. It's cloud based and has some nice features including PCB design and collaboration. IMO the Arduino simulation and capability is impressive and intuitive.


43

Plenty of options exist in the world of electronics simulators, but circuits.io aka TinkerCAD is probably the most versatile one out there. You can compose your circuit on a virtual breadboard which looks just like real. You can actually watch a LED blinking or press a button during real-time simulation rather than struggling with abstract waveforms. You ...


18

Be aware that no simulator will reproduce real-life situations. There have been plenty of posts on the Arduino forum about problems with code or electronics, which turn out to be something subtle, such as: Timing issues Race conditions (related/dependent events not always happening in the same order) Voltage levels, eg. floating input pins Driving motors ...


14

Note : After the @Ricardo's comment on my last post, I am posting this ! Plug the board into a USB port on your computer and check that the green LED power indicator on the board illuminates. Standard Arduino boards (Uno, Duemilanove, and Mega) have a green LED power indicator located near the reset switch. An orange LED near the center of the board (...


14

You can use Yenka (free for home use) to simulate Arduino, PIX, PIXACE and other boards with digital, analog and serial I/O. It provides a lot of components and sample projects. Screenshot:


13

Yes, you can, try using Proteus ISIS for simulating your code... For full emulation of Arduino, there is a shareware program called VBB (Virtual BreadBoard), I tried it too and it was nice. Edit: You can check my detailed tutorial here on how to simulate on Proteus ISIS


11

I believe this website has a list of both emulators and simulators along with their price and availability. Update: Since some users mentioned there are broken links in that website, here's a selection of emulators I found. Note that some descriptions may have been taken from the mentioned link: Emulino: Is an open source linux based software in early ...


10

I always try to isolate the hardware logic from the rest of the domain logic. Classes (or whatever) from domain logic can be programmed in c++ (with the known arduino restrictions like exceptions or std lib) and can be tested with gtest. When these classes are tested, simply instance from arduino program excluding the main with tests. If your project is ...


10

You can easily simulate your Arduino code using the famous Proteus ISIS. You just will have to search for the specific Arduino simulation library for Proteus. Here you a small tutorial of how to make this thing done: First, identify the path the Arduino IDE generates the hex file to? for example if you are using the official IDE you will find the hex ...


8

Virtualbreadboard has a new VBB4Arduino 'Two Arduino's' edition which includes BOTH a JVM Arduino emulator AND a AVR Instruction set simulator with examples that cover almost all of the Arduino distribution examples and a bunch of peripheral hardware - LCD's, WS2812 Neo LEDS, Motors, Servo's, Logic Analyser and more. http://www.virtualbreadboard.com ...


8

Edit 2: I am working with the new Wokwi Arduino Simulator. Wokwi Arduino simulator is based on AVR8js engine which is made open-source. You can find the link here Following are the main features of the simulator • Supports multiple file projects • Supports the Arduino libraries • Whatever compiles on the Arduino IDE will compile on the simulator • ...


5

Supposed one owns a USB programmer, there's another way to inspect the Arduino. Connect the programmer to the ICSP pins of the Arduino and call avrdude with the right parameters to read the fuses of your Arduino. avrdude -c programmer-id -p partno -P port For an Arduino Uno, partno is m328p. Programmer-id depends on the device used. In my case (mySmartUSB ...


5

You could e.g. use my simulator. It is especially suitable for PLC-like applications, where multitasking is achieved by cyclic evaluation of interconnected circuit-like objects: Timers, Markers, Latches, Oneshots and Registers. You can use it to simulate your controlled system as well, as becomes clear from the examples in the download. It has modest ...


4

Yes, you can - and it's something I often do when doing low-level electrical testing an SPI interfacce. For every clock that you send out the data presented on MOSI will get reflected on MISO. So if you were to (using the Arduino SPI library) do: uint8_t x = SPI.transfer(0x38); then x should equal 0x38. I find this especially useful on systems with ...


4

Have you looked at the AVR simulator that's part of Atmel Studio? Considering Atmel designed the processor, the simulation may very well be running the HDL that was used to produce the MCU itself. I suspect if you're doing something involved enough to be using unit-testing, you should probably stop thinking of your device as an "Arduino", but rather "An ...


3

a way I can write my code and emulate/test it using a desktop computer If you mean being able to "unit test" using a desktop computer, I can offer a library I wrote called arduino_ci. It doesn't offer emulation. You would express your tests in code. For example, here is a test pulled from the reference documentation that validates the data written to a ...


3

Usually the SPI Master clocks data out while the Slave clocks data back in. So if you were sending and receiving 8 bits per transaction you can clock out 8 bits and at the same time clock in 8 bits for a total of 8 clocks. This is described in this Wikipedia paragraph. That said, often the first 8 clocks are used to transmit a command and an additional 8 ...


3

If you want to run the Arduino sketch on your desktop, you just have to implement the Arduino core library for your PC. It may not be as bad as it sounds. If your program makes only minimal use of the Arduino core, you may implement only the parts you really need. For example, this partial implementation is enough to run your program: #include <cstdint&...


2

As you've stated in your question, the TSOP-15 is a receiver. That means it detects infrared signals rather than sending them out. To make a remote control with that code, you need a simple infrared light emitting diode. It's also important to note that you need to know what signals to send. Different TVs will have different IR codes, depending on the ...


2

After a serial.read();, the data [as far as I can tell] is pretty much destroyed. You have two main options to accomplish this: Store the data in a string when read and then reference this later. I'd do this with a global variable, that is declared outside of a method and accessible throughout your whole sketch. I haven't read throughout your whole code, ...


2

If you have another, working, Uno, and both have socketed microcontroller chips, you could use the known board to program a test sketch onto the unknown board's chip, put it back on the unknown board, and run it. I like the following (pseudo-coded) test sketch for quick-checking my hand-built boards; it's just as handy for testing an unknown factory-built ...


2

The first connection you made between arduino and esp which resulted in some random data means both are communicating whereas the second connection where the screen shows blank means communication hasnt been established on account of incorrect wiring. So your first connection tx>tx and rx>rx is correct. The only two area which you need to check is the baud ...


2

Connect both Pin2 and Pin3 with two 1K resistors to ground. When a pin that's set as INPUT is "floating" (it's not connected to anything) the value on it is "undetermined" and interrupt can trigger when a neighboring pin status changes, or even just magically by itself. The 1K resistors (called pulldown resistors) will make sure that pin is set to LOW when ...


2

In Arduino parlance the word "Verify" is used (erroneously) to mean "Compile the code into a binary or HEX file, but don't upload it to the board". To compile (and thus "verify") the code just pass the compile command to arduino-cli with the board you want to compile for and the sketch you want to compile.


2

It should preferable also have the ability to simulate an Arduino. As said in the comments, only simulating the Arduino is mostly not enough, because you would also need to simulate all the connected components. Just simulating the Arduino is a rather hard task. You can find Arduino simulators, but they always only support a rather small collection of ...


2

A complete test would obviously be something fairly complex, and would probably require building some sort of rig. You can, however, perform a minimal test that checks for common failure modes, without connecting any extra hardware. I assume the pin I/O stages are the easiest thing to break. You can then check that, when you read a pin that is set to OUTPUT, ...


1

CMOS inputs "float" when not connected to anything, and will give semi-random values. You can either connect the pin to ground via a medium value resistor (1kΩ-10kΩ), or set the pin to INPUT_PULLUP mode. You shouldn't move the interrupt pin connections around while the Arduino is running. As soon as you disconnect the wire from the input, it begins ...


1

@Majenko's is 100 % correct. Here's my updated .gitlab-ci.yml for my arduino library. image: ubuntu:latest before_script: - apt-get update -yq - apt-get install -yq ca-certificates - apt-get update && apt-get install -y --no-install-recommends bzip2 curl unzip - apt-get upgrade -yq - curl -L -o arduino-cli.tar.bz2 https://github.com/...


1

There are my options: The default way to do this is to use an oscilloscope. These can be quite expensive. Use a logic analyzer if the voltage is logic/binary (0 and 3.3 or 5V). These are very cheap. The easiest way to know if it works without the devices above, is to lower the speed drastically (using a divider in the software, like 1000 or more to get PWM ...


Only top voted, non community-wiki answers of a minimum length are eligible