China is getting smarter - but at what cost?
Thirty years ago, Shenzhen was a fishing village, surrounded by paddy fields.
Then came a plan to build China's first special economic zone to allow foreign investments, and out of the quiet rural landscape grew private businesses and factories which over time transformed into a city.
Now Shenzhen, with a population of 12 million, is just one part of a huge urbanised area running down the Pearl River Delta.
China's smart cities ambitions are among the grandest in the world. But there are questions about whether their surveillance technologies will improve the quality of inhabitants' lives or just be used to keep a closer eye on them.
By 2050, about 292 million more Chinese people will live in cities. Already more than 58% of the population are urban dwellers, compared to just 18% in 1980.
According to the authorities, there are 662 Chinese cities, including more than 160 with a million people or more.
At the Smart Cities Expo in Barcelona recently, Shenzhen had one of biggest exhibits.
Jiang Wei Dong, the general manager of the local delegation told the BBC what technologies are powering the city.
They are, he said, "seriously focused on pollution".
"Compared to other cities, Shenzhen is clean," he added.
The city is the first in China to ensure that all buses and taxis on its roads are electric, he explained.
Alongside smarter transportation, there is a new smart healthcare system, which makes sure that when anyone comes to the city from a faraway province their health records are immediately accessible.
But when asked about security systems, his response was less enthusiastic.
"We are only familiar with traffic. For the citizens of Shenzhen there is no monitoring," he said.
But at a separate event in the city itself, the public are being challenged to consider the speed at which surveillance tech is being rolled out.
Shenzhen's Futian station is hosting Eyes of the City - an exhibition which poses the question: "What happens to people and the urban landscape when the sensor-imbued city is able to gaze back?"
Among the works on show are a facial recognition system that visitors can opt out of by wearing a special mask, and displays that look back at ticket holders, analysing their emotional responses.
"One of the main objectives of the Eyes of the City exhibition is to encourage visitors to take a stance, shunning the dangerous option of neutrality," said the curator Carlo Ratti.
China is creating new cities at an astonishing rate, redefining the urban landscape with plans to create 19 gigantic urban clusters and the world's first super-city with more than 40 million inhabitants.
Urban development on this scale will demand efficiency. Traffic will have to be controlled to avoid weeklong jams, and transport will have to be green to avoid killing everyone with CO2 emissions.
But there will also be a need for citizens themselves to be more efficient. Littering, playing music too loud on a train, running across the road when the lights are red - these will stop being minor indiscretions and become major inconveniences in cities so large.
In 2014, the idea of a social credit system was unveiled. The somewhat Orwellian plan is to reward citizens for good behaviour and punish them for bad. In March this year, millions of discredited travellers were banned from buying train or plane tickets for a range of offences, such as using expired tickets or smoking on a train.
"In China, the whole social scoring experiment is fascinating but I'm glad that I don't have to live through it," said smart cities consultant Charles Reed Anderson.
Currently there is no unified social credit system. Instead local governments enforce the idea in different ways, which can sometimes have a knock-on effect on foreign visitors.
Mr Anderson told an anecdote about a friend who had recently visited a Chinese city.
"He got to his hotel and realised he had left [his phone in a taxi], so the hotel walked him to the police station," he explained.
"The police pulled up the data about the vehicle but didn't have the traffic cam so they took him to another department a few blocks away, and they were able to track the taxi in real time and called the driver to ask him to bring back the phone.
"Within two hours he had his phone back."
"The taxi driver may have been worried that if he didn't return it, he was going to get a negative score."
There has been huge criticism of the system but, says Mr Anderson, it probably feels far less creepy to Chinese citizens, who have grown up used to have their activities monitored by the state.
"I'm not 100 percent behind it - it can deliver some good things. But if it starts getting abused then it becomes a major problem," he said.
Human Rights Watch revealed earlier this year that one social credit system being used in the Xinjiang region, home to a largely Muslim population, was linked to an app used by Chinese police and other government officials.
More and more data and information is falling into the hands of the government via sensors and other technology in cities.
But what happens when cities do deals with private tech giants such as Alibaba and Tencent, who themselves have vast databases of information on citizens?
Alibaba is headquartered in the eastern city of Hangzhou and has spent two years developing a platform dubbed the City Brain, which analyses data from cameras and the GPS location of cars and buses, and uses it to control more than one thousand traffic lights to prevent gridlock.
It claims it has helped drop the city of seven million people from the fifth most congested in China to 57th on the list.
Now cities are handing over chunks of land to tech firms.
The Shenzhen government has just awarded Tencent a small 809 sq m (8,708 sq ft) plot of reclaimed land in order to build what it describes as "a future city focused on technology and innovation".
And increasingly, Western cities are also doing deals with Chinese firms.
Councillors in Darwin, Australia travelled to China to meet Huawei and see its technology in Shenzhen. The firm then implemented a $10m programme to roll out 900 smart LED lights, 24 environmental sensors and a network of 138 CCTV cameras.
Rejecting claims the city was going to implement a similar social credit scheme of its own, Lord Mayor Kon Vatskalis told ABC News that "there's no facial recognition... and our cameras can't tell who you are or what you do".