It is Friday afternoon and children around the age of 12 are gathered in the computer lab of a public school in Itatiba, a small town an hour away from Sao Paulo. Class time is already over for the week, but these students have chosen to stay in school for extracurricular activities.

They are learning Scratch, a piece of software developed by MIT experts that aims to teach kids how to code. Most public schools in Brazil don’t have computer coding in their curriculum. In fact, most schools are struggling to get kids to learn the basics, such as maths and Portuguese, as Brazil ranks among the worst countries in the world in school exams.

Hungaroring 1988

Students and staff in Itatiba have little interest in Formula 1. But much of what is going on in the classroom is part of the legacy of legendary driver Ayrton Senna, killed in a tragic accident during the San Marino Grand Prix on 1 May 1994. The coding class is a project run by the Ayrton Senna Foundation, a non-governmental organisation (NGO) that was founded by Ayrton’s sister Viviane a few months after his death. Most of the money for the Foundation comes from managing Senna’s brand and legacy. Ayrton Senna is still one of the most valuable sporting brands in the world.

In the past five years, the foundation drew in about 1bn Brazilian reais (£250m; $320m) for the NGO. And it’s all a family affair. While Viviane is the CEO of the foundation, her daughter Bianca is head of branding. The foundation uses the money it raises to fund ambitious educational projects, which are today its core business.

“Usually companies have a philanthropic arm that helps society with social projects. We are the other way around. We are the only NGO I know that has a sports branding company inside it,” says Bianca

Ayrton Senna is still a goldmine in terms of marketing. The strongest markets for Senna products are Brazil, the UK and Italy. Research conducted in 2015 by the Boston Consulting Group suggests Senna is in the same league as tennis superstar Roger Federer and basketball legend Michael Jordan in terms of product endorsement potential. Another survey of Brazilian athletes who competed in last year’s Rio Olympics – many of them too young to have seen Senna race – ranked him as their biggest source of inspiration, above past and present idols such as Neymar and Pele.

Bianca Senna
Bianca Senna – Head of branding

The foundation does its best to fully explore the marketing potential, licensing hundreds of products with Senna’s face and name on it. It caters for two groups of consumers. The first are Formula 1 fans who buy products such as books, DVDs, helmets and collectible souvenirs. And then there are products for the general public who may not necessarily enjoy racing, but like Senna for his charisma and values. These include toys and comic books for children and a food line of ketchup, mustard and mayonnaise.

Marketing specialist Marcos Machado, from TopBrands Consultancy, says Senna’s tragic death while at the top of his game crystallised his image in the eyes of the public as a winner. Most sports stars eventually lose their appeal when they get older and retire. Some devalue their own brands by getting involved in scandals – think Ryan Lochte and Tiger Woods.

“If you consider Senna as a brand, I don’t think he has many competitors,” says Machado.

One of the brand’s strengths is that virtually all money from licensing goes to charity, not profit. Education is the foundation’s core business. Over the past two decades, it has become one of the biggest NGOs in Brazil, helping 1.9 million children and training 60,000 teachers per year. It invests heavily in research to come up with what Viviane Senna calls “vaccines” – smart solutions that can be applied to many schools with low costs.

Last year it achieved one of its greatest successes in Colegio Chico Anysio, a public school in Rio de Janeiro with students from low-income families. The institute revamped the curriculum, training students in social and emotional skills such as resilience, discipline and determination, instead of focusing solely on traditional subjects, such as maths and languages. It even came up with special metrics to identify these skills. And in the national students’ exam, Colegio Chico Anysio was ranked the fifth best school for its income level.

This year the institute is applying its “vaccine” to 20 other schools in the south of Brazil. Its work does not come without criticism, though. Teachers’ unions complain that social and emotional skills are personal traits – not skills to be measured – and that the foundation sees schools and teachers too much as enterprises.

Viviane Senna disagrees.

“If someone from the 19th Century travelled to our time, he wouldn’t see any difference in classrooms. But the rest of the world has been through a technological and scientific revolution.

“And it’s not just about bringing tablets and mobiles into students’ hands. It’s about giving them social and emotional skills to face our world.”

Viviane Senna

Despite some successes, Brazil’s level of education has been slipping recently in the Programme for International Student Assessment (Pisa) global rankings. Brazil has 50 million children in school, aged between six and 16. Only one in five end up graduating from high school. All others are lost along the way. The future is fraught with challenges for the foundation. All the work it does with schools needs to be approved by state and city governments, but public finances are collapsing in Brazil thanks to the recession.

On the branding front, it must keep the interest in Senna’s name alive, a task that is likely to get harder as years go by.

“The foundation has done outstanding work. And interest in Senna can be sustained, but not forever,” says Mr Machado.

“We have to be realistic. One day, Senna is going to be more of a distant memory than a real idol for young generations. You can keep his name alive, but not forever.”

On the racetrack, Ayrton Senna made a name for himself as a driver who could do things that seemed impossible. The foundation that now carries his name is trying to live up to that legacy.