Re: Dallas 1-Wire Support

310 views
Skip to first unread message

Ytai Ben-Tsvi

unread,
Jan 8, 2013, 11:26:20 PM1/8/13
to ioio-...@googlegroups.com
No such plans currently. Perhaps use another sensor (analog or I2C)?


On Sat, Jan 5, 2013 at 9:44 AM, Matthew Toso <taka...@gmail.com> wrote:
Are there plans to add support for the Dallas 1-wire protocol to the IOIO? I would like to use my IOIO to read temperature from the DS18B20.

--
You received this message because you are subscribed to the Google Groups "ioio-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/ioio-users/-/GYmNbbEXVLoJ.
To post to this group, send email to ioio-...@googlegroups.com.
To unsubscribe from this group, send email to ioio-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ioio-users?hl=en.

Matthew Toso

unread,
Jan 10, 2013, 9:10:44 PM1/10/13
to ioio-...@googlegroups.com
Ok. Thanks for the response.

Ytai Ben-Tsvi

unread,
Jan 16, 2013, 9:45:12 PM1/16/13
to ioio-...@googlegroups.com
Doing precise-timing on the Android side won't work as result of latency and jitter that may be order of milliseconds.
Doing it bit-bang-style on the firmware side is also problematic, as it will block other stuff from running, and remember, that in the IOIO environment everything can work in parallel (which is important IMO).
So the proper way to do it would probably be using an outcompare (like the modules used for PWM) for precise output pulse generation and incapture (like the modules used for PulseInput) for precise input pulse measurement. Both take place without disturbing the CPU and can fire interrupts when done. Of course, this sort of coding complicates things for the firmware developer, but makes life happy for the end-users.


On Wed, Jan 16, 2013 at 4:14 PM, <3ma...@gmail.com> wrote:
Circa 1997-1998, I used the DS1994 1-wire cans for a PIC16C5X-based project.  Dallas, at the time, had sample code written in various flavors of microcontroller assembly language, *not* including the PIC family, and a few high-level languages like C.  They also meticulously described the timing of the protocol in terms even a green-horn could understand.
The routines for communicating with these 1-wire devices were, and are, simple enough to de-cypher and port from a related language and their description.  I ended up porting the example code from 8051 assembly language to Parallax PIC assembly language.  Since all you're doing is banging a single data pin high or low to create square-wave pulses, or measuring the length of pulses sent by the device, and the timing of the communication is quite slow in the grand scheme, you should be able to code this interface against any general purpose I/O pin.  I also recall seeing code written more recently, for other dev platforms like Arduino, in easier to understand language (BASIC-like, not assembly!)  You'll have to "pay attention" to the port during a transaction to get the timings right, but since the timings are so slow, and relatively fault tolerant, (as far as pulse length,) I can't imagine it would be that difficult to achieve reliable 1-wire communication through the abstraction layer of Java in this environment.

That said, unless you've got some special reason to use the 1-wire devices, (for user-inserted data via the cool can package,) you'd probably have much better luck using sensors that use one of the other interfaces already natively supported by the IOIO.
To view this discussion on the web visit https://groups.google.com/d/msg/ioio-users/-/a2MSWGN7H3QJ.
Reply all
Reply to author
Forward
0 new messages