The High logic level for arduino is 5V but the High logic for our chip-on-board is 3.3V, so if we directly connect the wires that we just soldered to arduino, chances are that we will fry the chip-on-board, something that we just cannot afford to do. (It is possible that the pins on chip-on-board are 5v tolerant, but due to lack of any literature we will avoid taking risks.) So how to tackle this problem ??
Now when we think about this then we might come up with these solutions –
- Use the analog pins instead of digital and in the analogWrite function use the integer 168 to get 3.3 volts.
- Voltage divider circuit.
- Use Level Shifter ICs.
Now the first solution is WRONG and will most probably damage the chip-on-board.
The correct solution is using level shifter ICs or a voltage divider.
Now lets discuss why the first solution is wrong ?
We know that the analog pins in output mode give PWM signals. The thing with PWM signals is is that their average value comes out to be 3.3 V , they do not provide a steady DC output of 3.3 V. The duty cycle with 168 as the parameter in analogWrite function will be approximately 66% i.e for 66% of the time it is outputting 5V and the rest of the time it is outputting 0V so that the average comes 3.3V. But we must note here that it still outputs 5V for majority of time , and during the time it is outputting 5V it is capable of damaging the chip-on-board.
Hence we are left with using either Level Shifter ICs or making a voltage divider.
Whats the fun in making a voltage divider circuit 😛 ??
So lets focus on using the level shifter ICs. Now there are a lot of solutions when it comes to using the ICs. Some possible solutions are –
- 74125 (might be obsolete)
- 74245 – http://www.adafruit.com/datasheets/sn74lvc245a.pdf
- 74HC4050 – http://www.nxp.com/documents/data_sheet/74HC4050.pdf
- TXS010X series
- TXB010X series
- Field effect transistors with proper biasing
There are probably more solutions than what i have listed and you can get a very comprehensive list from HERE .
I am using the BSS138 (from adafruit), so the next post would be about how to interface arduino , logic level converter and the RC pcb together.