Spanish Italian
17153 Users    

Howto Design with a Simulator

  Download PDF version of the Article

Howto Design with a Simulator

I hesitate to start the project since I have an issue with my debugger. I will never try to connect my debugger to a device directly connected to the mains, it might damage the debugger and my computer. Latterly, I found that simulators like TINA and Proteus are quite useful for this kind of design. Solved this nasty problem I can now start up the design.
There is a smart lighting control system in our meeting room. The user can switch on/off individual light and define lighting modes (such as presentation and meeting modes) with a remote control. I tried to design a smart lighting system by myself with my favorite microcontroller. The new system should be easy to install and individually addressable, and as cheap as possible.

ac mcu

The traditional system requires a rectified and regulated voltage source (5V/3.3V) and opto-couplers for lighting control. A cheaper design interfaces the microcontroller to the main supply directly, as described in an application note from Philips/NXP semiconductors (Please check out the attachment pdf file). This approach allows the low-end microcontroller to work in an AC main supply environment. The electronics part can be mounted in the socket flush box as a module.

It is a good idea, but I hesitate to start the project because I have to setup a suitable debug working bench. In order to debug the software, I have to connect my emulator to the AC mains and use an opto-isolator to isolate the RS232/USB connection between emulator and my PC. I have to make sure of the safety of the emulator and myself. I can not find a good solution until I evaluate TINA and Proteus lately. Yes, these simulators are quite helpful in such hazard environment. I will share my experience with Proteus with this sample project.

According to the application note, a window circuit is used to detect the voltage/current zero crossing with the internal comparator(s) of the LPC764. The positive supply (5V) is connected directly to the mains (line or neutral). The 5.6V Zener diode, combined with the forward voltage drop of the rectifier diode, produces an IC voltage supply close to 5V.

In order to verify the circuit, I replace the internal comparators with a regular comparator IC to probe the voltage of the related nodes. According to the application note, I setup the circuit step by step and check the simulation diagram (it is called as Graphic Simulation in Proteus) for the final result. During this process, I have corrected the circuit several times. The simple detection circuit connects the mains to the positive input of the comparator with a series resistor (according to the Figure 9 in the application note). However it is extremely dangerous, because the input terminal has to interface the 110V directly. Yes, I can make a lot of mistakes until I find the correct circuit in a simulated circuit. Sometimes, simulator is a better design method than a hardware emulator.

I will replace the standard comparators with the internal ones of a microcontroller (LPC9XX or ATTiny). The latest microcontrollers have integrated the COMP as a standard peripheral. You can find the comparators in LPC7XX, LPC9XX, PIC, AVR, MSP430 and Cortex-M3. Because Proteus also supports third party high level language debug, I can use my favorite Keil uVision or AVRStudio to debug the firmware in real time. Most of the works can be done on a PC, until I download the firmware to the microcontroller.

The simulation method sometimes is much better than the traditional hardware emulator. At least it can help you to secure your safety, protect your properties and speed up your design cycle. Proteus is a commercial software. Alternatively, you can use the demo version of TINA, which can be downloaded from the web site free of charge. The lighting project is still ongoing, and the design will be open as well. Both Proteus and TINA support electronics simulation and mcu co-simulation. Proteus supports more microcontrollers and TINA is much powerful in electronics simulation and VHDL simulation. I will cover the comparation of these tools later (including Proteus, Tina, MultiSim, gEDA, ARMulator and AVRSimulator), so you can pick the suitable software for your project.

 

Read More

Proteus

http://www.labcenter.co.uk/download/prodemo_download.cfm#professional

TINA Pro v8 demo

http://www.designsoftware.com/

http://www.tina.com/

Read the Italian version: Come Progettare con un Simulatore

AttachmentSize
LPC_AN467_1.pdf142.15 KB

Hey, thanks for all the

Hey, thanks for all the info. This is obviously great help not only to me but also to the people out there. Thanks and cheers!

Keep it up, your writing is

Keep it up, your writing is always a joy to read that I even told my friends. Simply loving this!

I think it would be a good

I think it would be a good idea toreplace the standard comparators with the internal ones of a microcontroller (LPC9XX or ATTiny) critical illness insurance quotes

Awesome

You have a very informative post here...keep it up!

I wish I had your skills

I love watching developers work. They seem to be able to create anything from nothing. I wish I can do it. Since I can't, the best alternative is to read your blog : )

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
1 + 0 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

Who's new

  • bilalbinrais
  • laulau
  • RiyasAhammed
  • ah2003
  • ronne
  • stomodot
  • mbowien
  • rsilva
  • daveh1955
  • pankspec

Who's online

There are currently 0 users and 60 guests online.