Ibutton/one wire simulation

Use this section to discuss your embedded Flowcode projects.
Post Reply
TWPC
Posts: 20
http://meble-kuchenne.info.pl
Joined: Thu Mar 30, 2023 1:51 pm
Has thanked: 3 times

Ibutton/one wire simulation

Post by TWPC »

Hi all,

Wondering if anyone has any experience with the Ibutton (DS1990) and the one wire components and connecting them manually during simulation.

I am trying to run a simple project of reading the one wire then storing the serial of one or multiple ibuttons in the EEPROM. However, trying to find out how to manually trigger the connection between the ibutton and the one wire during simulation, so the serial can be read off of the ibutton component - i have hit a bit of a wall.

I have noticed on the properties panel of the DS1990 component, it has the two options which i assume to be down the right direction i want to go in. One being the 'one wire component' property, where you can choose which one wire component to connect the DS1990 component to. and two, the 'serial' property under the panel simulation category, where you can enter in your own serial.

I have done this using proteus in the past, by connecting the one wire with a link to a push button then a link to the ibutton component and when i want to connect the one wire to the ibutton during the simulation i would press the button. however i am using a different set up this time and do not have access to proteus.

I have searched the Wiki (and the component examples) and online generally, but no luck in finding any helpful direction to achieve this.

Hopefully it's something i'm missing and it's staring at me right in the face.

Eager for anyones pointers and suggestions? Thanks

BenR
Matrix Staff
Posts: 1739
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 440 times
Been thanked: 603 times

Re: Ibutton/one wire simulation

Post by BenR »

Hello,

You have two options.


Option 1.

One you could use the in built API and something like an Arduino Uno to provide a bridge from the simulation to the real world One wire hardware, This would allow you to interact with real One wire devices and confirm your code with additional debugging benefits like the console and real time variable values etc.

The firmware for the Arduino Uno API slave is available here as well as some more info. One wire bus is hosted by default on pin D2.
https://www.flowcode.co.uk/wiki/index.p ... e_Devices)

Then you just need to add the API Arduino Uno to your project, assign the correct COM port for the Arduino and then configure the OneWire component to simulate comms and communicate via the API component.


Option 2.

Use the simulation and set the DS1990 Number Devices component property to however many devices you want to be able to emulate and provide your own ID values for each.


Let us know how you're getting on.

TWPC
Posts: 20
Joined: Thu Mar 30, 2023 1:51 pm
Has thanked: 3 times

Re: Ibutton/one wire simulation

Post by TWPC »

Hi Ben,

Thank you for your reply!

I will try option 1 - I was aware of this when looking at the property options within the component but it was my last resort as i was trying to find an option (option 2) that would be good to test my flow-code while i am on the go with my laptop without any prototyping boards.

For option 2, do you have any pointers.
When trying to emulate multiple ibuttons, i'm only able to put one serial number within the DS1990 component, no matter how many 'number devices' i put. vice versa, if i add multiple DS1990 components and put different serials in each, when i click on the background of the 2D panel where it displays the 'Panel simulation' category, it only shows 1 serial but shows the options for multiple serials (0-9). how is multiple serials inputted?

Lastly, when emulating the different serials when running the simulation, how is this done? using the component macros within the DS1990 or via the consoles window or else?

Thanks
Leon
Kind regards,
Leon

TWPC
Posts: 20
Joined: Thu Mar 30, 2023 1:51 pm
Has thanked: 3 times

Re: Ibutton/one wire simulation

Post by TWPC »

Gave option 2 a go, however i seem to be getting a weird repeating 'getIDbyte' value.

When trying to read a DS1990a using an arduino uno with API firmware uploaded and simulating the 'OneWire_Device_ID_Serial' example from the OneWire Wiki page with the Uno api component added, i seem to be getting the what looks like the familycode repeated for each octet of the serial (1-6).

For example, when connecting a DS1990a key, a value will show on the api console "1" for each variable in the string. The same error was repeated using a FlipperZero emulating a another DS1990 & DS1971, which did the same thing. Making sure i could actually read an Ibutton successfully with this setup, i uploaded the 'OneWire_Device_ID_Serial' example to the arduino with the serial monitor component added to read the DS1990 or various emulated keys from the Flipper, with success.

Does anyone have any idea what could be causing this?
Kind regards,
Leon

BenR
Matrix Staff
Posts: 1739
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 440 times
Been thanked: 603 times

Re: Ibutton/one wire simulation

Post by BenR »

Hello,

Please can you post your project file and I'll investigate for you.

TWPC
Posts: 20
Joined: Thu Mar 30, 2023 1:51 pm
Has thanked: 3 times

Re: Ibutton/one wire simulation

Post by TWPC »

Hi Ben,

The files are both from the Wiki. The only difference being the Arduino API added for the hardware interface for reading the DS1990 keys. i have attached a screenshot for what i am referencing in the previous posts. the serial number string in the project explorer panel reads the key as 1,1,1,1,1,1 rather than what the serial actually is.

thanks for looking into this.
Attachments
screenshot.jpg
screenshot.jpg (120.56 KiB) Viewed 10767 times
OneWire_Device_ID_Serial.fcfx
(19.15 KiB) Downloaded 417 times
Arduino Uno API Firmware.fcfx
(111.54 KiB) Downloaded 423 times
Kind regards,
Leon

TWPC
Posts: 20
Joined: Thu Mar 30, 2023 1:51 pm
Has thanked: 3 times

Re: Ibutton/one wire simulation

Post by TWPC »

Hi Ben,

Hope all is good. did you ever manage to get the time to investigate the project file?

Thanks,
Leon
Kind regards,
Leon

BenR
Matrix Staff
Posts: 1739
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 440 times
Been thanked: 603 times

Re: Ibutton/one wire simulation

Post by BenR »

Hi Leon,

Sorry for the delay.

Please would you mind trying this updated Uno API firmware and see if this makes a difference for you. I'm wondering if the servo motor being active was causing an issue on the one wire pin/timings on the hardware.
Arduino Uno API Firmware.fcfx
(112.21 KiB) Downloaded 951 times

TWPC
Posts: 20
Joined: Thu Mar 30, 2023 1:51 pm
Has thanked: 3 times

Re: Ibutton/one wire simulation

Post by TWPC »

Hi Ben,

no worries at all.

Finally got back in the office and tested the file you sent. Unfortunatly the same thing happens, no differece to the previous files.
Kind regards,
Leon

Qualcomm5
Posts: 11
Joined: Wed Dec 20, 2023 2:13 pm
Has thanked: 6 times
Been thanked: 4 times

Re: Ibutton/one wire simulation

Post by Qualcomm5 »

Just happened across this thread and, for the record, I've coded a considerable number of One-Wire projects these last few years.

Initially I used Flowcode's 'best-fit' components, though now I code everything using lower-level Flowcode 1-Wire component, working in conjunction with datasheets to confirm messaging structure and timings.

One caveat I feel compelled to mention is to not get caught out with EEPROMs. Interestingly, an older 4k 1-wire EEPROM required a quarter of the operating current to write when compared to a later 1k device, so resistive bus power from a 3v3 source wasn't enough to write reliably (if at-all). Therefore, for all such projects with EEPROMs now, I have one pin dedicated for 1-Wire comms of-course, linked to another pin to purely provide phantom power during write cycles - returned to an input when done.

No such issues with the DS1990 of-course, though thought I'd mention this whilst the thought occurred to me :)

All the best,
Brendan

Post Reply