Testing Vpp control

Setting up:

It’s been a while since I have worked with the board powered up.  I hooked up the lithium cell and USB cable to my Computer, then the charger started doing it’s job. I then started the serial terminal on my computer.  I hooked up my Oscilloscope to watch Vpp live during testing.

The code still in the board tries to regulate Vpp according to the reading it gets from the ADC.  This isn’t working well.  Since It’s been a while, I built and re-uploaded the project without any changes. This reminded me how I had the tools set up. Of course, the behavior of the board didn’t change with this upload. Next, I disabled the feedback loop to do my testing.

Voltage verses duty cycle:

Continue reading

Cutting in the Vpp prototype

I opened my design schematic and realized I had already designed the Vpp control design. So now I have two options. I used an inductor in the first design to filter the base current of the voltage divider.  In the second design, I just used an RC low pass filter to filter the base current of the transistor.  This project has gone long enough that I am forgetting details of things I have already done.

Prototype Choice:

I prefer the design I did last week to the earlier design. If I find the system doesn’t regulate very well, I may incorporate parts of the earlier design.

Cut in Planning:

Looking at the last schematic and schematic where I want to end up, I can see I need to remove Q4, 5, R6 and R9. I then need to attach pin 1 of the FAN5331 to Pulse. Pin 2 to GND, Pin 3 to Vps. Pin 4 and 5 to the supply side of L1. Short Q4 Pin2 to 3. Finally replace R9 with a transistor with filter to HVPulse.

Continue reading

Vpp Regulation test

Second Thoughts:

I am having second thoughts about co-processor model.  This significantly increases the complexity of the firmware for this design.  I haven’t ruled out any options yet.  If I can get a good voltage for Vpp without the co-processor, I may decide to go back to the level shifter.

Programmatically controlling Vpp:

I have been thinking about how to make an “adjustable voltage” switching regulator adjustable by the microcontroller.  By putting a transistor on the low side of the voltage divider feedback, I believe I can have linear control of the generated voltage controlled by the Sigma-Delta output. I got a basic circuit design from the FAN5331 datasheet. I then replaced the ground side resistor of the feedback voltage divider with an NPN transistor.  I came up with the circuit below.

The FAN5331 has a 1.25 volt reference comparator to decide if it needs to generate more voltage or wait.  With the Sigma Delta input to r3 at 0 out of 255, the transistor will never turn on and the voltage on the feedback will be above the 1.25V threshold and the regulator will effectively shut down.

Resistor Calculations:

Continue reading

Co-processor decision

The ADC problem as well as cost of the voltage level shifter leads me to think having a co-processor is the best solution.  The last two posts look at 8 bit and 16/32 bit processors I could use for this purpose.  For firmware update, I want the co-processor to have USB capability.  This would allow me to get rid of the USB to serial bridge chip.

The choices:

I ended up with Microchip as the manufacturer for both architectures. The PIC16 line of controllers and the SAM32C21 line of controllers.

Continue reading

16/32 bit Co-Processor Research


I went on vacation last week with my grandson.  I had to finish client work before I could go so two weeks ago I didn’t get a post done and last week, I was spending time with my family. I was hoping to post ahead of time and schedule them out, but it didn’t happen.  Sorry to anyone looking forward to my posts.

ADC Feature Request:

The request I made in the bug report section of the Espressif forum has been viewed 376 times but still no indication that they are working on it.  August 16, 2016 is the last update to the SDK.


Ti makes a great processor line with cloud based tools. Which means they can be developed on any platform.

I had to disqualify the MSP430 line of processors because they all have a max voltage of 3.7 or lower.


The STM32 are ARM based architecture chips. They all have a max operating voltage of 3.6V or less. They do have good GCC support so they can be developed on any system. The max voltage issue disqualifies the STM32.


The PIC32 line of chips do not have any devices that run at 5 volts. This disqualifies the PIC32 line from Microchip.


Microchip acquired Atmel recently.  Atmel used to sell the SAM32 ARM architecture line of MCUs.  So Microchip now carries this line of chips.  The ATSAMC2  line all operate from 2.7 to 5.5 Volts.  The 2.7 is a little high on the low side but it is acceptable.  ARM compilers are available on all the major desktop operating systems. The lowest marketing price for this line of chips is US $1.36.  The smallest flash available is 32KBytes which should be far more than enough for this project.  This chip runs at 48 MHz.  Which should be fast enough.  It also has 32 pins which should be enough IO.  The ATSAMC21E15A is a strong candidate.

Other Controllers:

Do you have any suggestions for 16 or 32 bit Micro Controllers?  Are there any you would like me to look at for this project?

8 bit Co-processor Research

Seeed Studio:

Seeed Studio has asked that I put a link to their site on this blog.  I have used Seeed Studio Fusion service and I was/am satisfied with them. So I have added a link in the right hand column.

This Week:

I decided to research potential processors for the level converter circuit.

Wikipedia has a list of common microcontrollers. This is a good resource when looking for possibilities.  I will only look at a few processors from companies I am familiar with. If this co-processor chip is going to act as a level shifter, It needs to be able to drive and accept 5 Volts.


ST Microelectronics makes STM8 and STM32 lines of processors. I will look at the STM32 line next week when I research 32 bit controllers.

The STM8 line has many processors that have a max operating voltage of 5.5 Volts.  Of the processors that can operate at 5.5 Volts, the lowest operating voltage is 2.95 volts.  This might be high for some ARM systems I would want to support.  ST Microelectronics supports their devices very well on Mac and Windows.  There is a good open source compiler available for Linux called Small Device C Compiler(SDCC). The STM8 line of chips doesn’t have any built in USB capabilities. The STM8 is a possibility.


Continue reading


Side Project:

I played with the OLED display this week. With the data I have on the display that makes any sense, it should be working.  I received sample code from the distributor I bought the display from.  I modified it to work on arduino, and still no display.  I may have damaged my display while probing the signals.  I shorted Vdd to Vcc with my scope probe.  I saw a little spark and I was no longer getting 13 Volts on Vcc

Included with the sample code is a schematic that has a drop down voltage regulator on it to drive Vcc.  The drop down voltage regulator is configured to regulate to 6 Volts. However, the input to the drop down regulator is Vdd. According to the SSD1332 data sheet, Vdd should not exceed 3.6 Volts.  This suggests that I have incomplete information.  The datasheet also says that Vcc should be between 7 and 20 Volts.

I am thinking I will disable the switching regulator and do further testing while sending individual commands.  I think I might try one of the 8 bit interfaces to see if I can write to and read from RAM. That will confirm the data interface is wired correctly.

Port Expander vs Level Shifter:

Continue reading

Refactoring Electronics (Hardware V00K)

Side Project:

I still haven’t gotten the OLED display working.  I am beginning to question Pinouts and even if the driver IC listed by the seller(s) is correct.  At this point I can’t even tell if the device is seeing my commands. I checked the board for shorts/solder bridges and even replaced the OLED display. I still can’t get anything to show up on the display.

I think a reasonable test would be to measure current to the display and send it a power on command.  If I am sending commands correctly, I should see a change in current draw.  After that, I will try working through the commands available in the datasheet for a SSD1332 chip looking for a change in the display or the current draw.


Just like refactoring the code, It’s time to refactor the electronics design.  I checked on my feature request on the Espressif forum. Nothing new has happened.  So I am considering adding an external ADC to measure voltages.

Planning and Research:

Continue reading

Successful Test

Side Project:

I got the parts to build the OLED breakout PCB this week. I got them assembled and connected to my test STM32 Arduino device. Unfortunately, I didn’t get anything to show up on the display.  I did measure the 13.8 volts on the high voltage part of the circuit. (I wasn’t sure if the inductor I chose for this voltage could handle the current. I am still not sure)

The STM board got hot quickly when trying to drive the OLED. This leads me to believe that the OLED is drawing too much current.  I expect this display to work as well as the test display I have been using. It should draw about the same amount of current. My first guess is I have a solder bridge somewhere on the PCB.


I created a C project with multiple files and it worked without any problems. So I did a little  research and found that when I add C into a C++ project I need to tell the compiler which functions are written in C.  I found that I can wrap the #include in an extern “C”{} declaration.

Still Looking for a Fail:

Continue reading

Multi File Failure

Side Project:

I received the OLED breakout PCBs from OHSpark this week #SSD1332Breakout. I also received some of the parts to build it with.  I am hoping to have a working OLED by the end of this next week.  I will start with it in SPI mode to use existing code that I know works.  Then I will have to migrate the library to use 8 bit parallel interface mode.

I have decided to move forward with the STM32F103 as the microcontroller for the Arduino Compass Toy.  The microchip part is still a possibility if the STM32 chip doesn’t work out.

The Challenge:

I posted an Arduino programming challenge to the Arduino.cc community on Google+ and to twitter this week.

The challenge is to make a blink sketch that has nothing in it’s loop().

This is a just for fun challenge. The only requirements are that the LED blinks and loop() is empty.

I ask that submissions are made on February 22nd 2017 tagged with #ArduinoEmptyLoopChallenge

Click here to see the Google+ post.

Adventures in TDD:

Continue reading