I needed a simple understanding of how this circuit works.



I understand everything about this circuit apart from the diode. I also know the function of the diode is to protect the transistor but from what exactly? Is it something to do with back EMF from the coil? I'm not too sure. Also I needed to confirm if the relay will function correctly with a 9V supply (regulated or unregulated). The datasheet of the relay is attached here and the part I'm going to use is '40.61' on page 20 of the datasheet.

Also any tips for making this circuit work more efficiently. Note I am going to use the relay for no more than 16A at 230VAC at 50Hz.

Thanks


Question: What might cause "junk after document element" error?
Answer: A quick Google search confirmed your suspicion ... this is likely an XML parsing error.  Furthermore, some discussion on the forums suggests it's caused by script insertion after a closing &lt;/rss&gt; tag.

If it is an inserted script, this is likely the result of a hack or an attack on your site or host.

Another possibility is a PHP error in the RSS-generation script.  PHP would return the error in-line, and the error message, being non-XML, would be read as "junk" by the XML parser.  This could also be the result of a feed your site is trying to read (i.e. on the admin dashboard), not necessarily a feed you're generating.