navitron
 
Renewable Energy and Sustainability Forum
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Anyone wishing to register as a new member on the forum is strongly recommended to use a "proper" email address - following recent spam/hack attempts on the forum, all security is set to "high", and "disposable" email addresses like Gmail, Yahoo and Hotmail tend to be viewed with suspicion, and the application rejected if there is any doubt whatsoever
 
Recent Articles: Navitron Partners With Solax to Help Create A More Sustainable Future | Navitron Calls for Increased Carbon Footprint Reduction In Light of Earth Overshoot Day | A plea from The David School - Issue 18
   Home   Help Search Login Register  
Pages: [1] 2 3 4 5 ... 17   Go Down
  Print  
Author Topic: A Wide Variety of free 1-wire slaves arriving soon. What do you need?  (Read 100187 times)
StBarnabas
Hero Member
*****
Offline Offline

Posts: 2221


St Barnabas Chapel (2009)


« on: November 10, 2009, 08:36:08 PM »

Hello all
as you will have noticed Ken is gathering support for a "Grand Design". This is a bit more "garden shed" however may be of interest to some of you. EricW and self have being looking at 1-Wire slaves for a while (Actually Eric does all the hard coding - I just check out his code try to understand it and normally fail miserably..) Anyway these are "cheap as chips" PIC 12F683 based sensors. These have inbuilt  ADCs, counters etc. the difficult bit is to get them to look like 1-wire slaves. They may look like DS18B20's for example but produce a Pseudo temperature related to state, count ADC voltage etc. They seem to work with a variety of software LogTemp, one-wire viewer (both the "C" and Java versions)  and home-grown PIC one-wire masters.

We are not sure which way this will play out or what interest there will be but the first trial sensor which looks like a DS18B20 is a switch which produces 33 degrees centigrade when closed and zero degrees when open.

Before moving further we need to check robustness and are looking for some volunteers. Very simple PM me and await for the prototype to arrive, attach the sensor to your one-wire bus, check to see if it is recognised and gives 0 with the switch open and 33 degrees with it closed. Post the sensor on to the next person. (Red 5V black 0, Green One-wire DQ line). If it works give Eric a karma point - this is in my opinion a great bit of work!

 Reward  for participating a 2.00 inc. postage and packaging a one-wire  ADC, counter chip to do essentially what you might need.   I for example want a simple counter for my power meters - 1000 pulses/kWh, a counter for a few flow metres and ADCs for irradiance sensors. But your needs might be different.  

Attached a picture hacked together PCB and the effect of opening and closing the switch on one of my networks with 1-wire Java viewer.
StB



* 1-wire-slave.jpg (22.25 KB, 800x600 - viewed 5132 times.)

* Slave1.gif (29.41 KB, 1117x600 - viewed 4734 times.)
« Last Edit: November 11, 2009, 07:28:25 PM by StBarnabas » Logged


Gestis Censere. 40x47mm DHW with TDC3. 3kW ASHP, 9kW GSHP, 3kW Navitron PV with Platinum 3100S GTI, 6.5kW WBS, 5 chickens. FMY 2009.
wyleu
Guest
« Reply #1 on: November 10, 2009, 09:54:14 PM »

Oooooooh.   


Smites a plenty !!!!
Logged
StBarnabas
Hero Member
*****
Offline Offline

Posts: 2221


St Barnabas Chapel (2009)


« Reply #2 on: November 11, 2009, 04:04:11 PM »

Strange, something funny has happened to my Karma score!
Wyleu the Sensor board is in the post and also a spare programmed PIC.  (At 73p I'm not going to loose sleep). Let me know how you get on...
As an afterthought this thread should probably be in "Home Automation and Monitoring" Would it be possible to move it?

Sean
P.S. The first class post was over 1.00! Strange state of affairs when p&p cost more than the contents.
« Last Edit: November 11, 2009, 07:27:26 PM by StBarnabas » Logged


Gestis Censere. 40x47mm DHW with TDC3. 3kW ASHP, 9kW GSHP, 3kW Navitron PV with Platinum 3100S GTI, 6.5kW WBS, 5 chickens. FMY 2009.
mellifera
Jr. Member
**
Offline Offline

Posts: 51


« Reply #3 on: November 16, 2009, 02:13:54 PM »

Hi StB and EricW,

It's been a while since I've posted but haven't been completely idle. I too have been trying make a 1-wire slave fit into a small PIC microcontroller. Up until now I've only had a PIC16F877 ICE kit from Magenta Electronics but at last I have picked up a reasonably priced PICSTART+ programmer so can now see if my ideas work in practice.

I have managed to code up a 1-wire slave into a 10F200 (0.57p from Farnell) running on it's 4MHz internal oscillator. Switching to a 10F202 (0.62p) makes the adding of a 1-wire bus master possible so a real 1-wire slave can be used to provide a proper unique 48-bit ROM ID.

I have captured and analysed Logtemp's behaviour on the 1-wire bus. It is different between a bus where all slaves are powered and a bus with at least one parasite powered slave. There are a number of timing challenges when implementing a 1-wire slave using a 4MHz clock...
 1) 14.4us between writing bits (within a byte)
 2) 14.6us between reading bits (within a byte)
 3) 32.0us between Search ROM command and the first bit of the search
 4) 15.6us between bits within the search ROM algorithm
 5) 26.0us between Match ROM command and the first bit of the following ROM ID
 6) 14.8us between match ROM bits
...hence the need to actually try it out to see if it will actually work. On paper, I still have difficulty meeting some of these limits under all conditions so might have to resort to PICs with 8MHz internal oscillators (10F220, 10F222, 12F510 etc.)

The graph below shows my 16F877 20MHz pseudo 1-wire slave masquerading as three different slaves producing a synthetic temperature plot in Logtemp.

I'm more than happy to share my findings with this community, just send me a PM.

Cheers, Mike.



* temp2.gif (60.17 KB, 800x669 - viewed 4465 times.)
« Last Edit: November 16, 2009, 02:40:35 PM by mellifera » Logged
ericw
Hero Member
*****
Offline Offline

Posts: 774


« Reply #4 on: November 16, 2009, 05:57:06 PM »

Mike
How did you get those timings?
According to the published 1 wire spec the minimum width of a normal speed time slot is 60usec + > 1 usec.
A write 0 just has to safely exceed the master read sample time of 15usec so you ought have more time available than you are suggesting before the start of the next timing slot. In the read mode you can get away with sampling at 15-30usec so again you have more time available to the end of the time slot.

Even using these more relaxed times it is hard to do the inter slot processing.

I found that I couldn't get things working using LogTemp or the One Wire Viewer with 4 MHz internal oscillators but by moving to an 8 MHz chip it did work, but we really want it tried on a bigger sample of networks to see if it works reliably. Hence Seans post.
 
Should it work, it opens up the possability of being able to simply add other sensors (eg energy meters) to existing one wire network setups and add their outputs to existing plots without the user having to do anything additional in the software.

Eric


Logged
StBarnabas
Hero Member
*****
Offline Offline

Posts: 2221


St Barnabas Chapel (2009)


« Reply #5 on: November 17, 2009, 11:26:22 AM »

Mike
that seems to be a very nice piece of work and have sent you a PM. We need to work together on this. it isn't as if we are a very big community.
Using PIC 10 series devices is an interesting choice and a good intellectual challenge. I think however the lack of interrupts, ADCs etc. will be a limitation. We are currently also using all three timers/counters on the PIC12F683 and have plans for using the data EEPROM, ADCs etc. The 683 also has about 4 times the memory. So I think the extra 20p is money well spent. If anything we may have to go back up to the 16 series as I can see I^2C for example being useful in the future.

Like Eric, I am impressed you can get it running at 4MHz.

Wyleu should be posting the trial sensor onto SleepyB soon. You can await for it to do the rounds but I would be happy to post a programmed chip to you if you wish. However I am hopeful by the end of the week we will have version 1 of our power meter going based on the 1000 pulses per kWh type meter and looking like a DS18B20 but producing 10 degrees per kW.

Sean

Logged


Gestis Censere. 40x47mm DHW with TDC3. 3kW ASHP, 9kW GSHP, 3kW Navitron PV with Platinum 3100S GTI, 6.5kW WBS, 5 chickens. FMY 2009.
mellifera
Jr. Member
**
Offline Offline

Posts: 51


« Reply #6 on: November 17, 2009, 01:41:16 PM »

Hi Sean & Eric,

Rumours of my competance have been greatly exaggerated, I haven't proven that the 4MHz version works yet, it's only a paper design at the mo. Now I've got my PICSTART+ I can program a PIC10F2xx and try it out for real - parts on order.

I'm very happy to join in on the trials and report back.

What are you doing about your sensor's ROM ID? If you are going to create multiple sensors (switch, count, ADC etc.) it could get a bit tricky.

I put a 1-wire bus master into my slave to pull in a proper ROM ID from a genuine Dallas 1-wire part (any will do but a DS2901 would be the cheapest) and use it for itself after adding a new family code and CRC...

                    .-------R4K7------.
                    |    _________    |        ________
         / +ve -----+---|         |---+-------|        |
 1-wire |  Sig ---------|  O W S  |------.    | DS2901 |
   bus   \ Gnd -----+---|_________|----. | .--|________|
                    '------------------|-|-'
                                       | '---O Input 'A'
                                       '-----O Input 'B'

I suppose my ultimate aim is to instrument up my solar panels, hot water tank, boiler and electricity etc. using 1-wire and use a PIC base data logger to drive the bus and record all the data. That way I not running 20W 24/7 logging the data which, to me, is important as it adds up to 175kWh per year which, if anything, is the opposite direction I'm trying to go in.  Smiley

Cheers, Mike.
Logged
ericw
Hero Member
*****
Offline Offline

Posts: 774


« Reply #7 on: November 17, 2009, 03:05:30 PM »

Mike,
If you want the chip to be recognised as a DS18B20 with existing software, it has to report a family code of 28.
I hard coded a number in. While this allows only one chip per network without reprogramming, it is possible to use the state of the spare input(s) to program the ID. And if you want a dual, for example to sense both pump on and heat dump, with one chip you can dynamically change the ID and LogTemp will plot two lines. One Wire Viewer however doesn't like it.

For long term datalogging as opposed to seeing what is happening in the relative short term,  have you looked at this http://www.coolcomponents.co.uk/catalog/product_info.php?products_id=193 . All you have to do is build a master (much easier than a slave) to drive the one wire bus and output an ASCII string. You can then plug it (or just the SD card) into your PC when you want to process the information.
Alternatively you can used an Arduino for the interface or add the SD card interface unit to do the whole lot.

Eric
Logged
wyleu
Guest
« Reply #8 on: November 17, 2009, 09:15:50 PM »

Just got the St Barnabus board to do things.

Linux/debian running owfs connected to the puce baboon OW/USB dongle via a hobby board power injector !
pin 2   - Red Wire +V
pin3    - Black Wire OV
pin 4   - Green Wire DQ

Heres' the screen dump from owhttpd -u -p 3001



Turning off the switch makes the temperatures read as    Error: Invalid argument


Congrats to all involved. I'll send it on to the next person.



« Last Edit: November 17, 2009, 09:22:56 PM by wyleu » Logged
StBarnabas
Hero Member
*****
Offline Offline

Posts: 2221


St Barnabas Chapel (2009)


« Reply #9 on: November 17, 2009, 09:34:46 PM »

Wyleu
interesting. I was not expecting this error on switch off. But 95% successful I think? The train rolls on!
Sean
Logged


Gestis Censere. 40x47mm DHW with TDC3. 3kW ASHP, 9kW GSHP, 3kW Navitron PV with Platinum 3100S GTI, 6.5kW WBS, 5 chickens. FMY 2009.
ericw
Hero Member
*****
Offline Offline

Posts: 774


« Reply #10 on: November 18, 2009, 09:51:05 AM »

Wyleu
Thanks for your help in testing it.
I'm surprised that it worked at all with no power - it is not designed to be parasitically powered, despite telling the 1 wire master it is. It is obviously getting enough power from the bus via the internal ESD protection diode to partially work.
I would have expected it to load the bus enough in this state to cause errors elsewhere, you must have a fairly powerful driver on your bus.

 Eric
Logged
wyleu
Guest
« Reply #11 on: November 18, 2009, 10:04:30 AM »

It was powered, I was using the hobbyboard power injector
http://www.hobby-boards.com/catalog/links/pi1-r1/Power%20Injector%20Schematic.pdf
http://www.hobby-boards.com/catalog/product_info.php?cPath=25_28&products_id=80

The bus driver was the puce baboon.
http://www.hobby-boards.com/catalog/product_info.php?cPath=23&products_id=1503

The one-wire bus had one extra DS18B20 just to allow something else on the bus for comparison.
« Last Edit: November 18, 2009, 10:10:11 AM by wyleu » Logged
ericw
Hero Member
*****
Offline Offline

Posts: 774


« Reply #12 on: November 18, 2009, 10:53:35 AM »

Sorry I mis-understood

  "Turning off the switch makes the temperatures read as    Error: Invalid argument"

as being the power.

Eric
Logged
wyleu
Guest
« Reply #13 on: November 18, 2009, 10:58:32 AM »

It really wasn't a very exhaustive test session. I'd like to sling it on the end of my installed bus ( 30 or so metres ), but things are a little busy. When I get the chance (sometime in the next couple of days) I'll send it on to the next person.
I've got owfs running but owpython needs to be re-installed on my development system so that will be the next job. Then I'll try to dream up lots of things to examine it with.
Can the RED Led be addressed?
Logged
StBarnabas
Hero Member
*****
Offline Offline

Posts: 2221


St Barnabas Chapel (2009)


« Reply #14 on: November 18, 2009, 11:46:55 AM »

Wyleu
the red LED was used in an earlier version to flash when various bits of the code were executed. It is currently disabled though could be reinstated. This is a very basic bit of code (there is a lot going on but it is almost all dedicated towards the 1-wire protocol). We are currently using only about 1/6 of the device memory though Eric's version 2 may be considerably longer. Give some thought as to what you would like...
Sean
   
Logged


Gestis Censere. 40x47mm DHW with TDC3. 3kW ASHP, 9kW GSHP, 3kW Navitron PV with Platinum 3100S GTI, 6.5kW WBS, 5 chickens. FMY 2009.
Pages: [1] 2 3 4 5 ... 17   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.20 | SMF © 2013, Simple Machines
SMFAds for Free Forums
Simple Audio Video Embedder
Valid XHTML 1.0! Valid CSS!