He tried his hand at the home of golf where he charmed delighted spectators - before being introduced to Scotland’s other national drink, Irn-Bru.
And on Friday night he had a crowd of business leader and politicians transfixed as he spoke about some of the things closest to him in his life - including his mother and toothfloss.
Mr Obama gave people an insight into his life when he addressed a charity dinner at the Edinburgh International Conference Centre in aid of the The Hunter Foundation, set up by philanthropist Sir Tom Hunter, and the Obama Foundation, set up by the former president and his wife Michelle.
Tickets for tables of ten went on sale from about £5,000 - with some tables paying far more with an added extra of meeting the Democrat personally.
Dressed in a smart black tuxedo, Mr Obama spoke about a range of topics and described how “Democracy was hard” and said “our way of life is a garden that needs to be nurtured”.
He also told the 1,000 guests his priorities were tackling terrorism and making new economies work for all with increased globalisation and new technologies making it harder for people to get decent wages.
And he said finding new clean energy and tackling climate change could not be ignored.
He also tackled migration, saying it had to be done “in a way which is compassionate and respectful of the law”.
And, in what could be a stab at his successor, he said fake news was now an issue that had to be watched and that “too many people base facts on their opinions rather than basing their opinion on facts”.
And the room erupted in laughter when he vowed to return Scotland so he can experience “the full rainy experience” and later said he never gets too up or too down “because he’s from Hawaii”.
He told how he believed “wisdom comes from unlikely places” and for everyone “there is someone in your life who grounds you and - for me that was my mother”.
And the Democrat, who spent eight years at the White House, shared a proud moment with the audience when he revealed his greatest achievement was raising his two daughters to become “fine people”.
Asked what his best piece of advice was, the legendary icon who is known for his perfect smile, replied “Floss”.
All guests - which included singers, politicians, sportspeople and business figures - had been banned from using their mobile phones and had been vetted almost a month in advance.
The recent Manchester Attack had clearly led to heightened security as more than 40 uniformed police officers guarded all entrances and exits to the centre.
And above flats across the road two very visible snipers watched over events while a police helicopter circled overhead.
Around 250 people lined the street outside in the hope of catching a glimpse of the global icon, who left them disappointed by venturing in through a back door away from public view.
One of the first to arrive at the venue was comic Kevin Bridges, who was performing at the fundraiser. Asked if he was looking forward to seeing Mr Obama he said: “I’m excited, aye, should be good.”
Annie Lennox and Scots rockers Texas, who were also performing, also avoided the front door as did Harry Potter author JK Rowling.
First Minister Nicola Sturgeon and her husband Peter Murrell, Scots Tory leader Ruth Davidson, Scots Labour leader Kezia Dugdale and Culture Secretary Fiona Hyslop were among attendees. Along with Michelin-starred chef Andrew Fairlie, ex-Scottish rugby player Scott Hastings, businessman Sir Ian Wood and Lord Wallace, who said: “It’s very special to have Mr Obama here in Edinburgh, in Scotland, in front of so many people.”
Glasgow schoolgirl Mila Stricevic, 13, who won a competition to read a poem at the event also attended.
Event organiser Sir Tom said: “This event is all about having an inspirational speaker and, with regards to fundraising, we’re hopefully going to help about 300 children’s charities.”
Auction prizes on the night included two walk-on parts in the next Fantastic Beasts film from the Harry Potter franchise and the naming rights to the Gleneagles Hotel American bar.
Obama fans who had travelled to the capital captured the mood of the visit when they said that even though they did not see the man - they were still huge admirers.
Stewart Kermack, 61, had travelled up from Prestwick - on two long bus rides - wearing a Barack Obama T-shirt his son had bought him on a trip to the US eight years ago.
He said: “I came especially to see Obama. I think he is a great guy and was a very charismatic leader. I have never worn this T-shirt before and was never going to. But when I heard he was coming I had to wear it, Am I sad not to see him yes. But he was here, in Scotland doing what he does best - inspiring. That’s enough for me.”