User stocky6409 - Chiphackermost recent 30 from http://chiphacker.com2010-08-01T09:10:58Zhttp://chiphacker.com/feeds/user/503http://www.creativecommons.org/licenses/by-nc/2.5/rdfhttp://chiphacker.com/questions/1742/flyback-protection-for-a-dc-latching-soelnoidFlyback protection for a dc latching soelnoid?Stocky64092010-03-05T05:28:33Z2010-03-05T12:36:01Z
<p>Hi Guys n Gals,</p>
<p>I'm looking for a solution for "flyback" protection when driving a 2 wire DC latching solenoid. You cant use the traditional diode solution as the polarity of the coil is reversed to open or close the solenoid.</p>
<p>My cct uses two relays to switch the solenoid - the first (SPST) applies power to the second relays contacts (DPDT) which does the polarity reversal for the power to the solenoid coil.</p>
<p>Of course my relay coils already have conventional flyback diodes connected - what i'm looking to protect against is the back EMF from the actual solenoid coil itself.</p>
<p>Ideas?</p>
<p>Stocky</p>
http://chiphacker.com/questions/1537/newbie-code-query-arduino-ds18b20/1542#1542Answer by Stocky6409 for newbie code query => Arduino & DS18B20Stocky64092010-01-28T05:56:46Z2010-01-28T05:56:46Z<p>Thanks all who contributed.
My code works and I have learnt about hardware serial, rf comms, software serial, cast, floats, serial LCD and dallas onewire all in 2 days :-)</p>
http://chiphacker.com/questions/1537/newbie-code-query-arduino-ds18b20newbie code query => Arduino & DS18B20Stocky64092010-01-27T07:49:32Z2010-01-28T05:56:46Z
<p>Hi all - been using picaxe for a few years but now playign with arduino and trying to learn how it all works.</p>
<p>I have a couple of arduinos talking via the HOPERF library successfully and now want to send some meaningful data over the link.</p>
<p>I have the code for the DS18B20 running on the client aurduino and "printing" the temp value to the PC via USB but just not sure how to get it into the HOPERF commands to send over the RF.
Here is a bit of the code. The 2nd line is where the data is sent over the HOPERF.
What i need to do is replace the string "test" with the data returned by the (sensors.getTebyCByIndex(0)) command from the 4th line.</p>
<pre><code>sensors.requestTemperatures(); // Send the command to get temperatures
client.sendto(11, (uint8_t*)"test\n", 6); // Includes the NUL at the end of the string
Serial.print("sending\n");
Serial.print(sensors.getTempCByIndex(0)); //prints the temp value over the USB
</code></pre>
<p>Any clues anyone?? I prefer to learn but doing stuff like this - and yes i did do the "BLINK" thing first! I find doing something i find useful helps me learn faster :-)</p>
<p>I am struggling a bit with working out the docs as there doesnt seem to be a nice "manual" liek the picaxes to follow :-(</p>
http://chiphacker.com/questions/1742/flyback-protection-for-a-dc-latching-soelnoid/1744#1744Comment by Stocky6409Stocky64092010-03-05T10:49:19Z2010-03-05T10:49:19ZSo to clarify your "back to back - series connected" comment: does that mean both cathodes together with anodes to each solenoid terminal? OR 2 zeners in parallel A to K and one junction to each solenoid terminal?http://chiphacker.com/questions/1742/flyback-protection-for-a-dc-latching-soelnoid/1744#1744Comment by Stocky6409Stocky64092010-03-05T10:47:29Z2010-03-05T10:47:29ZCheers - i think i have some suitable zeners on hand - will look in the morning. Thankshttp://chiphacker.com/questions/1742/flyback-protection-for-a-dc-latching-soelnoidComment by Stocky6409Stocky64092010-03-05T10:46:45Z2010-03-05T10:46:45Zbecause i had suitable relays and not suitable transistors :-)
The original cct i am using drove a 2 wire dc motor operated valve which only needed power in one polarity or the other for 1-2 seconds to change state. The solenoid is similar in that it only needs a short pulse of one polarity or the other to change state.
It was deemed quicker to adapt the current cct that wait for parts to do something differnt.http://chiphacker.com/questions/1537/newbie-code-query-arduino-ds18b20/1540#1540Comment by Stocky6409Stocky64092010-01-28T05:55:03Z2010-01-28T05:55:03Z.....and after a tidy-up saved over 700bytes to boot :-)http://chiphacker.com/questions/1537/newbie-code-query-arduino-ds18b20/1539#1539Comment by Stocky6409Stocky64092010-01-28T05:54:02Z2010-01-28T05:54:02ZDownloaded...........http://chiphacker.com/questions/1537/newbie-code-query-arduino-ds18b20/1540#1540Comment by Stocky6409Stocky64092010-01-28T04:12:04Z2010-01-28T04:12:04ZWorking! Codes not pretty but it works :-)
Thanks again!http://chiphacker.com/questions/1537/newbie-code-query-arduino-ds18b20/1540#1540Comment by Stocky6409Stocky64092010-01-28T01:45:53Z2010-01-28T01:45:53ZYAY - many thanks! With a little bit of adjustment I got that to work properly. I now have my temp to 2 decimal places being sent over the RF and displayed in the serial monitor window.
I'm also using SoftwareSerial to display data on an LCD. using LCD.print(tempC) gives an error even though serial.print(tempC) works fine. I had a read of the SoftwareSerial library page and changed the line to LCD.print(tempC, DEC) which works but only gives me the whole part of the temp whereas the serial.print gives me the whole plus decimal. I'll keep reading to see if I can sort it out :-)
Many thanks!http://chiphacker.com/questions/1537/newbie-code-query-arduino-ds18b20/1538#1538Comment by Stocky6409Stocky64092010-01-27T20:38:48Z2010-01-27T20:38:48ZThank you for the extra description - some of this is starting to make sense now :-)http://chiphacker.com/questions/1537/newbie-code-query-arduino-ds18b20/1540#1540Comment by Stocky6409Stocky64092010-01-27T20:38:02Z2010-01-27T20:38:02ZThanks - that looks like it should work. Its sort of what i expected it to be but as I'm still getting my head around the program structures (being ex BASIC) i just couldn't work it out. I'll give it bash this morning and see what results i get - thank you! :-)http://chiphacker.com/questions/1537/newbie-code-query-arduino-ds18b20/1539#1539Comment by Stocky6409Stocky64092010-01-27T20:35:57Z2010-01-27T20:35:57ZI've been trying to learn on PC - brain too stuck in the world of Basic! I've actually learnt more about "C - like" programming in a week of Arduino than months trying to work it our on the PC. I'm just weird sorry :P
Thanks for the link - I'll have a look anywayhttp://chiphacker.com/questions/1537/newbie-code-query-arduino-ds18b20Comment by Stocky6409Stocky64092010-01-27T11:34:02Z2010-01-27T11:34:02Zlibraries used are HOPERF & DallasTemperaturehttp://chiphacker.com/questions/1537/newbie-code-query-arduino-ds18b20/1538#1538Comment by Stocky6409Stocky64092010-01-27T11:22:06Z2010-01-27T11:22:06Zso if what i am getting returned is a "float" (floating point number????) is there some way I can convert it into a string??
I tried putting the (sensor.getTempCByIndex) command into the client.sendto() without any luck - i just got errors about "cast" that i simple dont understand yet :-(http://chiphacker.com/questions/1537/newbie-code-query-arduino-ds18b20/1538#1538Comment by Stocky6409Stocky64092010-01-27T11:20:14Z2010-01-27T11:20:14Zsensors.getTempCByIndex returns a value of XX.xx in degreesC
You lost me on the the rest - still trying to get my head around "cast" "Float" and all these other unfamiliar terms (i'm from a BASIC background - sorry!)