Internships/ProjectIdeas/ArduinoVisualisation

From QEMU

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)