Facebook founder Mark Zuckerberg has revealed his own version of Tony Stark's artificial intelligence system, Jarvis, after spending a year writing computer code and teaching it to understand his voice.

The multi-billionaire showed off his creation in a cringeworthy video peppered with awkward quips, including, "Jarvis, your Mandarin is so soothing", but also demonstrated impressive tech like a computer-controlled T-shirt cannon and a front gate that recognises guests and lets them in.

Jarvis, while not as powerful as Iron Man's fictional version, can also set up conference calls and even make toast, and is voiced by Morgan Freeman. Before any of that, however, Mr Zuckerberg had first to teach his thermostat, television and music player to talk to Jarvis.

Best portrayals of Marvel characters on film Show all 8 1 /8 Best portrayals of Marvel characters on film Best portrayals of Marvel characters on film Best portrayals of Marvel characters on film Hugh Jackmanas Wolverine in 'X-Men: Days of Future Past' (2014) Best portrayals of Marvel characters on film Best portrayals of Marvel characters on film JK Simmons as JJ Jameson in Spiderman (2004) IMBD/Fox Best portrayals of Marvel characters on film Best portrayals of Marvel characters on film Chris Evans as Captain America (2014) Rex Best portrayals of Marvel characters on film Best portrayals of Marvel characters on film Patrick Stewart as Professor X in X-Men (2000) IMBD Best portrayals of Marvel characters on film Best portrayals of Marvel characters on film Scarlet Johannson as the Black Widow in the Avengers Assemble (2012) IMBD Best portrayals of Marvel characters on film Best portrayals of Marvel characters on film Tom Hiddlestone as Loki in The Avengers (2012) Rex Features Best portrayals of Marvel characters on film Best portrayals of Marvel characters on film Alan Cumming as Nightcrawler in X-Men (2003) IMBD/Fox Best portrayals of Marvel characters on film Best portrayals of Marvel characters on film Jennifer Lawrence as shape-shifting mutant Mystique in X-Men (2014) X-Men: Days of Future Past

In a Facebook post he said: "One aspect that was much more complicated than I expected was simply connecting and communicating with all of the different systems in my home.

"Before I could build any AI, I first needed to write code to connect these systems, which all speak different languages and protocols.

"Further, most appliances aren't even connected to the internet yet. It's hard to find a toaster that will let you push the bread down while it's powered off so you can automatically start toasting when the power goes on.

"I ended up finding an old toaster from the 1950s and rigging it up with a connected switch."

Between taking pot-shots at Nickelback and trolling his wife by telling Jarvis to turn off the lights through his phone, Mr Zuckerberg shows the AI keeping track of his daughter, Max, and preparing a film to watch after he tells it, "Movie time, Jarvis."

It functions similarly to Google's Home device, or Amazon's Echo.

Mr Zuckerberg said teaching the system to recognise context in natural language was both interesting and complicated.

He said: "Consider these requests related to Adele: 'play Someone Like You', 'play someone like Adele', and 'play some Adele'.

"Those sound similar, but each is a completely different category of request. The first plays a specific song, the second recommends an artist, and the third creates a playlist of Adele's best songs.

"Through a system of positive and negative feedback, an AI can learn these differences. The more context an AI has, the better it can handle open-ended requests."

While speech recognition systems have improved, he added, no artificial intelligence is currently smart enough to understand conversational speech.