Vbb4Arduino User Manual PDF
Vbb4Arduino User Manual PDF
Vbb4Arduino
Two Arduinos
23 Jan 2017 Added initial entries for Arduino Emu, Arduino SIM,
S2812, DS1307, 24LC256
24 Jan 2017 Added initial entries for Trimmer, POT, relay, solenoid, 5.53a
555, 7 Segment
1 Contents
2 Introduction .................................................................................................................... 10
5 Design Sheets.................................................................................................................. 38
6 Breadboard Components................................................................................................ 77
2 Introduction
VBB is a software platform designing Breadboard form-factor electronic circuits and
developing the microcontroller firmware that drive them.
2.1 Features
Integrated C programming using VBB hosted CodeBender cloud compiler
Integrated Java programming using using VBB hosted Java cloud compiler
Rich set of components for learning most of the Arduino basics
77 Built in examples
2.2 Limitations
No extensibility and no programming of real devices.
No programming of real Arduino devices
No analog circuit analysis. VBB is a digital environment with modelling of common
analog circuits ( All VBB Versions )
Arduino is a curious mix of Java and C++. The Arduino Sketch is derived from Processing
which is a java development environment. Hence the Arduino Sketch looks at first glance like
java and for many starter examples it is java. However even though a Sketch looks like java
under the hood it is actually C++ hacked to look like java. Java in C++ clothing! As examples
become more advanced the C++ nature of Arduino starts to dominate.
So just like there are advantages for Java and C++ in Arduino there are advantages for both
when virtualizing applications. VBB started off virtualizing only the Java side of Arduino but
unfortunately after a while Arduino diverges from Java and so the C++ side of Arduino is
needed.
The nice thing about thinking about Arduino as Java is that its easier to virtualize some of
the more interesting aspects of embedded applications so just like with Arduino the idea is
to start with Java and migrate to C++ as you advance.
Java C
[-] No 3rd party Libraries [+] 3rd party libraries when using
ArduinoIDE/VbbIO
2.4.1 Upgrade
[TODO] There is an option to upgrade to Arduino Developer Bundle
Virtual Breadboard can be used as a Circuit Emulator for some types of Circuits. In particular
VBB is not a SPICE simulation and does not currently resolve circuit current so you cannot
use it for circuit-analysis. However for a wide variety of physical computing circuits VBB
emulations work just fine.
Its important to understand this difference when using VBB because you cannot place
capacitors and resistors and expect for example behaviours such as filters to emerge. There
are however common work arounds to achieve common behaviours using properties of the
discrete components.
All Vbb4Arduino versions is free to download. This makes it easy to manage updates etc. As
a minimum VBB can be used to layout Breadboard designs for free. This is already useful and
there are other popular Breadboard layout design tools that are limited to design only.
In addition VBB has virtualization features which you can optionally pay to enable.
http://www.virtualbreadboard.com/DocView.html?doc=Downloads/Downloads
Unzip the executable to the location where you would like to run it from. For example the
desktop.
Execute VBB4Arduino.exe to start the application. Note this is note an installer and will not
create shortcuts. You will need to create your own shortcuts if required
Dependencies
Purchasing a license will enable the Vbb4Arduino runtime allowing models to virtualize
Enter the activation code into the textbox and the code will be checked using the
internet and the software activated. You should see a big Green tick once activated.
Some of the features of VBB are now hosted in the cloud in the Google AppEngine server
and accessed by license keys that are generated when features are purchased. It all works
pretty seamlessly as long as you have a quality full time internet connection.
Fortunately the internet has become more or less ubiquitous but there are some situations
where it doesnt work out
3.6.1 Firewalls
Internet Access is made via standard Http WebServices on Port 80. This looks just like
Browser Access and usually there are no problems with firewalls.
However rarely, mabye 1 in 100 users find their configurations are not compatible with VBB.
The primary problem is firewalls. There are 2 firewall that can cause issues.
3.6.1.2 Work
Sometimes there is a domain/password proxy that needs to be configured. The Classic
versions have a setting for this now in the ToolOptions dialog. The Windows App libraries
dont offer this same setting and rely on the Browser settings however this seems a bit
indirect so a source of potential issues.
4 VBB Application
VBB is an Integrated Development Environment for the purpose of designing, simulating and
building microcontroller based electronics hardware systems.
There are 3 modes, Project Select, Design Mode and runtime mode
Open PowerOn
Project Select Project Open
Project
New Design Time
Runtime
Existing Add Designs
Runtime
Recent Edit Code
Close PowerOff
The fundamental concept is the DesignSheet. Designsheets are contained in projects and
projects are contained Solutions.
4.1 Solutions
A solution The VSM Virtual System Model Solution file is the root file for VBB. It contains
references to a collection of Projects and contains global settings for the solution.
Vbb4Arduino solutions have only 1 project.
4.2.1 Breadboard
The Breadboard is the primary DesignSheet in VBB and consists of a collection of
components wired together to create circuits
Tips The Tips tab contains a list of tips that can be useful when getting started
New : Create a new project from scratch or with a helper
Existing : Open an existing project from the file system
Recent : Open an existing project from a list of projects recently worked on
4.3.1 TIPS
The Tips tab contains a list of tips that can be useful when getting started
Check Tip Items Check each tip once you have read as a note to yourself that it has been
read
Hide Seen Tips When checked the tips you have already read and checked as read will not
display in the list
Show Tips Tab On Startup When checked the TIPS Tab will be selected as the default Tab
when the project select dialog is show. Unselect to default to NEW or Existing
The New Tab is used for creating New projects from project templates. A project template is
a complete solution based on an example or project type which you can use to quickly get
started. The templates are organized into a tree of project types to help you locate a
template that best suits your embedded application challenge. The Project Types Tree on the
left hand side selects the project type and the Project Templates lists the available templates
for the selected type.
The first step is to give the new project a name as source code projects cant be saved to
scratch disk.
The first step is to give the new project a name as source code projects cant be saved to
scratch disk.
The import wizard can create either Arduino Java or Arduino Sketch projects
There are different templates preconfigured hardware suitable for different types of
projects
Breadboard template
Breadboard template
In addition to creating new projects or projects based on existing Arduino code Vbb4Arduino
contains numerous built-in reference examples
To open a reference example click the folder on the left to show the available examples in
the group then Select/Open or double click the example in the right Project Templates panel
to open the example
The Existing Tab allow projects that already exist to be located and opened using the inbuild
file browser
Existing Tab
Existing Projects
Default Directory
The Default Directory is the location that is first shown. By default this is <User>My
Vbb4Arduino Projects but you can change the default location using the Browse Button to
navigate to a new folder location.
1. Existing Tab
The navigation dropdown list allows you to search the computer for directories containing
an existing VBB solution to open
4.5 Recent
The recent tab hold the most recently used project list for quick access to recently used
projects.
When the project opens the state of the VBB UI moves into DesignMode with the following
environment features
The organisation is based around the Solution Explorer which is a tree of projects containing
design sheets as leaves.
DesignSheets are Viewed in ViewPanes and to move a design sheet to a view pane it is
dragged and dropped from the solution explorer tree into the design sheet.
Properties of Design Sheets and components in designs are shown in the Properties Editor
App Window
App Menu
App Toolbar
View Panes View Mode
4
Context Toolbox Design Sheet
(Breadboard) (Breadboard)
Solution Explorer
Design Sheet
Context Toolbox
(SourceCode)
(SourceCode)
Properties Editor
The VBB Application is a Multiple Document Interface (MIDI) style application where the
document being managed is the DesignSheet.
4.6.2.1 File
New Ctrl + N Opens the New Project Dialog with the New Tab
selected.
Open Ctrl + O Opens the New Project Dialog with the Existing Tab
selected.
Save As Opens the Save Dialog prompting for the new project
name.
4.6.2.2 Edit
Icon Name ShortCut Description
Name Description
Update ICEShield Firmware Starts the ICEShield firmware update dialog. See ICEShield
Virtual Breadboard HomePage Launches a Browser and opens the Virtual Breadboard
HomePage
The VBB application Toolbar gives quick access to the core Vbb4Arduino features
Save Saves the current project. If the project has not yet been
saved it will launch the SaveAs dialog
The Active design sheet is the currently selected sheet which is the design sheet highlighted
darker green
1. You can always click into the TitleBar to select the DesignSheet as the current
DesignSheet
The solution Explorer contains a tree representing the DesignSheets in the solution.
Right Click on a Project to add Logic Analyser, Breadboard, Arduino Java Source or Arduino
Sketch Source DesignSheet
Right Click on a Java Source Project to add a Java source file to a Source Code Project
Right Click on a Arduino Source Project to add a Sketch, .cpp or .h source file to the Source
Code Project
Deleting : Right click on the element to delete and select the delete drop down menu
Rename : Right click on the element to rename and in-place edit the new name
The design panel has up to three design panes. Each pane may contain a different
arrangement of DesignSheet9s)
Two Panel Splits the design panel into two separate design panes
Three Panel Splits the design panel into three separate design panes.
When you double click a DesignSheet in the navigation tree it is selected into one of the
available panes according to its default viewing position.
You can override the default location by dragging and dropping the design from the
navigation tree to the desired panel.
When switching between layouts the previous layout remembers which DesignSheets are in
which panel.
DesignSheets are the documents managed by Vbb4Arduino. The have a design area and an
optional Toolbox. There are four design sheets in VBB4Arduino.
Breadboard
Source Code Java
Source Code Sketch
Logic Analyser
The properties editor is populated when components are selected with DesignSheets. The
properties are specific to individual components.
Custom Editors
Property Description
When you select a component the properties box is populated with the component
properties.
When a component is selected the description of the property is displayed in the property
description panel
When a panel has no DesignSheet it appears blue. You can fill the panel with a DesignSheet
by dragging and dropping a design into the panel
When a circuit is powered up it moves into Runtime mode where the circuit is virtualized
and can be explored for testing or learning purposes. Clicking the PowerDown button stops
virtualization and returns Vbb4Arduino to design mode.
If there is more than one Breadboard in the project the Active Breadboard is launched.
Breadboard components
are real-time interactive
Virtual Arduino
components pull their
source code from their Source Code
Application Property Runtime console
5 Design Sheets
DesignSheets are the main document managed by the VBB system. There are 4
DesignSheets available in Vbb4Arduino
Java Source Project .SRC The source code project is a special type of
DesignSheet which contains a collection of
java source code files
Arduino Sketch Project .SRC The source code project is a special type of
DesignSheet which contains a collection of
Arduino Sketch source code files
The integrated Arduino Sketch projects are compiled using the VBB Hosted instance of the
CodeBender compiler and the binaries execute on the Arduino SIM development board
Arduino Sketch
VBB
CodeBender
Sketch (.ino)
Header (.h)
C++ (.cpp)
There is no support for adding additional 3rd party libraries beyond those included in
Vbb4Arduino or for upgrading to Arduino 1.6. For advanced Arduino use you should use the
Arduino SIM component either in Arduino IDE monitor mode or VbbIO bootloader mode.
Refer to the Arduino AVR Component.
The Libraries reference example shows how this is done. It is taken from the Arduino
explanation of how to create libraries.
5.1.4.1 Morse.ino
#include "Morse.h"
Morse morse(13);
void setup()
{
}
void loop()
{
morse.dot(); morse.dot(); morse.dot();
morse.dash(); morse.dash(); morse.dash();
morse.dot(); morse.dot(); morse.dot();
delay(3000);
}
5.1.4.2 Morse.h
#include "Morse.h"
Morse morse(13);
void setup(){}
void loop()
{
morse.dot(); morse.dot(); morse.dot();
morse.dash(); morse.dash(); morse.dash();
morse.dot(); morse.dot(); morse.dot();
delay(3000);
}
5.1.4.3 Morse.cpp
#include <Arduino.h>
#include "Morse.h"
Morse::Morse(int pin)
{
pinMode(pin, OUTPUT);
_pin = pin;
}
void Morse::dot()
{
digitalWrite(_pin, HIGH);
delay(250);
digitalWrite(_pin, LOW);
delay(250);
}
void Morse::dash()
{
digitalWrite(_pin, HIGH);
delay(1000);
digitalWrite(_pin, LOW);
delay(250);
}
Arduino Sketchs can be verified for correctness by clicking the Verify button in the main
toolbar.
Click the Verify button to verify
Active Sketch code
LiquidCrystal
SoftwareSerial
Servo
Stepper
EEPROM
KeyPad
The integrated Arduino Java projects are compiled using the VBB Hosted instance of a Java
compiler and the classfiles execute on the Arduino JVM development board
VBB
Java
Compiler
Arduino Java projects support only the java source file. To add a new java source file right
click the Java Source Project and select he Add New Java Source drop down menu to show
the Add Java Source Dialog
The Add New Java Source File menu allows you to add new source files to the project and
pops up a dialog to allow you to name or select the java source file to add.
When the Add New java Source File dialog appears it has a suggested Classname. To add you
a new file you can accept this name or rename it to your preferred name. The name must be
unique to the source code project which means there must not be another file of the same
name in the solution directory
5.2.2.3 3. Import
You might have source files you want to include in other directories. In this case you can
click the import button to open a file dialog to allow you to select a file to import into the
solution directory. Once imported the file will appear in the Solution Files list where you can
select it to include it in the project as per (2)
Once you have named a new file or selected an existing one click the OK button to add it to
the source project. If the file name you have selected is not unique you will receive the File
Already in Project message and the source file will not be added.
In the project manager view the Java Source Code Project appears with the list of the
source files it contains as a sub-tree member
You can select the Java Source Project as the currently selected design sheet by clicking the
title banner ( the normal blue title bar is hidden) or double clicking the Java Source Project
in the solution tree. Some functions such as copy/paste wont work as expected if the
currently selected design sheet is not the Java Source Project containing the source editor
you are working with.
By right clicking on a named Java Source Code Project in the Solution Tree the context
sensitive functions are shown
5.4.2 Delete
You can delete a java source file by right clicking on it in the Solution tree and clicking the
delete menu option
The Java Source file will be removed from the Solution and also deleted from the solution
directory
5.4.3 Rename
You can rename delete a java source file by right clicking on it in the Solution tree and
clicking the rename menu option
The in-tree editor will then become enabled where you can edit the new name of the file
When you click enter the name of the Tab source class name is also renamed but the class
Name in source is not renamed so you need to manual rename the source name. The name
of the source name and the class name should match up
There is no support for adding additional 3rd party libraries beyond those included in
Vbb4Arduino as the Java libraries must match up to the fixed Virtual Breadboard Runtime
Libraries (VbbRT)
5.4.5.2 Morse.java
import muvium.compatibility.arduino.*;
class MorseCode{
int _pin;
public MorseCode(int pin){
_pin = pin;
pinMode(pin, OUTPUT);
}
public void dot(){
digitalWrite(_pin, HIGH);
delay(250);
digitalWrite(_pin, LOW);
delay(250);
}
public void dash(){
digitalWrite(_pin, HIGH);
delay(1000);
digitalWrite(_pin, LOW);
delay(250);
}
morse.dot();
morse.dash();
morse.dot();
delay(3000);
}
}
However separate Java classes cannot access the Arduino macros and you need to pass the
Arduino base class to access the Arduino functions
To use separate java classes add addition Java source files to Source Project
MorseCode.java
import muvium.compatibility.arduino.*;
public class MorseCode{
int _pin;
Arduino _arduino;
Morse.java
import muvium.compatibility.arduino.*;
The Java Editor at Design Time has useful features typical of modern source editor
The editor understands the code is a java and highlights the java keywords such as import,
public, class , extends etc. This make the code more readable
The editor can also detect when a syntax error has occurred with the java language structure
and will highlight the syntax error with a red squiggle underscore to assist in locating and
correcting the syntax error.
This will popup a context sensitive context box based on youre the text entered so far.
You can navigate the suggestions box using the mouse or the {UP} and {DOWN} arrow keys
Pressing {TAB} or {ENTER} will choose the selected suggestion and enter the text. This is
useful for getting the exact syntax of a function based on its partial name
When you have entered a recognised function name when you type the ( you will receive
parameter suggestions to help complete the function
You can cut, copy and paste code sections in the Source Editor.
TIP: If the Java Source Editor Project is not the currently selected design sheet the
Cut/Copy/Paste functions wont work with the Source Editor.
Arduino Java code can be verified for correctness by clicking the Verify button in the main
toolbar. Errors are shown in the Errors Tab
Clicking the error in the Errors tab then the error line will be located and highlighted in
yellow
During runtime the Output tab shows the output of the standard output from the emulated
code
The Logic Analyser traces signal events for logic analysis of circuits useful for debugging. The
Logic Analyser works with Logic Probes that are placed onto Breadboard sheets and linked to
the Logic Analyser Instrument from the Instrument property of the LogicProbe.
Design Sheet The design sheet is a form which graphs signal events
Toolbar None
Toolbox None
The trace log is found in the instruments project context sub menu. Right click on the project
and select the Add Logic Analyser from the drop down context menu
The Logic Analyser doesnt have a default view location so wont appear until you drag it
from the Project tree into a view pane
The Probe list is initially empty when the circuit emulation is first run the probe list becomes
populated with a probe list and trigger elements for each probe.
1
2
3 4
Rising Edge Trigger occurs when signal moves from low to high
Falling Edge Trigger occurs when signal moves from high to low
A trigger is formed by AND the trigger elements together. For example the above trigger is
ISRISING(0) AND ISHIGH(0). The left hand edge of the view window is marked by the trigger
D0
D1
Trigger Events
View Window
The sampling control panels determines how signals are captured and viewed in the View
Window
2
4
5 3
6 7
1. Sampling LED
The sampling LED flashes when a trigger event occurs and a sample is made
2. TimeBase
The Timebase is the displayed time per view per horizontal grid in the View Window from
0.1 microsecond through to 1 second.
Adds an offset to the view window left or right from the trigger event so you can view
different parts of the signal in and around the trigger event
Offset = 0
Offset = ~+50% Shifts the left offset along to view the signal before the trigger
The Breadboard DesignSheet is a circuit emulation enabled drag and drop design sheet.
The graphics toolbar allows the manipulation of the Breadboard graphics, components and
links.
Move Mode Enters move Mode. The cursor becomes a NSEW pointer.
In move mode you can drag and drop component to new
location .
Link Mode Enters link Mode. The cursor becomes a cross-hair and
you can draw links between component pins.
Lock origin Lock the origin when zooming. When locked the offsets
dont change only the zoom factor. When not locked the
offset changes to keep the center of the screen fixed
Click the Pan button to enter Pan mode. When over the
Breadboard layout the cursor will change into a Hand
Zoom graphic. Click and hold the mouse down and then
drag the display to pan around. Stays in Pan mode until
another graphic mode is selected
Link Color Set the link color. Sets the currently selected links to the
selected color. Future links will be created with the new
color.
Link Weight Set the link width. Sets the currently selected links to the
selected weight. Future links will be created with the new
weight.
Show Nets Show the virtual nets between named nets in the circuit
board.
The snap to grid has a problem when the zoom factor is not a multiple of 2. You should not
try to select links or draw links at arbitary zoom factors. The zoom, zoom extents, zoom
region are best used to inspect the design and select components but you should restore the
origin and use the zoom in, zoom out when drawing links to ensure the zoom is a multiple of
2.
Placing a component is an important skill not quite drag and drop. You need to click on the
Toolbox icon releasing the mouse button. This attaches the component to the mouse
pointer when you move over the Breadboard design. You can then drag the component into
position in the DesignSheet and click a second time to place the component.
Placing a component
Select a component
Placing a component is an important skill not quite drag and drop. You need to click on the
Toolbox icon releasing the mouse button. This attaches the component to the mouse
pointer when you move over the DesignSheet. You can then drag the component into
position in the DesignSheet and click a second time to place the component.
To select a component enter Select Mode and left click on the component
Selection Box
Draw a window with a Left Click to anchor the window, and holding down the mouse button
drag out a window.
Release the mouse to select the components fully inside the window.
Append a component to a selection by holding shift and left clicking the component.
Shift + Left Button drag and drop or Right button drag and drop.
OR Right Click-and-hold
To increase density of certain parts of a graphical design it can be useful to scale down a
component or group of components. Equally it is useful to be able to restore the size of the
components and scale components back up.
Note: Links overlayed over each other are not considered a single link
Net Labels allow connections to be made between pins by using a name instead of a wire.
This can be used to better organise the connection layout.
The Net Toolbar option is used to place nets and features some helper options to add nets
5.7.11.2.1 New
New is the standard option to add a new net. When you add a new net it is placed with the
Name new. You can edit the name by clicking the net name and editing the name in the
property box
You can also select a net from the drop-down list in the property box. The dropdown list
contains the names of all the nets currently on the Breadboard.
5.7.11.2.2 AutoInc
The AutoInc dropdown option has a further sub dropdown menu which allows you to select
a net using the common prefixes ( R = Resistor, C = Capacitor, L = Inductor , U = Integrated
Circuit )
When you select form the submenu the net will be named +1 to the current highest net
name. So for example if you have R1,R2,R2 on your breadboard already and you select R*
then the net will be named R3.
5.7.11.2.3 DX / AX
The V18O, Arduino and others have a naming convention for digitial pins of D0, D1, D2 ..
and Analog Pin A0,A1,.. These nets are also automatically added when using the V18O,
Arduino components so these are very commonly used net names. The AX and DX submenus
gives you a shortcut for selecting these names.
All the current nets on the Breadboard are listed below the toolbar separator giving a
shortcut to select a matching net for a net to be placed.
Nets can be
You can view the links between the nets using the ShowLinks button. When you click the
button it will show the links. It is a state button and when you unselect the button it will hide
the links again.
To show a specific net link you can select a member of the net and click to ShowLinks button
If you select members of more than one net then the links belonging to all the selected nets
will be shown.
Arduino footprint boards have predefined nets associated with the pins
By default the nets for these on but you can switch off the default nets using the
components Nets property
Components are layered , you move components up and down the layering using the
context menu.
Select the component and press right click to start the context menu.
The context menu contains an option for locking components. Select the component,
right click to bring up the context menu and click Lock Control to lock the component. A
locked component cannot be accidentally moved.
The Breadboard Toolbox is the most important Toolbox to VBB as it contains the component
models that constitute the circuits
6 Breadboard Components
Important! VBB does not support analog circuit simulation like SPICE. Sorry but VBB just
doesnt work that way. Instead VBB is a circuit modelling tool with a focus on the application
code and uses simplified electronic models to virtualize the electronics. Nevertheless a huge
number of circuits can be modelled this way especially if you take the time to learn a few
VBB tricks.
These can be used in combination in a circuit but only the sections of the circuit that contain
Component Models will virtualize. In addition, there is a special function block component
which is a user programmable way to model the behaviour of many common circuit blocks.
The concept of the function block is the observation that in many cases electronic designs
are simply copy and pasted again and again by designers who rely only on the behaviour of
the circuit design and really dont care about the circuit itself.
Why resolve the entire analog behaviour of a circuit block which performs a
known fixed function?
Why not just take a picture of the circuit block and attach a FunctionBlock that models the
same circuit behaviour. That is the philosophy of VBB and for many circuits relevant to
Arduino users its a good first approximation. Of course you need to learn a bit about
modelling circuit blocks instead of hoping VBB will figure it all out for you. There are some
packages out there that do that but then you loose the advantages of circuit modelling such
as performance and ease of design do you really want to have to fully understand
electronic design, select every resistor and capacitor value exactly before you even begin the
fun stuff of virtualizing and programming? Didnt think so ! ..
Layout Components are generic graphics only components and will not emulate. However
when used in combination with a function block they can appear to emulate. These
components are parametric models of the common hole-through components. Layout
components help you create a circuit board which can be fabricated by our PCB service or as
a guide when assembling a real circuit board even where specific components models are
not available.
Axial
Radial
Breadboards are useful because they have pin sockets that match the spacing of the
standard DIP packaging of electronic circuits. The Generic DIP component allows you to
easily create a DIP component package.
7.3 Parametric
The DIP component is parametric so you can create any DIP by setting the component
properties accordingly.
Pin = PinCount
Spacing
Pin = 1
Pin Names
Library
Property Description
Part Logo An optional logo that is shown center of the package. Uses magenta
for transparent color
Spacing The size of the spacing between pins in hundreds of mil typically 3
or 5
Pin Names A CSV(comma separated array) of names starting from pin 1 to pin pin
pinCount of the pins labels. This is shown as an overlay as a form of
schematic for the part
When you first place a Generic DIP the properties are blank. You can enter your own values
or select from the library. To use the library
5. Click OK
This sets the properties for the component creating the component.
You can add virtualization to a generic component footprint by marking it up with one or
more function blocks.
Select a 4081 Quad 2-input AND gate using the generic library
Referring to the 4081 datasheet or by inspection of the pins on the top of the DIP
component we want to assign the function block the pin logic of the 4081
The easiest way to do this is to use the netlist. From the properties of the 4081 copy the pin
names over to the netlist field to assign pin names to the known pin positions
Now in the function block properties copy over the relevant net names to the match the
input and outputs. Conveniently in this example they are aligned at pin 1,2,3 so its just a
matter of copying over the first 3 net names from the 4081 to the function block
Finally assign the Expression AND(P1,P2) to create an AND gate from pins 1 and 2 with the
output on pin 3, which is how the 4081 is specified
You can preview the virtual links using the show links and functionblocks options
At runtime you can hide the links and function block to make it appear the 4081 generic
component footprint is virtualized
Generic Radial component can be used to model components with a 2 pin Radial
configuration for which there is no matching visual component.
Diameter
Pin 1
Color
Pin Spacing
7.5.2 Properties
Property Description
Generic Axial component can be used to model components with a 2 pin Axial configuration
for which there is no matching visual component.
Length
Diameter
Pin 1
Pin Spacing
Color
7.6.2 Properties
Property Description
Generic Radial component can be used to model all different header configurations.
Rows
Pins
Vbb4Arduino User Manual www.virtualbreadboard.com V5.54
89
Generic male header component can be used to model many different header
configurations.
Rows
Pins
Name Default Options Description
Generic male header component can be used to model many different header
configurations.
Rows
Pins
Name Default Options Description
Color Black Black | Blue | Red Color of the hosing. Black Blue
Red only.
Generic male header component can be used to model many different header
configurations.
Seperation = 2
Seperation = 1
Pins
VBB has some special circuit model components which can be used to model or mock many
different types of circuits relevant to the Arduino user.
Function Blocks are programmable logic blocks that can overlay circuits to mock
circuit behaviour y
Resistors are modelled either as a fuse or an open-circuit
Capacitors are modelled as an open-circuit.
Diodes are modelled as switched pull-up or switched pull-down resistor.
NPN Transistors are modelled as a switch which turns on when the base voltage is
HIGH
PNP Transistors are modelled as a switch which turns on when the base voltage is
LOW
The Function Block is a powerful circuit modelling block and can be used in Co-Virtualization
of many different circuits.
When the function block is used in combination with generic layouts there is special support
to hide the function block to make it looks like the circuit block is virtualizing. Its a type of
component development kit.
The purpose of the Function Block component is to model certain circuit behaviour not
directly supported by VBB.
Property Description
Inputs The number of inputs. When this value changes the Function Block
diagram will automatically resize.
netlist A CSV list of nets I1,I2..,IN,O which map to the input pin array and
output pin. Use the netlist to add FunctionBlocks without wiring
The function block expression calculates an output voltage based on its input pins. It
works in a similar way to an Excel function.
= (1 , 2 , . . , )
For example
When used the Function Block graphic will change to reflect the names for the input
pins
8.1.1.1.1 Summer Concept Example
A voltage summer is a circuit function thats sums two or more voltage inputs.
However there are other ways to sum voltages such as by using digital sampling.
The focus of VBB is on equivalent circuits so it doesn't matter how the circuit
implements a voltage adder VBB can model it using a function block.
To create a voltage summer you use the ADD function in the function block
expression.
You could use a function block alongside Generic components in a VBB circuit and it
would work the same and look the same as if its behaviour we evolved from the
discrete circuit elements the way SPICE does it but the end result is the same.
Logic Functions ::= AND, OR, XOR, NOT, NAND, NOR, XNOR
Math Functions ::= ABSDIFF, ADD, CEN, CONST, CSIGN, DIV, GT, IF, LT,
MAP, MIN, MUL, NEG, RANGE, SIGN, SUB
Pins
PN return a value 0 for logic level GND and 1 for Vdd which is nominally 5V
Pin Functions:
Logic Functions:
NOR(F1,F2,...,FN): Returns 1 if no FN is 1
NOT(F1): Return 1 if F1 is 0
Math Functions:
MIN(FA,FB,..,FN) : returns the lowest value in the parameter list FA,.. ,FN
MAX(FA,FB,..,FN) : returns the highest value in the parameter list FA,.. ,FN
NEG( FA ) : Evaluates FA
Special Functions
PULSIN( FA ): Measure the time in seconds of a pulse where the time is measured
between the rising and falling edge
PWM (FA ): Digital to Analog converter using the PWM pulse duty on FA to create
an analog value between 0 and 1
PWM(FA,FB): Digital to Analog converter using the PWM pulse duty on Differential
FA - FB to create an analog value between 0 and 1
VOLTS (FA) : Converts the result of FA into a volts value by dividing by the nominal voltage
value of 5.
The first trick is to set the resistor is open-circuit mode. This means the resistor is just
a picture and its value is not used in the resulting circuit behaviour.
The output of the momentary button is the input to the function block and it has two
values. O/C open-circuit when the switch is off and 0.0 ground when the switch is on.
ISLOW(P1) returns 1 when the voltage at P1 is LOW = 0.0 and otherwise it returns 1.
However the output of the function block needs to invert this which can be done with
an NOT or IF
IF(ISLOW(P1),VOLTS(1.6),1)
IF(ISLOW(P1),VOLTS(1.6),1)
So for resistors 2K and 950Ohm with 5V rail we can derive the output we expect when the
button is pressed to be V = ( 950 ) ( 2K + 950) x 5 ~= 1.6V
IF(ISLOW(P1),VOLTS(1.6),1)
If the button is pressed P1 becomes 0.0 so ISLOW is true and becomes 1 which IF evaluates
and returns the first term VOLTS(1.6). VOLTS is a function that converts 1.6 volts into the
nominal range which is 5V by default so VOLTS(1.6) return ( 1.6 / 5 ).
If the button is not pressed P1 is O/C is ISLOW is false and becomes 0 which IF evaluates as
false returns the second term 1 which is nominally HIGH or 5V
If your microcontroller doesn't have many spare pins it can be useful to decode multiple
buttons using a single analog pin.
The way you can do this is to use the principle of Voltage Division to create different voltage
levels depending on the button pressed. This voltage can then be read as an anolog value
and compared with calculated values to decode the button pressed.
MIN
IF(ISLOW(P1),VOLTS(0),1)
IF(ISLOW(P2),VOLTS(0.7),1)
IF(ISLOW(P3),VOLTS(1.6),1)
IF(ISLOW(P4),VOLTS(2.45),1)
IF(ISLOW(P5),VOLTS(3.7),1)
To model this circuit block what we end up with is a FunctionBlock that merges the 5
buttons
It is intended that FunctionBlocks can be hidden behind the scenes and a good way to
do that and keep the circuit models organised is to use Net Labels and netlists. You
can see in the example the net labels on each button and these labels are matched by
the netlist names of the FunctionBlock.
TIP: The hidden links are shown as the Jade coloured lines and the FunctionBlock is
visible these can be toggled visible or hidden using the toolbar netlist toggle buttons
The expression uses the MIN function to select the minimum voltage from the
switched button dividers created by the 5 separate buttons which gives us the final
expression.
MIN
(
IF(ISLOW(P1),VOLTS(0),1)
IF(ISLOW(P2),VOLTS(0.7),1)
IF(ISLOW(P3),VOLTS(1.6),1)
IF(ISLOW(P4),VOLTS(2.45),1)
IF(ISLOW(P5),VOLTS(3.7),1)
)
One difference to the original schematic is the use of the protection resistor to the
ADC output of the function block. This is used actually as a trick to separate the
output of the topmost right button to the output of the function block. Without it VBB
would signal a short circuit but it's a useful circuit addition that doesn't change the
voltage output.
Virtualization
Practical Application
VBB is primarily about firmware development support so it's only important that the circuit
model behaves like the real circuit does from the point of view of the microcontroller
application code.
int x;
x = analogRead(0);
lcd.setCursor(10, 1);
if (x < 60) {
lcd.print("Right ");
} else if (x < 200) {
lcd.print("Up ");
} else if (x < 400){
lcd.print("Down ");
} else if (x < 600){
lcd.print("Left ");
} else if (x < 800){
lcd.print("Select");
}else{
lcd.print("None ");
}
As you can see the microcontroller decoder code can't tell the difference and
the decoder code works just the same as it does in real world.
So to sum up. Use VBB function blocks to model circuit behaviour such that
the microcontroller code can't tell the difference between the virtual model or a real
circuit. Then you can happily develop and test your application virtually before committing
to hardware.
8.4.3 Resistors
Generic resistor component models the standard axial resistor with parametric spacing and
resistance color bands.
Pin Spacing
Property Description
8.4.4 Resistors
Resistors have three modes which can be selected from the Function property of the resistor.
fuse ( Default )
wire
Pullup
Pulldown
open-circuit ( Document
As a polyfuse when a resistor is open circuit on end of the resistor by the other end is 5V
then the polyfuse is a wire and the other side of the resistor sees the 5V
When one end is 5V and other end is 0V, a short-circuit, the polyfuse breaks and an open-
circuit is created
8.5 Diode
Generic diode component models the standard axial diode with parametric spacing.
Pin Spacing
8.5.2 Properties
Property Description
8.5.3 Diodes
Diodes are modelled as switched pull-up or switched pull-down resistor.
There are lots of other circuit tricks that use diode non-linearity and other diode characteristics.
These wont work in VBB and require the use of document mode and functionblocks
PNP Transistors are modelled as a switch which turns on when the base voltage is LOW
8.6.1 Properties:
ID,Netlist
8.6.2 Useage
Switch connects the PNP B base to ground ( through the base resistor ) causing it to active
its internal switch connecting (E)mmitter to (C)collector which connects the anode(+) of the
LED to the 5V rail causing it to flash on.
Switch connects the PNP B base to Open Circuit ( through the base resistor ) causing it to
disconnect its internal switch connecting (E)mmitter to (C)collector which disconnects the
anode(+) of the LED from the 5V rail causing it to flash off
NPN Transistors are modelled as a switch which turns on when the base voltage is HIGH
8.7.1 Properties:
ID,Netlist
8.7.2 Useage
Switch connects the NPN B base to Vcc(5V) ( through the base resistor ) causing it to active
its internal switch connecting (E)mmitter to (C)collector which connects the anode(+) of the
LED to the 5V rail causing it to flash on.
Switch connects the NPN B base to Open Circuit ( through the base resistor ) causing it to
disconnect its internal switch connecting (E)mmitter to (C)collector which disconnects the
anode(+) of the LED from the 5V rail causing it to flash off
8.8.1 Properties
Property Description
9 Microcontroller Components
The microcontroller components are the Arduino Twins Em and SIM. Em runs the java code
in a java virtual machine. SIM runs AtMega328 instruction set simulator and executes the
compiled Arduino binary code.
9.1 Arduino EM
9.1.1 Pinout
3 2 Digital 2
5 4 Digital 4
8 7 Digital 7
9 8 Digital 8
13 12 Digital 12
14 13 Digital 13
15 A0 Analog 0
16 A1 Analog 1
17 A2 Analog 2
18 A3 Analog 3
19 A4 Analog 4
20 A5 Analog 5
9.1.2 Properties
Application Dynamic List of The name of the source code project to pull the
Source Code Project code from when virtualizing
Eeprom size 512 512 | 1024 | 2048 | The size of the internal eeprom
4096
Application
There can be more than one source code project. You might for example have different test
configurations for a single hardware layout. You can choose the application to run by
selecting it from the dropdown list
9.1.3 EEPROM
The EEPROM is the internal device EEPROM. It is a persistent store which persists between
runtime sessions. The size of the eeprom is set by the eeprom size property which can be
changed to align with the different physical devices implementing the Arduino EM device.
You can inspect the contents of the EEPROM, edit the contents, save and load the contents
from the EEPROM editor.
Launch the editor by selecting the eeprom property and clicking the custom editor button
The edit can use a fix file as a ROM by using the [x] use file checkbox and browsing to a file.
The file uses the microchip eeprom image MCH format which is just a file with one 2 digit
hex byte entry per line.
The EEPROM values are saved as a CSV array in the property and the contents are updated
at runtime so carry over between power on sessions
The s
The Arduino SIM is an AVR ATMega328 instruction set simulator. It an execute the binaries
generated by the Arduino IDE.
3 2 Digital 2
5 4 Digital 4
8 7 Digital 7
9 8 Digital 8
13 12 Digital 12
14 13 Digital 13
15 A0 Analog 0
16 A1 Analog 1
17 A2 Analog 2
18 A3 Analog 3
19 A4 Analog 4
20 A5 Analog 5
Application HEX File | The name of the source code project to pull
the code from when virtualizing
Arduino IDE Monitor |
Booloader VbbIO |
Clock 16Mhz 16Mhz | 8Mhz | 4Mhz The clock speed of the microcontroller. This
| 2Mhz | 1 Mhz is used for timing calculations. A lower
clock setting can increase the speed of the
simulation
So for example if you have created a new project called BlinkSim then the Arduino file
should also be called BlinkSim.ino
When starting in Arduino IDE Monitor mode the Arduino IDE will launch a new session with
this BlinkSim.ino file loaded and will start monitoring the project directory for new HEX files.
To load a new HEX file you should use theArduino IDE Tools->Export Compiled Binary option
to generate a new HEX file in the project directory
11 IO Components
UserIO components dont match directly to physical devices but they provide common
functions useful for quickly modelling and testing a circuit.
The DIP component is an N array of DIP switches which are connected to 5V when Switch =
ON and 0V (GND) when Switch = OFF. DIPS are an interactive component. Clicking on the
DIP switch, the white square region, toggles the value of the switch. The SETTINGS property
is an N Binary string representing the values of each of the DIP switches. Clicking the respective
DIP switch will change the value of SETTINGS, alternatively the value can be directly edited in
the SETTINGS property textbox.
DIP1
DIP4
DIP8
11.1.1 Pinout
N OUTPUT[N] DIP Output. Nth Pin is 5V if the Nth switch is ON. Nth Pin
is 0V GND if the Nth switch is OFF
11.1.2 Properties
OnState HIGH HIGH | LOW The value of the DIP output when in
the ON state. Either driven HIGH or
driven LOW when the DIP is on ON
Pins Bottom Top | Bottom The pins are rendered either on the
Top or Bottom of the DIP body as per
this setting
11.1.3 Usage
11.2 LEDN
The LED component is an N array of Light Emitting Diode (LED) indicators. The Nth LED is ON
when the Nth input pin is driven by greater than 2.5V otherwise the LED is OFF. The color of
the LED is determined by the COLOR property. When the LED is ON the LED color is lighter
than when OFF giving a visual clue to voltage level at the LED input pin. LEDs are a
fundamental indicator of circuit status.
LED1
LED4
LED8
11.2.1 Pinout
N INPUT[2N] LED Input pins. Nth LED is ON when the Nth INPUT pin is
> 2.5V else is OFF
11.2.2 Properties
COLOR RED RED | GREEN | BLUE Color of LED. LED is lighter when
| YELLOW ON than OFF giving a visual clue
to the status of the LED.
11.2.3 Usage
11.3 DotMatrixLED8x8
The DotMatrixLED8x8 component is a Dot Matrix LED array. The array consists of 8 Rows
and 8 Columsn. Each Row Anode pin drives 8 LEDS each attached to one of the cathode
column pins.
http://sigma.octopart.com/140413/datasheet/Lumex-LDM-24488NI.pdf
DotMatrixLED8x8
By switching quickly between each row and using the persistence of vision effect a each dot
in the matrix can be individually addressed. To emulate the persistence of vision effect VBB
only changes the state of the LED when COL is LOW. In this way the COL pin becomes like a
latch operation which latches the value of LED.
11.3.1 Pinout
Cols Col 0..7 Column Cathode pins of the Dot Matrix array.
Rows Row 0..7 Row Anode pins of the Dot Matrix array
11.3.2 Properties
COLOR RED RED | GREEN Color of LED in the array. The default
| BLUE | color is red. The options are
YELLOW red,green,blue and yellow but you can
also type in any named color
11.4 Usage
11.5 JUMPN
The JUMPER component is an N array of switches which form a short circuit between the
Nth input/output pin pair when the Nth Switch = ON and open-circuit O/C when Nth Switch
= OFF. JUMPERS are an interactive component. Clicking on the JUMPER switch, the white
square region, toggles the value of the JUMPER switch. The SETTINGS property is an N Binary
string representing the values of each of the JUMPER switches. Clicking the respective
JUMPER switch will change the value of SETTINGS. Alternatively the value can be directly
edited in the SETTINGS property textbox.
JUMP1
JUMP4
JUMP8
11.5.1 Pinout
11.5.2 Properties
11.5.3 Usage
11.6 NumericKeyPad
The KEYPAD4x4 component consists of a Col x Row array of touch switches. The KEYPAD
has column connect pins (C1,C2,..Cols-1) and row pins (R1,R2,..Rows-1). Each switch is
connected to one column and one row connection pin such that each (row, column) combination
is unique for each switch. The appearance of the KEYPAD component is determined by the
KEYMASK property which contains a string of the key characters used on the key faces. The
currently activated switch is determined by the KEYON property where KEYON = 0 when no
switch is connected and KEYON = 1 to (Cols*Rows) when a valid switch is activated. KEYPAD
is a user interactive component. Clicking on individual keys will activate the switch for that key.
When active the background of the key becomes light green in color giving a visual clue to the
state of the key. Only one switch can be active at any one time. Clicking on the currently active
switch will toggle the switch to off resulting in no key being selected and KEYON = 0. When a
key is on its switch becomes active creating a short-circuit across the unique row, column
connection pin combination for that key.
NumericKeyPad
Rows=4
Cols = 4
11.6.1 Pinout
11.6.2 Properties
11.6.3 Usage
The switch is connected by pressing a key joining a column and a row. Typically the user
scans all columns and row combinations to detect the keypress
11.7 Seg7
The SEG7 component is a 7-Segment Display module, which consists of a versatile array of
LEDS which can be sequenced to form numbers and a limited form of alphanumeric
character. 8 LEDS A, B, C, D, E, F, G, PT are physically arranged on the 7-Segment device. A
LED Segment is ON when 5V HIGH is applies its corresponding input pin an is OFF when 0V
LOW is applied. When the appropriate patterns are applied to the inputs, 7-Segment display
modules are able to display numbers and ASCII characters.
11.7.1 Pinout
11.7.2 Properties
11.7.3 Usage
F
B
G
E C
PT
D
Vbb4Arduino User Manual www.virtualbreadboard.com V5.54
134
Char A B C D E F G PT HEX
0 1 1 1 1 1 1 0 0 FC
1 0 1 1 0 0 0 0 0 60
2 1 1 0 1 1 0 1 0 DA
3 1 1 1 1 0 0 1 0 F2
4 0 1 1 0 0 1 1 0 66
5 1 0 1 1 0 1 1 0 B6
6 1 0 1 1 1 1 1 0 BE
7 1 1 1 0 0 1 0 0 E4
8 1 1 1 1 1 1 1 0 FE
9 1 1 1 1 0 1 1 0 F6
A 1 1 1 0 1 1 1 0 EE
B 0 0 1 1 1 1 1 0 3E
C 1 0 0 1 1 1 0 0 9C
D 0 1 1 1 1 0 1 0 7A
E 1 0 0 1 1 1 1 0 9E
F 1 0 0 0 1 1 1 0 8E
G 1 0 1 1 1 1 0 0 BC
H 0 1 1 0 1 1 1 0 6E
I 0 1 1 0 0 0 0 0 60
J 0 1 1 1 1 0 0 0 78
K 0 1 0 1 1 1 1 0 5E
L 0 0 0 0 1 1 0 0 06
M 1 0 1 0 1 0 1 0 M
N 0 0 1 0 1 0 1 0 N
O 0 0 1 1 1 0 1 0 O
P 1 1 0 0 1 1 1 0 P
Q 1 1 1 0 0 1 1 0 Q
R 0 0 0 0 1 0 1 0 R
S 1 0 1 1 0 1 1 0 S
T 1 0 0 0 1 1 0 0 8C
U 0 1 1 1 1 1 0 0 7C
V 0 1 1 1 1 1 1 0 7E
W 1 1 0 1 1 0 0 0 D8
X 0 0 0 0 1 1 1 0 07
Y 0 1 1 1 0 1 1 0 76
Z 1 0 0 1 0 0 1 0 92
. 0 0 0 0 0 0 0 1 01
+ 0 1 1 0 0 0 1 0 62
- 0 0 0 0 0 0 1 0 02
( 0 0 0 1 1 0 1 0 1A
) 0 0 1 1 0 0 1 0 32
_ 0 0 0 1 0 0 0 0 10
SPACE 0 0 0 0 0 0 0 0 00
11.8 DigitalPort
The DigitalPort Component is an instrument which displays the decimal value of the binary
value represented by its input pins
DigitalPort
11.8.1 Pinout
11.9 Properties
Name Default Options Description
11.9.1 Usage
11.10 PushButton
The Button component is an interactive switch. Clicking the color panel of the button toggles
the value of the POSITION property. The contact type determines the circuit made when the
POSITION is ON or OFF. The color of the button is determined by the COLOR property. When
POSITION = ON the color is set by ColorOn property and when POSITION =OFF the color is
set byt the ColorOff property. When these colors are not the same the color can be used as a
visual clue to the state of the button.
Vdd Vdd
2.On 2.Off
Vdd Vdd
3.On 3.Off
4.On 4.Off
Vdd Vdd
5.On 5.Off
6.On 6.Off
11.10.1 Pinout
11.10.2 Properties
3. Make VDD
4. Make GND
5. Break VDD
6. Break GND
11.11 Usage
Not you can change the size of the buttons using the Scale Up
11.12 Switch
The Switch component is an interactive switch. Clicking the switch image toggles the value of
the POSITION property. When POSITION = ON a short circuit is present across the IO pins.
When POSITION = OFF there is an open-circuit across the IO pins. To give a visual clue to the
state of the switch, when POSITION = ON the switch lever in the ON Position or the Bitmap
On is shown and when POSITION = OFF the switch lever in the OFF position or Bitmap Off is
shown.
ToggleSwitch
11.12.1 Pinout
11.12.2 Properties
Bitmap Off FileDialog for Bitmap If set use this Bitmap in the Off
.png | .bmp position
11.12.3 Usage
11.13 PanelMeter
The PanelMeter is a Voltage Meter Instrument with a dial representation of the voltage on
its input pin between Vss(left) and Vdd(right) The Panel Meter has the equivalent of a LOW
PASS filter on the input pin so can display voltage levels for both absolute voltage levels and
PWM equivalent analog voltages
11.13.1 Pinout
11.13.2 Properties
11.13.3 Usage
11.14 SlidePot
The SlidePOT (potentiometer) is a variable voltage divider and consists of two inputs and a single
output. The OUTPUT voltage is determined by the input voltages and the value of the POSITION
property where OUTPUT = (POSITION x VINA) + ((1 POSITION) x VINB). Where Property POSITION has
a valid range from range from [0..1]. POT is an interactive component. Clicking on POT will set the
POSITION property. Clicking on the far left of the POT component corresponds to position 0. Clicking
on the far right of the POT component corresponds to position 1. Clicking in-between the left and
right will set the POT to a position linearly between 0,1. The POSITION property can also be set using
the property editor. You can also drag the POT Knob with the mouse to continuously change the
value.
11.14.1 Pinout
11.14.2 Properties
11.14.3 Usage
11.15 RotaryPot
The RotaryPOT (potentiometer) is a variable voltage divider connected between Vdd and Vss with a
single output. The OUTPUT voltage is determined by the rotation position where OUTPUT = Vdd x
(POSITION / Positions ). To rotate the POT you use the mouse to drag the rotation dial.
11.15.1 Pinout
11.15.2 Properties
11.16 Usage
11.17 JoyStick
The JoyStick component is a model of a regular PC JoyStick with 2 potentiometers on the X and Y axis
and button with a pullup resistor. Move the mouse over the keypad to move the JoyStick in X, Y and
click the mouse to press the button pulling the button output to ground.
11.17.1 Pinout
11.17.2 Properties
None
11.17.3 Usage
11.18 MiniTerminal
The mini terminal is a RS232 terminal which can send a receive asynchronous UART communications
at TTL levels ie Vdd to Vcc at BAUD. Click on the Green screen segment and type to send messages.
When pressing ENTER the characters set in the Enter property are sent. Communications is standard
8,N,1
StartBit Bi Bi Bi Bi Bi Bi Bi Bi StopBit
t0 t1 t2 t3 t4 t5 t6 t7
11.18.1 Pinout
11.18.2 Properties
BAUD 9600 2400 | 9600 | 19200 | The baud rate of the communications
57600 | 115200
Enter LF(13) CR(10)|LF(13)|CR(10)+LF The characters sent when pressing the enter key
(13)
11.18.3 Usage
12 Breadboardable Components
Breadboardable components are components that have both virtualization functionality and
match up with real components so when you layout a circuit with Breadboardable
components it becomes a makeable circuit.
12.1 LiquidCrystal
The LiquidCrystal component is a model of a 2 line HD44780 Liquid Crystal Display
Supports HD44780 emulation in 4-bit mode..
Fonts: If available the HD44780 font is used else the default is used.
Limitations
12.1.1 Properties
12.1.1 Usage
12.2.1 Description
The Light Dependent Resistor, (LDR), is a useful photonic sensor that converts light into a
difference in resistance. Of course in a virtual environment you cant actually change the
light so a way is needed to vary the resistance. This is done by the LDR slider widget which
you can slide from left to right to model the way light is varied.
Normally a LDR forms a voltage divider and the variable resistance causes the voltage at the
voltage divider tap to vary. The LDR models this by being a variable voltage source in the
range MINVOLT to MAXVOLT as set by the properties.
12.2.2 Properties
12.2.3 Usage
A voltage divider is formed with the resistor. By dragging the LDR widget different light
conditions are simulated resulting in different output voltage levels.
12.1 Relay
The relay is a common configuration for a solenoid relay. A relay uses a smaller powered
solenoid to mechanically switch a high current circuit. Relays are useful for driving higher
voltage and current systems. When the solenoid circuit is powered the switch changes
position connecting the alternate path.
1 4 3a
2 5 3b
12.1.1 Pins
12.1.2 Properties
Common Properties only
12.1.3 Usage
Relays are used to drive larger loads, typically mechanical loads such as larger solenoids. In
this example you can see two solenoids are driven by a 12V supply to ground via the Relay.
You can also visualise the action of the relay with the small switch internal to the relay
12.2 Solenoid
The solenoid is a mechanical actuator that when a sufficient current passes from PWR to
GND pint the centre rod actuates. Solenoids are useful for many different mechanisms such
as locking.
1 2
12.2.1 Pins
Properties
Common Properties only
12.2.2 Usage
The solenoid actives when it is driven otherwise it is in the retracted position
12.1 Trimmer
The trimmer is a voltage divider potentiometer in the common 3 leg tripod configuration
with an adjustable centre. Dragging the trimmer dial changes the position of the center tap
and hence changes the value of the resistor proportions of the voltage divider changing the
output voltage proportionally to the rotation position.
The position of the dial is persisted when saved and restored on open and run.
3 Drag Dial to
rotate
1 2
12.1.1 Pins
12.1.2 Usage
12.2 Potentiometer
The potentiometer is a voltage divider potentiometer in the common 3 inline pins
configuration with an adjustable centre. Dragging the dial changes the position of the centre
tap and hence changes the value of the resistor proportions of the voltage divider changing
the output voltage proportionally to the rotation position.
The position of the dial is persisted when saved and restored on open and run.
1 2 3
12.2.1 Pins
12.2.2 Usage
12.3 Segment7
The Segment7 is a Breadboardable version of the Segment7 from the user IO segment 7
10 9 8 7 6
1 2 3 4 5
12.3.1 Pins
4 c
5 pt
6 B
7 a
9 F
10 g
12.3.2 Usage
Setting the common cathode pins to ground you can create different numbers by powering
the individual segment pins
12.4 Buzzer
The Buzzer component is an audio component that converts frequencies into audio.
Commonly used with tone() or a 555 square wave source.
1 2
12.4.1 Pins
2 GND ground
12.4.2 Usage
When used with a frequency source changing the frequency will change the audio tone
heard for feedback
1 2 3
12.5.1 Pins
1 Sig Analog signal between proportion to the distance to the object. The
proportion is not linear in the real world sensor and requires
calibration tables for some applications
2 GND Ground
3 PWR Power at 5V
12.5.2 Usage
By dragging the widget the sensor simulates proximity which can be visualized by the
changing size of the tree which represents how close or far the sensor is from the tree.
Plotted over time you can generate signals that a robot might see as it approaches and
moves away from a wall
555 Timer IC
The 555 is a versatile chip used in a huge variety of timing, pulse generating and
oscillator applications. Although modern microcontrollers have provided alternative
ways to implement some of these type of circuits the 555 remains an invaluable
part of any tinkerers toolbox.
There are two basic circuit configurations used by the 555 to create distinct
functions
AStable - in this mode the 555 operates as an oscillator. Uses include LED and
lamp flashers, pulse generation, logic clocks, tone generation and so on.
Monostable - in this mode the 555 operates as a triggered pulse generator. Uses
include include timers, pulse detection, debouncing, pulse generation and so on.
12.6 Astable
In astable mode, the 555 timer puts out a continuous stream of rectangular pulses
having a specified frequency.
The frequency depends on the values of R1, R2 and C in the above schematic.
There are plenty of articles covering the theory of the AStable 555 operation
( WIKIPEDIA is a good place to start ) so I am not going to reproduce that here.
Instead I am going to show you how to use VirtualBreadboard (VBB) to calculate
these values for you and show you how to view the resulting output signal.
If you zoom into the VBB 555 component you will see the pins are labelled with the
schematic labels. So the Breadboard is a hybrid schematic and Breadboard layout.
This makes it easier to wire up a schematic as a Breadboard layout.
TIP: You can use 'Import from Clipboard' to Load this project directly into VBB. See
'ASTABLE PROJECT' in the Source Code section below.
C
R1-STABLE
R2-ASTABLE
C-MONOSTABLE
Calculator
To make the 555 generate emulate a astable frequency generator you need to set
the values of C,R1,R2 to match the component ID values of the corresponding
circuit elements. This will set the value of the calculate property to ASTABLE(..).
Click the calculate property and then click the edit button to open the custom
calculator dialog
Enter the target frequency or period and click calculate
Select your preferred C,R1,R2 values and click OK
12.10 Monostable
In monostable mode, the 555 timer puts out a triggered 'one shot' pulse.
The duration of the pulse depends on the value of R and C in the above schematic.
TIP: You can use 'Import from Clipboard' to Load this project directly into VBB. See
'MONOSTABLE PROJECT' in the Source Code section below.
12.11 Calculating the values for Monostable
To make the 555 generate emulate a monostable pulse generator you need to set
the values of C and R to match the component ID values of the corresponding
circuit elements. This will set the value of the Calculate property as MONO(..)
To use the calculator
Click the calculate property and then click the edit button to open the custom
calculator dialog
Enter the target pulse period and click calculate
Select your preferred C and R values and click OK.
There are two types of components. Signal level components and API components. A signal
level component such as Liquid Crystal is modelled based on the signals it receives at its
pins. This requires implementing the underlying timing specification of the component.
API components are components that only virtualize when driven via the Java API. The
wiring of the component only links the component to the microcontroller. The actual
communication to the device is done in an Abstract communications channel. This makes it
easier to implement the component virtualization but requires the use of the API to make it
work.
13.1 WS2812
The WS2812 is a smart 3 color LED. It can be daisy chained by connecting the output of a
module to the input of the next module
Pin Offset
Input Ouput
Module Footprint
Breadboard footprint
13.2 API
JavaDoc Online
///////////////////////////////////////////////////////////////////
// NEO PIXEL Constants
///////////////////////////////////////////////////////////////////
public const int NEO_RGB = 0x00 ;// Wired for RGB data order
public const int NEO_GRB = 0x01 ;// Wired for GRB data order
public const int NEO_BRG = 0x04;
Usage
1. Place a WS2812
2. Switch to Module footprint
3. Wire the input pin to an output pin, 12
4. Include the API :
5. Instantiate and call
import muvium.compatibility.arduino.*;
import muvium.compatibility.arduino.Adafruit_NeoPixel;
}
}
13.3 DS1307
64 x 8, Serial, I2C Real-Time Clock
The DS1307 serial real-time clock (RTC) is a lowpower, full binary-coded decimal (BCD)
clock/calendar plus 56 bytes of NV SRAM. Address and data are transferred serially through
an I2C, bidirectional bus. The clock/calendar provides seconds, minutes, hours, day, date,
month, and year information. The end of the month date is automatically adjusted for
months with fewer than 31 days, including corrections for leap year. The clock operates in
either the 24-hour or 12hour format with AM/PM indicator. The DS1307 has a built-in
power-sense circuit that detects power failures and automatically switches to the backup
supply. Timekeeping operation continues while the part operates from the backup supply.
13.3.1 API
Wire
In VBB Wire is an API. The I2C signals are not transmitted over the actual wire but are
handled abstractly.
import muvium.compatibility.arduino.*;
import muvium.compatibility.arduino.Wire;
import muvium.compatibility.arduino.StringUtils;
Serial.write(StringUtils.castChars(timeFormat),
sizeof(timeFormat));
timeFormat[POS_YEAR - 2] = '2';
timeFormat[POS_YEAR - 1] = '0';
TimeNow();
Serial.write(StringUtils.castChars(timeFormat),
sizeof(timeFormat));
UpdateTime();
TimeNow();
Serial.write(StringUtils.castChars(timeFormat),
sizeof(timeFormat));
}
Wire.beginTransmission(DS1307_ADDRESS);
Wire.write(0);
Wire.endTransmission();
Wire.requestFrom(DS1307_ADDRESS, 7);
writeBCD( Wire.read() & 0x7F, POS_SECOND);
writeBCD( Wire.read(), POS_MINUTE );
writeBCD( Wire.read(), POS_HOUR);
Wire.read();
writeBCD( Wire.read(), POS_DAY );
writeBCD( Wire.read(), POS_MONTH );
writeBCD( Wire.read(), POS_YEAR );
Wire.beginTransmission(DS1307_ADDRESS);
Wire.write(0);
Wire.write(0); //Seconds
Wire.write(1); //Minute
Wire.write(2); //Hour
Wire.write(0); //Day of Month
Wire.write(3); //Day
Wire.write(4); //Month
Wire.write(5); //Year (2005 )
Wire.write(0); //Control..
Wire.endTransmission();
TimeNow();
Serial.write(StringUtils.castChars(timeFormat),
sizeof(timeFormat));
delay(2000);
13.4.1 API
Wire
In VBB Wire is an API. The I2C signals are not transmitted over the actual wire but are
handled abstractly.
import muvium.compatibility.arduino.*;
import muvium.compatibility.arduino.Wire;
import muvium.compatibility.arduino.StringUtils;
Wire.beginTransmission(deviceaddress);
Wire.write((int) (eeaddress >> 8)); // MSB
Wire.write((int) (eeaddress & 0xFF)); // LSB
Wire.write(data);
Wire.endTransmission();
}
Serial.println("Memory written");
while (b != 0) {
Serial.println(" ");
}
readOutEEPROM(0x50);
readOutEEPROM(0x51);
delay(2000);
"darkkhaki RGB(189,183,107)
"darkmagenta RGB(139,0,139)
"darkolivegreen RGB(85,107,47)
"darkorange RGB(255,140,0)
"darkorchid RGB(153,50,204)
"darkred RGB(96,0,0)'getSVGColor=RGB(139,0,0)
"darksalmon RGB(233,150,122)
"lightpink RGB(255,182,193)
"lightsalmon RGB(255,160,122)
"lightseagreen RGB(32,178,170)
"lightskyblue RGB(135,206,250)
"lightslategray RGB(119,136,153)
"lightslategrey RGB(119,136,153)
"lightsteelblue RGB(176,196,222)
"lightyellow RGB(255,255,224)
"lime RGB(0,255,0)
"limegreen RGB(50,205,50)
"linen RGB(250,240,230)
"magenta RGB(255,0,255)
"maroon RGB(128,0,0)
"mediumaquamarine RGB(102,205,170)
"mediumblue RGB(0,0,205)
"mediumorchid RGB(186,85,211)
"mediumpurple RGB(147,112,219)
"mediumseagreen RGB(60,179,113)
"mediumslateblue RGB(123,104,238)
"mediumspringgreen RGB(0,250,154)
"mediumturquoise RGB(72,209,204)
"mediumvioletred RGB(199,21,133)
"midnightblue RGB(25,25,112)
"mintcream RGB(245,255,250)
"mistyrose RGB(255,228,225)
"moccasin RGB(255,228,181)
"navajowhite RGB(255,222,173)
"navy RGB(0,0,128)
"oldlace RGB(253,245,230)
"olive RGB(128,128,0)
"olivedrab RGB(107,142,35)
"orange RGB(255,165,0)
"orangered RGB(255,69,0)
"lightcoral RGB(240,128,128)
"lightcyan RGB(224,255,255)
"lightgoldenrodyellow RGB(250,250,210)
"lightgray RGB(211,211,211)
"lightgreen RGB(144,238,144)
"lightgrey RGB(211,211,211)
"violet RGB(238,130,238)
"wheat RGB(245,222,179)
"white RGB(255,255,255)
"whitesmoke RGB(245,245,245)
"yellow RGB(255,255,0)
"yellowgreen RGB(154,205,50)
"darkseagreen RGB(143,188,143)
"darkslateblue RGB(72,61,139)
"darkslategray RGB(47,79,79)
"darkslategrey RGB(47,79,79)
"darkturquoise RGB(0,206,209)
"darkviolet RGB(148,0,211)
"deeppink RGB(255,20,147)
"deepskyblue RGB(0,191,255)
"dimgray RGB(105,105,105)
"dimgrey RGB(105,105,105)
"dodgerblue RGB(30,144,255)
"firebrick RGB(178,34,34)
"floralwhite RGB(255,250,240)
"forestgreen RGB(34,139,34)
"fuchsia RGB(255,0,255)
"gainsboro RGB(220,220,220)
"ghostwhite RGB(248,248,255)
"gold RGB(255,215,0)
"goldenrod RGB(218,165,32)
"Gray RGB(128,128,128)
"grey RGB(128,128,128)
"green RGB(0,128,0)
"greenyellow RGB(173,255,47)
"honeydew RGB(240,255,240)
"hotpink RGB(255,105,180)
"indianred RGB(205,92,92)
"indigo RGB(75,0,130)
"ivory RGB(255,255,240)
"khaki RGB(240,230,140)
"lavender RGB(230,230,250)
"lavenderblush RGB(255,240,245)
"lawngreen RGB(124,252,0)
"lemonchiffon RGB(255,250,205)
"lightblue RGB(173,216,230)
"orchid RGB(218,112,214)
"palegoldenrod RGB(238,232,170)
"palegreen RGB(152,251,152)
"paleturquoise RGB(175,238,238)
"palevioletred RGB(219,112,147)
"papayawhip RGB(255,239,213)
"peachpuff RGB(255,218,185)
"peru RGB(205,133,63)
"pink RGB(255,192,203)
"plum RGB(221,160,221)
"powderblue RGB(176,224,230)
"purple RGB(128,0,128)
"red RGB(255,0,0)
"rosybrown RGB(188,143,143)
"royalblue RGB(65,105,225)
"saddlebrown RGB(139,69,19)
"salmon RGB(250,128,114)
"sandybrown RGB(244,164,96)
"seagreen RGB(46,139,87)
"seashell RGB(255,245,238)
"sienna RGB(160,82,45)
"silver RGB(192,192,192)
"skyblue RGB(135,206,235)
"slateblue RGB(106,90,205)
"slategray RGB(112,128,144)
"slategrey RGB(112,128,144)
"snow RGB(255,250,250)
"springgreen RGB(0,255,127)
"steelblue RGB(70,130,180)
"Tan RGB(210,180,140)
"teal RGB(0,128,128)
"thistle RGB(216,191,216)
"tomato RGB(255,99,71)
"turquoise RGB(64,224,208)