Line: 1 to 1 | |||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||
< < | |||||||||||||||||||||||||||||
> > | Digital to Analogue Conversion | ||||||||||||||||||||||||||||
Digital to Analogue Conversion:the mcp4275Lecture 10
| |||||||||||||||||||||||||||||
Line: 11 to 11 | |||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||
< < | However: The world is mostly analogue: | ||||||||||||||||||||||||||||
> > | However: The world is mostly analogue: | ||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
Line: 19 to 19 | |||||||||||||||||||||||||||||
Converting from digital to analogue | |||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||
< < | Since our computer is a digital device we must
| ||||||||||||||||||||||||||||
> > | Since our computer is a digital device we must
| ||||||||||||||||||||||||||||
Digital to analogue conversion | |||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||
< < | A digital to analogue converter does not really convert into a continuous waveform Since we have digital values as a base, there will be steps in the output waveform The size of these steps depends on the resolution of the DAC What is the smallest step a 12 bit DAC can produce on a 0..5V scale? | ||||||||||||||||||||||||||||
> > | A digital to analogue converter does not really convert into a continuous waveform Since we have digital values as a base, there will be steps in the output waveform The size of these steps depends on the resolution of the DAC What is the smallest step a 12 bit DAC can produce on a 0..5V scale? | ||||||||||||||||||||||||||||
Can we smooth the output signal? | |||||||||||||||||||||||||||||
Line: 55 to 55 | |||||||||||||||||||||||||||||
have a look at this excellent tutorial![]() | |||||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||||
> > | |||||||||||||||||||||||||||||
The MCP4725 12 bit DAC | |||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||
< < | As a demo device we bought the MCP4725 DAC This is a 12 bit DAC which can be accesses by the I2C bus Here is its data sheet ![]() | ||||||||||||||||||||||||||||
> > | As a demo device we bought the MCP4725 DAC This is a 12 bit DAC which can be accesses by the I2C bus Here is its data sheet ![]() | ||||||||||||||||||||||||||||
and here a photo of the device
![]() | |||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||
< < | The I2C bus | ||||||||||||||||||||||||||||
> > | The I2C bus | ||||||||||||||||||||||||||||
The I2C bus is an industrial standard 2 wire bus using a data (SDA) and a clock (SCL) line. | |||||||||||||||||||||||||||||
Line: 97 to 98 | |||||||||||||||||||||||||||||
thus creating a short circuit.
| |||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||
< < | I2C Master and slave | ||||||||||||||||||||||||||||
> > | I2C Master and slave | ||||||||||||||||||||||||||||
The I2C bus has at least one master (in our case the interface in the
Raspberry Pi’s ARM processor) and several slaves
We have the following I2C slave devices: | |||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||
< < |
| ||||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||
< < | I2C addressing | ||||||||||||||||||||||||||||
> > | I2C addressing | ||||||||||||||||||||||||||||
Since there can be several slaves on the bus there must | |||||||||||||||||||||||||||||
Line: 128 to 129 | |||||||||||||||||||||||||||||
user to have several devices of the same type on the bus
| |||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||
< < | I2C buses and I2C addresses on the Raspberry Pi | ||||||||||||||||||||||||||||
> > | I2C buses and I2C addresses on the Raspberry Pi | ||||||||||||||||||||||||||||
The Raspberry Pi has 2 I2C buses with bus 1 being put onto the cobbler | |||||||||||||||||||||||||||||
Line: 139 to 140 | |||||||||||||||||||||||||||||
![]() | |||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||
< < | Initiating a I2C transfer | ||||||||||||||||||||||||||||
> > | Initiating an I2C transfer | ||||||||||||||||||||||||||||
![]() | |||||||||||||||||||||||||||||
Line: 166 to 167 | |||||||||||||||||||||||||||||
A write cycle | |||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||
< < | A write cycle: After the start condition the device address. The eighth bit, the R/W bit is kept low. The second data byte is considered the register byte and the last one the data byte The slave acknowledges each byte transfer. | ||||||||||||||||||||||||||||
> > | A write cycle: After the start condition the device address. The eighth bit, the R/W bit is kept low. The second data byte is considered the register byte and the last one the data byte The slave acknowledges each byte transfer. | ||||||||||||||||||||||||||||
![]() | |||||||||||||||||||||||||||||
Line: 187 to 188 | |||||||||||||||||||||||||||||
![]() | |||||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||||
> > | I2C clock frequencyI2C bus supports different transfer speeds:
MCP4725![]() Specs of the MCP4275![]() MCP4275 registers![]() MCP4275 I2C fast writeHow does the I2C write cycle look like in the MCP4275? The MCP4275 fast write cycle write only the DAC register and not the EEPROM. This is enough for what we want to do.![]() MCP4275 normal write cycle![]() Read back the DAC data![]() pigpio: i2c_open![]() I2C access initialization with pigpioIn addition to opening the library with pigpio_start we now also must make a connection to the I2C driver:![]() Accessing I2C with pigpioComing back to fast write mode, we must write 3 bytes:
![]() i2c_write_byte_dataThe pigpio library provides a function![]() Writing the DAC value, an exampledacValue is a short, while reg and value are unsigned char![]() DAC performanceThere are a number of criteria which characterize the performance of a DAC
Relative accuracy
Differential non-linearity
Offset error
Gain error
Settling Time
| ||||||||||||||||||||||||||||
%SLIDESHOWEND%
-- ![]() | |||||||||||||||||||||||||||||
Line: 204 to 330 | |||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||
< < |
| ||||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||
< < |
| ||||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||
< < |
| ||||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
Line: 217 to 343 | |||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||||
> > |
|
Line: 1 to 1 | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||||||
Changed: | |||||||||||||||
< < | Digital to Analogue Conversion: the mcp4275Lecture 10 | ||||||||||||||
> > |
Digital to Analogue Conversion:the mcp4275Lecture 10 | ||||||||||||||
Analogue versus digital | |||||||||||||||
Line: 63 to 63 | |||||||||||||||
![]() | |||||||||||||||
Added: | |||||||||||||||
> > | The I2C busThe I2C bus is an industrial standard 2 wire bus using a data (SDA) and a clock (SCL) line. Adding Vcc and Gnd we need a mere 4 wires to connect a I2C device to the Raspberry Pi cobbler The I2C bus was invented by PhilipsTypical I2C connections![]() Open drain signalsOpen drain signals mean that you can pull a line down but you cannot set it to a high level. If nobody pulls the line down, then it is at Vcc level, pulled up by a pull-up register. Like this the contention problem is solved where one device tries to set a line to a high level, while another sets it to low, thus creating a short circuit.I2C Master and slaveThe I2C bus has at least one master (in our case the interface in the Raspberry Pi’s ARM processor) and several slaves We have the following I2C slave devices:
I2C addressingSince there can be several slaves on the bus there must be a means of distinguishing them through addressing: Every I2C slave has a 7 bit address associated with it Usually this address is determined by the manufacturer but often there are address pins on the devices allowing the user to have several devices of the same type on the busI2C buses and I2C addresses on the Raspberry PiThe Raspberry Pi has 2 I2C buses with bus 1 being put onto the cobbler You can find out the addresses of the I2C slaves are currently connected with the i2cdetect command![]() Initiating a I2C transfer![]() Start stop conditionsThe master starts a transfer by creating a start condition:
![]() Data transmissionData are transmitted with the SDA line stable with SCL is high![]() A write cycleA write cycle:After the start condition the device address. The eighth bit, the R/W bit is kept low. The second data byte is considered the register byte and the last one the data byte The slave acknowledges each byte transfer. ![]() The read cycleThe read cycle is a bit more complex: First the master sends the slave address with R/W set to write Then it sends the register information. After that another address byte is sent, this time with RW set to read And finally the slave sends the data. The master still sends the clock but releases the SDA line allowing the slave to control it![]() | ||||||||||||||
%SLIDESHOWEND%
-- ![]() | |||||||||||||||
Line: 86 to 210 | |||||||||||||||
| |||||||||||||||
Added: | |||||||||||||||
> > |
|
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
![]() Slide 1: Digital to Analogue Conversion: the mcp4275 | ||||||||
Line: 47 to 47 | ||||||||
with which we send these values to the DAC.
| ||||||||
Added: | ||||||||
> > | How does a DAC work?![]() ![]() | |||||||
The MCP4725 12 bit DACAs a demo device we bought the MCP4725 DACThis is a 12 bit DAC which can be accesses by the I2C bus Here is its data sheet ![]() | ||||||||
Line: 77 to 85 | ||||||||
| ||||||||
Added: | ||||||||
> > |
|
Line: 1 to 1 | |||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
![]() Slide 1: Digital to Analogue Conversion: the mcp4275 | |||||||||||||||||||||||||||||
Line: 27 to 27 | |||||||||||||||||||||||||||||
A digital to analogue converter does not really convert into a continuous waveform Since we have digital values as a base, there will be steps in the output waveform The size of these steps depends on the resolution of the DAC What is the smallest step a 12 bit DAC can produce on a 0..5V scale? | |||||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||||
> > | Can we smooth the output signal?Yes, it is possible to smooth out these steps. We need a low-pass filter, which filters out high frequencies (the abrupt steps we have in the output signal) and lets pass only slower transitions. When looking carefully at the output of our sine generator you will also see these steps. In this case however they come from the limited number of sine values (100) we calculate. To improve the resolution we would have to increase the number of samples and the frequency with which we send these values to the DAC.The MCP4725 12 bit DACAs a demo device we bought the MCP4725 DACThis is a 12 bit DAC which can be accesses by the I2C bus Here is its data sheet ![]() ![]() | ||||||||||||||||||||||||||||
%SLIDESHOWEND%
-- ![]() | |||||||||||||||||||||||||||||
Line: 34 to 62 | |||||||||||||||||||||||||||||
Comments\ No newline at end of file | |||||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||||
> > |
|
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Added: | ||||||||
> > |
![]() Slide 1: Digital to Analogue Conversion: the mcp4275Lecture 10
Slide 2: Analogue versus digitalUp to now we only treated digital signals:
The world is mostly analogue:
Slide 3: Converting from digital to analogueSince our computer is a digital device we must
Slide 4: Digital to analogue conversionA digital to analogue converter does not really convert into a continuous waveformSince we have digital values as a base, there will be steps in the output waveform The size of these steps depends on the resolution of the DAC What is the smallest step a 12 bit DAC can produce on a 0..5V scale? -- ![]() Comments |