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

Proyecto de ejemplo I2C de aguja indicadora a través de una OLED, tomando los datos de un ADC #17

Merged
merged 2 commits into from
Oct 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35,940 changes: 35,940 additions & 0 deletions examples/I2C/OLED/needles_indicator/example_ADC_needle_indicator.ice

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions examples/I2C/OLED/needles_indicator/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Needle indicator

![](https://github.com/Democrito/repositorios/blob/master/Sensors/I2C/OLED/needle_indicator/IMG/ADC%20to%20OLED%20needle%20indicator.PNG)

This project is an example where you take an ADC and turn the data it gives you into a graph where an indicator needle gives the position of the voltage.

Video of this project: https://www.youtube.com/shorts/e454pzuxG7M

Internally, the part that traces the indicator line is made up of 3 phases in time:

1.) Clear memory.
2.) It does the line calculation and stores it in memory.
3.) Dump the memory on the OLED screen.

The base of the "needle" is fixed, it is always at position (63,63), that is, on a 128x64 pixel screen, the fixed point is completely below the **Y**-axis and halfway along the **X**-axis. To create the feeling that the line always measures the same length (going through a semicircle), two tables are used that contain the values of the sine and cosine for each axis, but with various settings, because the **Y** axis of the OLED screen starts at the bottom. top left and you have to subtract 63 positions. The results given in the tables take into account all these details.

If anyone tests it, I'd advise using a potentiometer that isn't too resistive, ideally one that's between 5K and 20K. The higher the resistance, the noisier it becomes, and the "needle" becomes more unstable. And values lower than 5K can also be used, but be careful not to let too much current flow through the potentiometer and burn it out. The voltage with which I have fed the potentiometer has been 3.3V

Maybe you want to give it another use, and instead of an ADC, you want to put another sensor, if so, go ahead and experiment!

## OLED connection trick in the [Alhambra II FPGA](https://alhambrabits.com/alhambra/).

Each manufacturer lays out the pins in a different way. If you are lucky enough that your OLED display has this pin layout:

**VCC - GND - SCL - SDA** (seen from above)

You can connect it without the need for cables, directly to the [Alhambra II](https://alhambrabits.com/alhambra/). This connection is not at all orthodox, however OLED screens have so little consumption that they can take advantage of the Vref voltage to work perfectly.

![](https://github.com/Democrito/repositorios/blob/master/Sensors/I2C/OLED/drawLines/img/alhambra%20fpga%20oled.jpg)

### Credits: [Obijuan](https://github.com/Obijuan), [Carlos Venegas Arrabé](https://github.com/cavearr) and [Joaquim](https://groups.google.com/g/fpga-wars-explorando-el-lado-libre/c/FN34KJtfhSo).

### Log: https://groups.google.com/g/fpga-wars-explorando-el-lado-libre/c/FN34KJtfhSo