Internships/ProjectIdeas/ArduinoVisualisation: Difference between revisions

From QEMU
No edit summary
No edit summary
 
(7 intermediate revisions by the same user not shown)
Line 5: Line 5:
== Summary ==
== Summary ==


The project will add a visual representation of an Arduino board. By running the code on the emulated AVR processor, the virtual board is updated and displays the changes. Interracting with the code via external events (sensors) triggers changes on the UI.
The project will add a visual representation of an Arduino based board. By running the code on the emulated AVR processor, the virtual board is updated and displays the changes. Interacting with the code via external events (widgets) triggers changes on the UI.


For details of the intended implementation access to [[ArduinoVisualisation:detail]]
For details of the intended implementation access to [[Internships/ProjectIdeas/ArduinoVisualisation:detail]].


== Goal ==
== Goal ==


Be able to use a visual virtual Arduino board, and program it with the Arduino IDE. The result should be easily usable by newcomers to the Arduino world.
Be able to use a QEMU emulated Arduino as part of a virtual board. Use the virtual board for interaction with the QEMU emulated Arduino and for visualization of the board states. Be able to program the emulated Arduino with the Arduino IDE.  
 
The result should be easily usable by newcomers to the Arduino world.


== Deliverables ==
== Deliverables ==


* IDE Integration
The project is divided in several deliverables:
** Configure QEMU with the Arduino IDE (using chardev UART0).
 
** Compile program and upload via serial.
=== IDE Integration ===
** The IDE doesn't need modifications.
 
* Configure QEMU with the Arduino IDE (using chardev UART0).
* Compile program and upload via serial.
* The IDE doesn't need modifications.
 
=== UI (Python) ===
 
* Connect UART1 (via QMP or chardev), display as textbox (input is not important at this point).
 
=== QEMU: GPIO ===
 
* Produce a script to extract the GPIO devices from the netlist.
* Configure QEMU devices to use the previous names/values.
* Publish GPIO events (name as a string and tension as float) via a QMP socket (JSON form?).
* Write a test which runs FreeRTOS to generate a stable output.


* UI (Python)
=== UI (Python) ===
** Connect UART1 (via QMP or chardev), display as textbox (input is not important at this point).


* QEMU: GPIO
* Connect to the QMP socket and display the GPIO events.
** Produce a script to extract the GPIO devices from the netlist.
* Now GPIOs are connected to LEDs. Present graphical LEDs as ON/OFF.
** Configure QEMU devices to use the previous names/values.
* Add an oscilloscope representation (matplotlib widget). Each GPIO can be plugged into the oscilloscope channels.
** Publish GPIO events (name as a string and tension as float) via a QMP socket (JSON form?).
* Add Switches and PushButtons to the UI, generating QMP events which trigger GPIO input.
** Write a test which runs FreeRTOS to generate a stable output.


* UI (Python)
=== QEMU: PWM ===
** Connect to the QMP socket and display the GPIO events.
** Now GPIOs are connected to LEDs. Present graphical LEDs as ON/OFF.
** Add an oscilloscope representation (matplotlib widget). Each GPIO can be plugged into the oscilloscope channels.
** Add Switches and PushButtons to the UI, generating QMP events which trigger GPIO input.


* QEMU: PWM
* Modify script to extract PWM devices used from the netlist.
** Modify script to extract PWM devices used from the netlist.
* Configure QEMU devices to use the previous names/values.
** Configure QEMU devices to use the previous names/values.
* Use QEMU sound API to generate a stream of PWM values (as a wav).
** Use QEMU sound API to generate a stream of PWM values (as a wav).
* Add a QMP command to lookup the PWM wav stream.
** Add a QMP command to lookup the PWM wav stream.
* Write a FreeRTOS test producing a sinusoidal via PWM, verify the wav form.
** Write a FreeRTOS test producing a sinusoidal via PWM, verify the wav form.


* UI (Python)
=== UI (Python) ===
** Lookup the wav stream via the QMP socket, connect to it, display it on the oscilloscope view.
** Add a graphical representation of the LED intensity.


* QEMU: ADC
* Lookup the wav stream via the QMP socket, connect to it, display it on the oscilloscope view.
** Modify the script to extract the ADC devices from the netlist.
* Add a graphical representation of the LED intensity.
** Similarly to PWM, use the sound wav stream to read ADC samples.


* UI: Python
=== QEMU: ADC ===
** Add a textbox to set the ambient temperature (a thermometer is connected to some ADC pins).
** Use a slider to set the tension sampled by the ADC (like if it was a potentiometer).


=== Materials provided ===
* Modify the script to extract the ADC devices from the netlist.
* Similarly to PWM, use the sound wav stream to read ADC samples.
 
=== UI: Python ===
 
* Add a textbox to set the ambient temperature (a thermometer is connected to some ADC pins).
* Use a slider to set the tension sampled by the ADC (like if it was a potentiometer).
 
== Materials provided ==
 
=== Boards definition ===
 
[https://gitlab.com/xcancerberox/arduino-example-circuits/-/blob/master/arduino_led/arduino_led.sch A specific circuit configuration] represented as a netlist.
 
=== Arduino code examples ===
 
[https://www.arduino.cc/en/Tutorial/BuiltInExamples Preset Arduino exanples] compliant with QEMU limitations:


* [https://gitlab.com/xcancerberox/arduino-example-circuits/-/blob/master/arduino_led/arduino_led.sch a specific circuit configuration] represented as a netlist.
* [https://www.arduino.cc/en/Tutorial/BuiltInExamples preset Arduino tests] compliant with QEMU limitations.
* [https://www.arduino.cc/en/Tutorial/Blink Digital example]: "Blink: Turn a LED on and off."
* [https://www.arduino.cc/en/Tutorial/Blink Digital example]: "Blink: Turn a LED on and off."
* [https://www.arduino.cc/en/Tutorial/Fading Analog example]: "Fading: Use an analog output (PWM pin) to dim a LED."
* [https://www.arduino.cc/en/Tutorial/Fading Analog example]: "Fading: Use an analog output (PWM pin) to dim a LED."
* [https://www.arduino.cc/en/Tutorial/AnalogInput Analog example]: "Analog Input: Use a potentiometer to control the blinking of a LED."
* [https://www.arduino.cc/en/Tutorial/AnalogInput Analog example]: "Analog Input: Use a potentiometer to control the blinking of a LED." QMP commands documentation
* QMP commands documentation
 
=== Extra tasks ===


[https://www.mail-archive.com/qemu-devel@nongnu.org/msg681744.html Additional tasks are available] for applicants who completes the project.
[https://www.mail-archive.com/qemu-devel@nongnu.org/msg681744.html Additional tasks are available] for applicants who completes the project.
    
    
=== Essential skills required ===
== Essential skills required ==


* Fluent in C
* Fluent in C
Line 74: Line 93:
Electrical engineering background is not essential
Electrical engineering background is not essential


=== Details ===
== Details ==


* Skill level: intermediate to advanced
* Skill level: intermediate to advanced

Latest revision as of 12:29, 9 March 2020

QEMU emulated Arduino board visualizer

Execution flow.

Summary

The project will add a visual representation of an Arduino based board. By running the code on the emulated AVR processor, the virtual board is updated and displays the changes. Interacting with the code via external events (widgets) triggers changes on the UI.

For details of the intended implementation access to Internships/ProjectIdeas/ArduinoVisualisation:detail.

Goal

Be able to use a QEMU emulated Arduino as part of a virtual board. Use the virtual board for interaction with the QEMU emulated Arduino and for visualization of the board states. Be able to program the emulated Arduino with the Arduino IDE.

The result should be easily usable by newcomers to the Arduino world.

Deliverables

The project is divided in several deliverables:

IDE Integration

  • Configure QEMU with the Arduino IDE (using chardev UART0).
  • Compile program and upload via serial.
  • The IDE doesn't need modifications.

UI (Python)

  • Connect UART1 (via QMP or chardev), display as textbox (input is not important at this point).

QEMU: GPIO

  • Produce a script to extract the GPIO devices from the netlist.
  • Configure QEMU devices to use the previous names/values.
  • Publish GPIO events (name as a string and tension as float) via a QMP socket (JSON form?).
  • Write a test which runs FreeRTOS to generate a stable output.

UI (Python)

  • Connect to the QMP socket and display the GPIO events.
  • Now GPIOs are connected to LEDs. Present graphical LEDs as ON/OFF.
  • Add an oscilloscope representation (matplotlib widget). Each GPIO can be plugged into the oscilloscope channels.
  • Add Switches and PushButtons to the UI, generating QMP events which trigger GPIO input.

QEMU: PWM

  • Modify script to extract PWM devices used from the netlist.
  • Configure QEMU devices to use the previous names/values.
  • Use QEMU sound API to generate a stream of PWM values (as a wav).
  • Add a QMP command to lookup the PWM wav stream.
  • Write a FreeRTOS test producing a sinusoidal via PWM, verify the wav form.

UI (Python)

  • Lookup the wav stream via the QMP socket, connect to it, display it on the oscilloscope view.
  • Add a graphical representation of the LED intensity.

QEMU: ADC

  • Modify the script to extract the ADC devices from the netlist.
  • Similarly to PWM, use the sound wav stream to read ADC samples.

UI: Python

  • Add a textbox to set the ambient temperature (a thermometer is connected to some ADC pins).
  • Use a slider to set the tension sampled by the ADC (like if it was a potentiometer).

Materials provided

Boards definition

A specific circuit configuration represented as a netlist.

Arduino code examples

Preset Arduino exanples compliant with QEMU limitations:

  • Digital example: "Blink: Turn a LED on and off."
  • Analog example: "Fading: Use an analog output (PWM pin) to dim a LED."
  • Analog example: "Analog Input: Use a potentiometer to control the blinking of a LED." QMP commands documentation

Extra tasks

Additional tasks are available for applicants who completes the project.

Essential skills required

  • Fluent in C
  • Comfortable programming in Python
  • Knowledge of Javascript might be useful (Java will *not* be used).
  • Working knowledge with User Interfaces

Electrical engineering background is not essential

Details

  • Skill level: intermediate to advanced
  • Language: C
  • Mentor: Philippe Mathieu-Daudé <f4bug@amsat.org> ("f4bug" on IRC)
  • Mentor: Joaquin de Andres <me@xcancerberox.com.ar> ("xcancerberox" on IRC)