SPI values
hondaman900 opened this issue · 1 comments
Hi Chris, Stephen here again. I tried leaving you this question over on Easy EDA as it seems the more-appropriate place, but they block commenting.
Can you tell me what are the range of voltages/values to send via the ESP32's SPI to the MCP4822 DAC? In other words, if I wanted to draw a rectangle around the perimeter of the maximum projection area, what would be the values I'd send via SPI to reach each corner? I'm hoping your answer will help me determine how to plot points within that cartesian plane using your board and app.
Thanks in advance,
Stephen
Hey Stephen,
Apologies for not replying earlier. This is a slightly difficult question to answer as the maximum projection area is a bit of a loose concept.
The MCP4822 has 12 bits of resolution, so sending 0 will output 0v and sending 4095 will output 4.096v. We subtract 2.048 volts from that so we have a range of -2.048 to +2.048 and then amplify that by 2 to give us -4.096 to +4.096
This is a fairly safe conservative range to feed into the galvos - there's no danger of overdriving them and causing damage.
To try and define the maximum projection area - this really comes down to how fast you want to display your images. If you want a very big display then the galvos need to move a much longer distance - this tends to cause a lot of overshoot and distortion.
I ended up reducing the numbers I was sending out by half so I only use 1024 to 3072 giving me an output voltage of -2.048 to +2.048. I did this because driving it with the full range was giving me a lot of distortion and I was getting a reasonably large projection area with just these small values.
So, to summarise it a bit, You need to output values that are centred around 2048, how far you can go around that number will depend on how good your galvos are.
Hope that all makes sense!