1-wire Devices?

George Sephton

Senior Member
Hi,
Ive been looking on the forum for DS2438 and have only found a few results, regarding the circuitry not the coding. The device is 1-wire, does that mean my 20M can support it? If not is there away. This is the datasheet (http://datasheets.maxim-ic.com/en/ds/DS2438.pdf) and I wanted to know how I can get an process the info from the device to PICAXE. What pin do I have to connect it to as it only has on DATA pin (DQ).

George.
 

Andrew Cowan

Senior Member
You would have to bit bang it, as it is not officially supported by a PICAXE command (except readowsn for the serial number).

A
 

George Sephton

Senior Member
What kind of information does readowsn get? Ive looked through the datasheet but I don't understand what serial numbers can be given. In reality I only want to get information from the battery so reading a serial number is fine.
 

BeanieBots

Moderator
What kind of information does readowsn get? Ive looked through the datasheet but I don't understand what serial numbers can be given. In reality I only want to get information from the battery so reading a serial number is fine.
George, you are going to get into the habbit of reading datasheets.
The "serial number" (as clearly explained in the datasheet) is a unique number for each and every chip. It so that you can have many chips on the one wire and be able to identify each one of them.

You will need a 28X1 to communicate using one-wire commands. Even then, I don't think anyone here has tried with that specific device so you will probably be on your own. That will require reading the datasheet, understanding what command bytes need to be sent and interpreting the data that will be sent back.

One-wire timing is CRITICAL so you CANNOT bit-bang the data.
 

George Sephton

Senior Member
Ok, but really I did read the data sheet but it was confusing. i wasn't sure which were serial numbers and which were data. But its ok ive solved the problem now. Instead of using the ic I can connect the battery to an adc pin and do readadc10 command to measure then using a scale I can see how charged a battery is. If tested it and it works like I want it to.
 

rmeldo

Senior Member
Another solution would have been to use a 1-wire master, like the DS2480 or DS2482, which can communicate via serial or i2c.
 

westaust55

Moderator
George.

from the first page of the referenced datasheet:
Because each DS2438 contains a unique silicon serial number, multiple DS2438s can exist on the same
1-Wire bus. This allows multiple battery packs to be charged or used in the system simultaneously.
More about this on page 10 of the datasheet.



And . . .from the PICAXE Manual 2 for the READOWSN command
This command (read-one-wire-serial-number) reads the unique serial number from any Dallas 1-wire device (e.g DS18B20 digital temp sensor, DS2415 clock,
or DS1990A iButton).

The serial number is just one bit of information. It tells you nothing about the battery or charger status.
The serial number can be used for addressing a particlar chip when you have several conencted to the same one-wire bus.


You would need at least an 18X (any X part) to use i2c and a one-wire bus master or as Beainbots has already mentioned an X1 or X2 part to use the inbuilt PICAXE commands OWIN and OWOUT to communciate directly with one-wire devices. You might still want to read up on these commands for future reference.


And . . . before you ask . . . .
NO the One-Wire Tutorial mentioned in PICAXE manula 2 does not exist.
 
Last edited:
I am soon to be using a one-wire device, and would like to ask something that I am sure will confuse many others:

From my understanding, data is bidirectional, but despite this, Manual 2 suggests to me that a one-wire device should be connected to an input.

Could somebody please clarify this little query, and perhaps offer an explanation as to why this may be.

Thank you.
 

westaust55

Moderator
Peter Anderson (PHA) is selling some one-wire controller boards with 7 channels that interface using RS232.

The ONEWIRE Controller permits a conventional B@sic St@mp or PICAXE to interface with up to seven Dallas 1-wire devices, with each device on a separate run. Communication between the Stamp and the ONEWIRE Controller uses RS232 serial communication. The baud rate may be set to either 9600 or to 2400 for the PICAXE with a strap.

This design permits the hobbyist to interface with any Dallas 1-wire device including DS18S20, DS18B20, DS1822 temperature sensors, DS2438 temperature and A/D, DS2423 dual 32-bit counter and DS2450 Quad 16-bit A/D.
http://cgi.ebay.com.au/OneWire-Controller-for-Basic-Stamp-and-PICAXE_W0QQitemZ130258279756QQcmdZViewItemQQptZBI_Electronic_Components?hash=item130258279756&_trksid=p3286.m63.l1177

Not all on ebay comes out of China :)
 

hippy

Ex-Staff (retired)
One-Wire devices connect to Inputs

From my understanding, data is bidirectional, but despite this, Manual 2 suggests to me that a one-wire device should be connected to an input.

Could somebody please clarify this little query, and perhaps offer an explanation as to why this may be.
It shouldn't really matter whether a one-wire device is connected to an input or an output ( it is bi-directional - thus both - during one-wire communications ), but connecting to an input is a safer bet under normal circumstances.

If the one-wire device becomes convinced it needs to communicate that could be bad news electrically if it were connected to an active output. In the same circumstances, when connected to an input, that would do no harm, plus it is far less likely that a one-wire device would incorrectly think it needs to communicate when connected to an input.
 
Top