Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Oscillator - PIC + sensor

Not open for further replies.


I'm a hobbyist primarily - but occasionally create some PIC-based devices for scientific instruments (my work). I am developing a device to log pressure measurements. The sensor I plan to use is **broken link removed**: It requires a clock source. My PIC board is "pre-made" and has an 8 MHz crystal. The device requires a 32.768 kHz oscillator. I've never really thought about it, but I don't know the clock characteristics (frequency is specified. Waveform and amplitude, I've never even thought about)? The datasheet for the ms5535 suggests a SG3030JC oscillator**broken link removed**. So, I looked it up. I'm confused on the datasheet. The sheet specifies a Vio (which is defined as the Interface Power Supply Voltage)? I was planning on tying the "out" pin to the MCL on the MS5535. Can anyone tell me what I should tie to the Vio (if anything)? Thanks!
Vio is the supply voltage that sg3030jc is interfacing with: in this case, it is likely the power supply to the mcu that the sg3030 is providing clock signal to.
Millwood - thanks for the rapid reply. Maybe I should have also mentioned that the oscillator has 4 pins - Vss, Vdd, out and the Vio. I was assuming Vss was the circuit common (ground), Vdd would be supply voltage (in my case +5V) and the Out was the 32KHz waveform. Are you then suggesting the Vio would go to the Vdd pin on the pressure sensor? I have a 3.3 V supply for that. The datasheet notes say Vio should be connected to Vdd if "not used." Would it be safe just to connect to +5V? Thanks!


I wasn't sure which part the oscillator is generating the clock signal for.

if it is generating the clock for the pressure sensor, you should tie it to the power supply of the pressure sensor.

that however will produce a timing issue because the sensor is clocked to sg3030 and the mcu is (presumably) clocked to something else. they are asynchronous and it isn't fun to deal with.

you should try to make sure that the sensor is clocked with the mcu. so a better way is actually for the mcu to generate a 32k clock for the sensor, either via software or hardware.
Feeding the totem pole output through Vio

Hola Tom,

The small scheme included there is enough to understand what they say: You can feed the totem pole output (via Vio) with any voltage within the +5V to +1.5V range.

That is:

if you apply +4.7V to Vio, the pulses will have a logic high =4.7V.
if you apply +2.8V to Vio, the pulses will have a logic high =2.8V.

If you do not need any special value, just tie Vio to +5V.

<Add> Maybe you will need to feed 3.3V to Vio. </Add>
Last edited:

it is not a totem pole output. in a totem pole output, the output is taken from the source of the upper mosfet (or emitter of the upper bjt), and the drain of the lower mosfet. In this design, the output is taken from the drains of both the upper / lower mosfet - it is a rail-to-rail output stage.

the output from the oscillator is the OUT pin. What Vio does, in conjunction with the rail/rail stage is to allow for the interfacing of the oscillator to the next part when powered by different rail voltage: the oscillator will swing to the supply voltage of the next part (minus the saturation loss in the output stage).
Right you are - Rail to rail

it is not a totem pole output
it is a rail-to-rail output stage.

No doubt, mill. You are right.

Sorry if I confused the OP.
OK, I'm enlightened (but still not clear on how to do this). If I have the MCU generate the clock, what characteristics should it have? I assume it'd be a square wave of 32.768 KHz - but would it be 3.3V amplitude (if the sensor requires a 3.3V source)? Would it be positive only (i.e. 0 to 3.3V - or oscillate around 0 V)? The MCU must deliver a clock source for the SPI communications. If I set that source to 32.768 KHz, could it be tied to both SCLK and the MCLK pins?

Thanks guys - I really appreciate the help (and learning opportunity).

Tom: yes, the output should be 32khz, and if the mcu is powered at 5v rail, the output is likely 0-5v: if that's too much for the sensor, you will have to clamp it down.

the sclk signal is used to clock data into / out of the sensor and I am not sure how that can be used also to power the master clock.
Guys, I've read over your posts and datasheets and think I understand (I guess you can be the judge here). It seems I have two options.

1) I can output a square-wave signal from my MCU which is 3.3V max between 30 and 35 kHz (range specified by the sensor's datasheet). My MCU clock is 8 MHz, so I could create a signal at FOSC/264 and clamp it to 3.3V (need to research this - would a voltage divider be OK?).

2) I can try and use the SG3030 to provide the clock into the sensor. I think I understand the discussion here, but probably not. According to the datasheet, the clock in is for the AD conversion in the sensor - not for the SPI communication clock (which is specified as 500 kHz). I am writing to a SD card (to log data) and the SPI bus will be clocked at 500 kHz (this is working on my test system). So, if I did use the SG3030, I could tie Vdd to 3.3V, Vss to common ground and use the OUT as the clock source to the sensor. The supply voltage of the "next" sensor is 3.3V (the pressure sensor) from the way Millwood explains. From the way I read it, Vdd could be 5V and Vio 3.3V and the OUT would be 3.3V 32 kHz signal (I think). From the datasheet it seems the Vio is optional. So option 2a) Vdd to SG3030 5V, Vio tied to 3.3V or 2b) Vdd 3.3V and Vio not used.

If I breadboard options 2a and 2b, I can observe the signals with an oscilloscope. I suppose I can't damage the chip doing this... Thanks for the discussion!
Was on travel - then swamped in my day job. I hooked 3.3V to the Vio, 5V to Vdd, ground to Vss and checked the OUT pin on my scope. Perfect 32 kHz square wave at 3.3V peak height. Looks like I have the oscillator part down. Still waiting for the sensor (was presumably mailed). Thanks again for the help.

Not open for further replies.

New Articles From Microcontroller Tips