Wednesday, September 21, 2022

Galin Engine

Okay, this is going to be a long one....I've been working on a project for a couple years now, and am getting somewhere slowly. Here is a bit of background:

The most common type of the internal combustion (IC) engine is the reciprocating piston engine, where a piston moves in a linear motion inside a cylinder observing two/four stroke combustion cycles. The linear motion of the piston is converted to rotary motion of a shaft via a slider-crank mechanism. The reciprocating motion of the IC engine is a historical artefact of its predecessor - the steam engine. Since commercialisation of the IC engine in the mid-1800s, this type of engine has been a driving force behind our exponential technological progress and globalisation. 

Despite its massive success, there are a number of drawbacks in the reciprocating piston architecture that cannot be avoided. Some examples include: 
* in translating reciprocating motion to rotary motion at the point of peak force (at piston top dead centre) the lever arm in the slider-crank mechanism is zero hence no torque is generated, 
* a single cylinder engine is unbalanced generating vibration and wear on the cylinder and piston head,
* there is only one power stroke for every two revolutions of the shaft. 

The rotary vane engine has long been proposed as an alternative design to the reciprocating piston engine with the aim of avoiding the above mentioned drawbacks. This type of engine consists of a cylindrical chamber with two shafts either side, each shaft has vanes attached. The vanes create between themselves chambers of variable volume, within which the strokes of the internal combustion cycle can occur. In the case that the chamber is hermetically sealed, and combustion made to occur in one of the chambers, the vanes would oscillate at a natural frequency - hence why the term oscillating piston engine, or vibratory engine is sometimes applied to this design. 

The rotary vane engine overcomes the previously mentioned drawbacks of the reciprocating piston engine. A rotary vane single cylinder engine has a constant lever arm, hence non-zero torque output across the full duration of the combustion stroke, low vibration with no linear moving parts, and at least four power strokes per shaft revolution. However, the rotary vane engine is not without its own drawbacks - the most prominent one being that despite many attempts to build a rotary vane engine, none of the proposed designs have been successful in practical tests. The main cause of failure in all known constructions is that they employ mechanical linkages to coordinate shaft rotation. Components in these linkages experience alternating shock loadings, which quickly lead to their destruction. 

Our solution to this critical drawback in the rotary vane engine design is to use electrical machines attached to either one or both shafts to achieve necessary coordination between the shafts. Controlling the accelerating and decelerating electromagnetic torques of the electrical machines ensures the necessary coordination of rotation of the shafts, and at the same time conversion of heat energy of the fuel into electrical energy.

Monday, May 31, 2021

STM32 Synchronizing Clocks

Problem Statement:

You have two (or more) STM32 Nucleo boards, and need their clocks to be synchronized. This means, that we allow for a non-zero phase offset between the clocks, but the phase offset should not change with time. 

One way to confirm this is that viewing the clock outputs for the two boards on your scope, triggering off one waveform should freeze the other clock waveform too. 

Solution:

1. Setting up the clock on the MASTER board:

a) within STM32CubeMX navigate to the "System Core" -> RCC tab and set the LSE clock source to "Crystal/Ceramic Resonator". Also, check the "Master Clock Output" checkbox. Doing this will send the clock to the MCO pin on the board (usually GPIO pin PA8). You will then connect that pin on the MASTER board to the CN7pin29 on the SLAVE board. See figure 1 for an example.

Figure 1 - MASTER board RCC and MCO pin configuration. 

Note: The MCO pin likely automatically be configured as "Alternate Function Push Pull", however, in addition, you will need to set the maximum output speed for this pin to "High" (the default is "Low"). 

b) open STM32CubeMX for your slave board, and navigate to the "Clock Configuration" tab to see the acceptable external HSE input frequency range. Then locate the "MCO Source Mux" in STM32CubeMX of the MASTER board and select the MCO frequency to be within this range (usually 1 - 32 MHz). See figure 2 for an example clock configuration on the MASTER board.

Figure 2 - Example clock diagram for the MASTER board.

c) program the board. Hook up a scope MCO output (GPIO pin PA8) of the MASTER board, and confirm that you get a clock signal of the appropriate frequency. See figure 3. 

Figure 3 - MCO output on the MASTER board.

2. Setting up the clock on the SLAVE board (the same configuration may be repeated on other slave boards):

a) refer to the User Manual for your board and understand what board configuration is required to configure the external high-speed clock (HSE) pins to accept input from an external oscillator through pin CN7pin29 (i.e. PF0 pin). In my case both boards are MB1136, and suggested configuration on page 24 is shown in figure 4.

Figure 4 - Configuration settings from User Manual for an STM32 Nucleo board to accept an external clock signal.

Note: Make sure to get the correct manual; look up the MB number at the back of the Nucleo board and get the manual for that numbered board. In my case the MB number for both boards is MB1136, and hence this is the appropriate manual.

b) within STM32CubeMX navigate to the "System Core" -> RCC tab and set both HSE/LSE clock sources to "BYPASS Clock Source", see figure 2. Checking the "Master Clock Output" checkbox is not necessary, but will help verify that you have in fact synchronized the clocks at the end of this exercise.

Note: The Master Clock Output (MCO) is usually output to GPIO pin PA8 on most (but not all STM32) boards. This GPIO pin will automatically be configured as "Alternate Function Push Pull" but in order to see an output on the scope the maximum output speed for this pin should be set to "High" (the default is "Low"). 

c) figure 5 provides the clock diagram for the slave board. Program the board.

Figure 5 - Example clock diagram for the SLAVE board. 

3. Putting it all together:

a) connect the MCO output of the MASTER board (GPIO pin PA8, CN12pin23) to the expected HSE clock input pin on the SLAVE board (GPIO pin PF0, CN11pin29). 

b) connect a scope to the MCO outputs on both the MASTER and SLAVE boards to confirm that the clocks are in sync. See figure 6.

Figure 6 - MCO outputs from the MASTER (yellow) and SLAVE (blue) boards. You'll just have to trust me that the phase isn't varying with time :D


Tuesday, December 18, 2012

Running

The burning sun softened on its way to the ground by the canopy of eucalyptus leaves, the scented heat of the bush penetrating your skin, the soft crush of the dry leaves as your feet pound the dirt skirting around the rocks as you run down a well known path. You recognise most of these rocks as old friends, they haven't changed, but you have.

I guess it is to be expected to write a blog post about "life and everything", ponder the meaning 'of it all', and reflect on the year past at a time when the calendar year is changing.

The water glistening green and blue, and softly gurgling as it hugs the roots of trees and rocks. The submerged sand scalloped by the repeated return of waves. The air is still, the trees only occasionally rustle with the lazy wind.

"Carpe diem" and/or "Live in the moment"; oft quoted words to encourage people to dig deep for the courage to feel alive everyday. Words meant to encourage a sense of wonder and that nose tingling excitement about the world around you - I'm feeling it now. But also, for myself, a sentiment that I do not understand. Taken at face value, it's quite a stressful idea. Don't relax 'into it', concentrate, ask yourself, 'are you really living the moment?'. But wait, it's gone, try again. Okay. Oh...there it goes, lost, that moment, slipping like sand through your fingers... How do you enjoy holding sand? When all you can do is concentrate on how to keep it in your hands for longer? You know it'll all be gone anyway.

You stop. Your breath is heavy, rasping your throat, your pulse quick and your whole body feels it - the quickened rhythm of your heart. Your are alone, and you let yourself relax into the sounds around you, filled with the chatter of birds, energetic screeching of parrots, the resonant hum of cicadas.

I've recently come to realise that "carpe diem" just isn't for me. My life is full, and as it slips through my hands, I enjoy and study it as it cascades onwards. I look back and appreciate what I see, it's not easy, and why would it be?

The final leg of your run is a menacing hill. You see the car at the top, small and far away. You put your head down, and concentrate on attempting to enjoy the burning in your legs. The only way to the top is one step at a time. You'll get there, but damn it, you wonder why the hell you parked so far away :)

Sunday, November 4, 2012

GUILTY GENERATION

I'm home sick with some potent incarnation of the swine flu, hopefully not as fatal though, although I definitely have been having melodramatic feelings about writing my will on occassion. I know this is bad, because I didn't even enjoy this Saturday morning, my head feels like it's full of cotton, delirious cotton, brought upon either by fever or vast quantities of mulled wine I'm consuming....anyway... now I feel like writing something, but I of course cannot really think of anything to write, so I shall attempt to convert a talk I recently did into a blog post i.e. a form of intellectual recycling, which in this instance is actually quite apt - you'll hopefully get the joke if you read the post ;)

*****

Why do we (should we) care about climate change?

Because climate change is no longer just affecting our climate system, but through peoples efforts it is having an effect on our thinking, society, our markets, policy, economics, and industry. Sadly constantly the phrase rings out – I ‘believe’ in climate change, I do not ‘believe’ in climate change. I hope we share the desire not to believe (or not) in climate change, but because as we see its far-reaching influence, we want to ‘know’ more about it.

But I find that there’s not a lot of clarity out there on this issue. More specifically, clarity on how we are affecting it, and how we will be affected by it. This isn’t exactly clear to me. If we take to one side the question about whether humans are affecting the climate or not, and consider a message that has received some traction – that of reducing your energy consumption, or your ‘green footprint’ you get an overwhelming amount of questions:

Don’t you print double-sided? Don’t you drive a Prius? Don’t you recycle? Don’t you switch the lights off when you leave the room? Don’t you unplug your mobile phone charger? Don’t you avoid using the elevator?

We are: 'THE GUILTY GENERATION’.

'Back in the good ol’ days' people were optimistic about the future. It seems like a foreign sentiment to feel these days. Optimism about the future is unheard of in a general humanitarian sense. Sure, you can be optimistic about your future SAT scores, or your new baby etc, but about the future of mankind in general - well that's blasphemy really, and/or you just haven't been watching the news. They (i.e. our parents, and theirs) thought that by now we’d be on Mars, teleport all over the place, live forever, looking like Elle McPherson. There was excitement, optimism, things where being built, people where looking forward to the future…

Not anymore.

We, the future of the past are made to feel guilty all the time. Is that fish you’re eating? Is it from a sustainable source? But what is sustainable? (I have this awesome app on my phone: http://www.sustainableseafood.org.au/Sustainable-Seafood-Guide-Australia.asp?active_page_id=695)  Do you recycle your plastics? But did you know that packaging companies might finance recycling centers, and encouraging consumerism (http://www.forbes.com/sites/amywestervelt/2012/04/25/can-recycling-be-bad-for-the-environment/)? How is it that it may costs less to buy a new TV than to have your old one repaired? How much do cows really fart – and how is it really affecting the climate? (this is kinda cute: http://www.show.me.uk/site/news/STO873.html)
When I consider how much 'badness' there is out there, it's like trying to imagine the size of the universe - except it makes you feel guilty not giddy. I GUILTY (and I’m not even Catholic). If I starting thinking about it - I feel bad about what I eat, what I drink, how I live... If you just open the lid on ‘climate change’ you can feel like a downright rotten human being for existing, because it seems that your existence precurs the existence of the future for the human race.

I don’t think I deserve to, or that we need to.

I think the reason I become susceptible to this external guilt is that I do not understand the problem(s) entirely. I don’t know how large it is, and I don’t actually know how I contribute to it. This cloudiness leads to lack of action, to the point of apathy on my part. I think the key is in quantifying this issue, i.e. putting it in a context, and removing ambiguity always helps – for example, very simplistically, price is usually a first indicator we use to judge quality: How do I know if a bottle of wine is better than another? I look at the price. (For me £100 is always worse than a £5 bottle....especially for mulled wine... :))

So in my search for clarity, I stumbled across a text that addressed the issue of sustainable energy objectively. It got down to the numbers and quantified the situation. It’s called “Sustainable Energy: without the hot air” by David Mackay (http://www.withouthotair.com/).

This in my opinion is a text that addresses the issue (ahem…guilt) of sustainable energy (conveniently for those of you in the UK, in a British context) in a quantitative way, fanning away adjectives, and replacing them with numbers. It removes the guilty feeling, because it quantifies the problem. It answers questions about how big this problem really is, how you can affect it as an individual. By putting the issue of sustainable energy in a current quantitative context it becomes tractable.
I 'believe' that this is a work that objectively presents how you can contribute on an individual level to affecting the consumption of fossil fuels. One interesting message that I got from the book is that if “everyone does a little, we’ll achieve only a little”. What is a little? What is a lot? For example, switching off your mobile phone charger for ‘one year’ is equal to the energy in a single hot bath. The message? No more washing... ;)

Seriously. The message? Let’s stop to this guilt, by making a directed/informed choice.

Saturday, October 6, 2012

Saturday mornings


Perhaps it's something particular to Saturdays that come after a busy week, during which you've been pushing yourself to do too much, and achieving little by your standards. Perhaps it's the warmth of the bed that won't let you leave until the morning is mature. Or maybe it's the crisp air, barely warmed by the autumn sun that sends a tingle through your body as you take deep breaths to clear your head.  What is it then, that unexpectedly opens your soul to the words in a book, and the thoughts they weave send waves of emotion coursing through, your head spins and you gladly fall into a new world... 'And when you do find one, observe with care,' he said to the intern: 'they almost always have crystals in their heart.'

Thursday, October 4, 2012

Scheherazade



Tell me about the dream where we pull the bodies out of the lake
                                         and dress them in warm clothes again.
       How it was late, and no one could sleep, the horses running
until they forget that they are horses.
            It’s not like a tree where the roots have to end somewhere,
       it’s more like a song on a policeman’s radio,
         how we rolled up the carpet so we could dance, and the days
were bright red, and every time we kissed there was another apple
                                                                       to slice into pieces.
Look at the light through the windowpane. That means it’s noon, that means
        we’re inconsolable.
                            Tell me how all this, and love too, will ruin us.
These, our bodies, possessed by light.
                                                     Tell me we’ll never get used to it.

-Richard Siken

Thursday, September 13, 2012

What is it that we miss?

I love autumn particularly because it is quiet. Particularly those days when the sky is clean from clouds; the morning air is crisp and fresh, and forces you into a brisk pace. The leaves crunchy under your feet. The trees dressed in a brilliance of flame coloured leaves. The sun still warm. The evening tepid, and the wind soft as it caresses your face, and whisks away the fallen leaves. I love walking home on days like this, because I see the sunset, because the day feels tired and lazy and feels happy to have ended. Because in the blue-yellow sky I see Venus and the crescent moon, and feel romantic and eternal...

...and sometimes I remember people who are so dear to me, but with whom I can never create new memories. I miss them. I miss their voice, their hugs and warmth. Their thoughts. Sometimes this makes me think that I am a very selfish person. I miss them because I gained so much from them. Being with them made me happy, and doing things for them made me happy. Sharing my life with them made me happy, and playing a part in theirs.

Recently a dear friend passed away, and I am sad.

Now you can no longer change me, and I can no longer affect you. But I won't forget that you made me a better person and how grateful I am that you cared. I will keep you with me.

"I will always miss you."