Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development and Management of WOKWI Simulations for MoonRatII #304

Open
ForrestErickson opened this issue Aug 9, 2024 · 4 comments
Open
Assignees
Labels
enhancement New feature or request

Comments

@ForrestErickson
Copy link
Collaborator

Summary

A WOKWI Simulation or Simulations of the MoonRatII Version 2 PCB wiring my be of great value

Request

Have any of you created a schematic in WOKWI that has good fidelity to the MoonRatII Version 2 PCB ?
Lee suspects there may be more than one.
Can we share this work soon so? I hope to help Robert with the troubleshooting he is doing right now on a unit he hopes to take into the field very soon?

If there is already in this repository a WOKWI simulation please help me find it.

Thanks,
Lee Erickson

@HJGV05
Copy link
Collaborator

HJGV05 commented Aug 9, 2024

Hello Mr Lee!

I hope you are fine, sure, here is the last Wokwi project we created: https://wokwi.com/projects/390933163302682625

It was attached to the script versions, but since we used some libraries that are not available in Wokwi (like the eFLL library) we did not continue updating it. I hope it helps!

Best Regards,

Horacio García

@ForrestErickson
Copy link
Collaborator Author

@HJGV05
It appears that the EFLL libaray can be added through the WOKWI library manager.
image

and
image

@ForrestErickson
Copy link
Collaborator Author

ForrestErickson commented Aug 9, 2024

I have copied the most current code into a new WOKWI at:
https://wokwi.com/projects/405744143993619457

It fails to compile:
image

I assume this is due to the UNO Version 4 specific code (the analog reference) but am not certain.

Confirm AR_DEFAULT Is the Problem

I copied a working R4 WOKWI sketch from: https://wokwi.com/projects/398611563830221825
I compiled and ran it.

I added a line into setup,
analogReference(AR_DEFAULT); // Internal reference

I confirmed the same error
image

I conclude that for the WOKWI environment the value AR_DEFAULT is not defined. I would guess that the underlying hardware for the Analog To Digital conversion is unlikely to be supported by WOKWI.

@RobertLRead
Copy link
Contributor

I made some changes as defined below, which allow it do compile; I interpret this as being either WOKWI does not today support the R4 at all, or we have not properly configured it to do so. (Please observed commented-out lines below!
I do not assume this works; I just got it to compile. @ForrestErickson

`#elif defined(R4) //Configuration for Arduino UNO R4
// analogReference(AR_DEFAULT); // Internal reference
analogReference(DEFAULT); // Internal reference
delay(10); // Awaiting reference stability
// float sensorValue = map(analogReference(), 0, 5.0, 0, 255.0); // Internal reference mapping
float sensorValue = map(DEFAULT, 0, 5.0, 0, 255.0); // Internal reference mapping
long vcc = (1000 * 1.1 * 1023) / sensorValue;

#else
#error Serial.println("Unsupported board selection.");
#endif
return vcc;
}

void setup() {

#if defined(R4)
// analogReadResolution(10);
// analogReference(AR_DEFAULT);
#else`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants