Sounds like the character Conrad Stargard in "The Cross-Time Engineer" written by Leo Frankowski.
Conrad is an engineer in Poland. While on vacation, he gets drunk in an old tavern. He falls asleep in the basement when he goes looking for a toilet.
The tavern is used as a trading post by a time traveling organisation. Conrad managed to fall asleep in a bunch of goods destined for the middle ages.
When he wakes up, the transfer is complete and Conrad wanders out of the tavern with a hangover and finds himself in 13th century Poland, about 10 years before the Mongols invade in the year 1240.
There are several books about Conrad's adventures.
He does become a knight and build windmills.
Before it is all over, he has also built up a large army (disguised as a religious order to circumvent laws about who is allowed to have an army.) They are to fight off the Mongols.
He also builds a navy of steamships on the rivers in Poland. They are used for trade, but are armed - and all members of the crews belong to his army.
He builds small airplanes with motors.
He builds spark gap radios so the army has good communications.
His army has steel armor and swords made in his factories. They also have gatling gun style machine guns.
Along the way he also introduces some basic sanitation (sewers and toilets) and improved living conditions for the workers in the factories in the town he builds.
The "improving farming" bit came about accidentally.
The day he fell asleep in the tavern, he had been in a farming research facility that also sold small packets of seed to the public. Since he would be close by it on his vacation, his mother had asked him to buy some seed for.
He ended up flirting the rather attractive saleswoman in the shop - she sold him a lot more seed than was reasonable.
She was supposed to meet him at the tavern, but things got in the way and she didn't show up.
Conrad got drunk when it became clear that she wasn't coming to the tavern.
The seeds he had with him were a lot of use in medieval Poland. Modern grains and many vegetables. This brought much improved crop yields and better food.
List of books in the series:
The Cross-Time Engineer
The High-Tech Knight
The Radiant Warrior
The Flying Warlord
Lord Conrad's Lady