Testing New UI Without Flashing?

Does anybody know a way to test a UI on the computer before flashing it to a light? I am think something along the lines of using a keyboard botton as the switch input, and getting the data values back on display.

I am working on a custom UI for my KR4. It would just be easier to run through prototyping on the computer and make sure everything is working how I want to before reflashing my light. I feel like I will probably have to compile and run at least 5 times before I have something that boots up and runs bug free, let alone a good ui that works for me…. I also don’t have the snazzy pogo pin thing for flashing, so it would save me some work soldering and desoldering.

Any thoughts?

I reflashed maybe a thousand times before i got what i want. And get pogo pins

doubt it

I’ve found something! Tinkercad by auto desk does circuit simulation, with code integration for micro-controllers such as Arduino and attiny. It seems if we just made a cad mock up of the driver circuit, we could easily test our UIs in tinker cad with a simulated lightoutput and everything.

Anybody want to test this? Ill try find a schematic and see if I can build the driver circuit and test it with a known software.

https://www.instructables.com/Unlimited-Input-Output-on-Arduino/?

it probably will be too slow or not model what you are interested in

wle

I have a small test bed on which I have a cell holder, a switch, a driver, and an LED hooked up on a board. I can connect (solder) in a driver and change the led, switch, and cell if desired at will.

Flash new code and test. Repeat as necessary.

why do you say that wle? I see no reason why that would be the case

That’s a cool idea Don, I might have set something like that up. Then at least I could test it without desoldering and assembling the light every time. Could the aux leds be simulated with 1 RGB emitter and the main leds with 1 emitter?

Maybe, but I am not well-versed in electronics, so I can’t say with confidence.

When testing, I tend to use the same parts layout I want in the finished product.

I have a heat sink the LED mcpcb can be stuck onto either with scews if the mcpcb fits the assorted holes or with the appropriate tape.

experience and general cynicism EE for 40+ years

but go ahead :slight_smile:

the last 10% takes 90% of the time

wle

yeah that is a good idea

you can also make measurements at points that would be inaccessible if it was in a real light

wle

I’ve done some debugging with simavr and simulavr, but it’s much easier to just run it on real hardware because you have to simulate all input as well.

how would you model the driver and the led?

do they have .sim files or something?

You don’t. That’s the problem. You load the firmware, connect with gdb and start the execution. Then it will do all kind of strange things, because the real hardware is missing. When it wants to read an ADC value, you set a breakpoint/expression and return the value it should read. Same for the button: If you want to press it, it is easier to emit the event yourself because you can’t change the digital input value with the right timing manually. “LED brightness” can be seen by reading the PWM registers or reading variables at the right time. Debugging firmware without the hardware is always a big mess.

This setup reads like it's what I've long wanted to do. If doing so is not an imposition, would you be willing to take some photos of your layout, including straight overhead with labels of anything that might not be easily recognizable?

Then either post the photos within this thread or send them by PM. I would be extremely grateful for your consideration, with complete understanding if it's not convenient! Thanks!

yeah that doesn;t seem very useful

wle

Buy Pogo Pins

Get a light for testing only or build a testbed from flashlight parts.

e.g. buy a Wurkkos T10 put it apart. Use an old big PC heatsink to mount the LED board

Naked ATtiny, a 5 mm LED with a resistor and a button, put everything onto a breadboard, there you have your development board.

I need to run VMWare on my flashlight

Thanks for the ideas everyone. I’m not willing to waste any resources getting things I will in all likelyhoodnly use one time. I will probably tear my kr4 down and set it up as a testing station until I’ve got everything dialed in.