As mentioned in the pitch part of the project, this was done at a conference Den Gode Dag. The purpose of this conference is to look at all the new technologies available, and see how these can be used to combat fake news. So, basically attendees were everything from DevOps to journalists. As part of the conference there were a few Designated Coders (I'm one of those) that had the task during the day to built a prototype/hack that somehow could be use to combat fake news and/or spread more of the available good news. This project description is what I built on that day.
I wanted to build something that resembles something people had seen before, and that used MicroPython, Sigfox and some buttons. I ended up adding a display as well and got this:
The Textstar Serial LCD Display is powered via the 3.3V and GND from the SiPy, and the UART connection is the default P3 for TXD.
The Basic IdeaThe basic idea is to have a list of news (in Danish):
goodNews = {'1': 'Kaempe fald i kulkraft',
'2': 'Middelklassen vinder frem',
'3': 'DK App beskytter skov',
'4': 'Afrika bygger groen mur',
'5': 'Baeredygtig fiskeri i Kenya'}
That is randomly chosen:
def randomNumber():
number = (machine.rng()/(2 ** 30 - 1)) * 1000
if number <= 3:
return(1)
elif (number <= 6) and (number >= 3):
return(2)
elif (number <= 9) and (number >= 6):
return(3)
elif (number <= 12) and (number >= 9):
return(4)
elif number >= 12:
return(5)
Shown on a TextStar Serial LCD Display:
def randomNews():
textstar.TEXTSTAR(uart, 'clearDisplay')
textNumber = randomNumber()
textNumber = str(textNumber)
textstar.TEXTSTAR(uart, goodNews[textNumber])
return textNumber
ButtonsThen you have the two buttons, and can choose if you think the news on the screen is good news/makes you feel good, or if it is more of an "nah" news and didn't give you a physical response. The green button was for "yay" and the blue was for "nay". After you pressed the button your selections were send to the SigFox backend and a new, randomly chosen news were provided on the display.
while True:
if p_green() == False:
pycom.rgbled(0x7f7f00)
s.send('We like '+str(newsNumber))
print(newsNumber)
newsNumber = randomNews()
print('Green')
pycom.rgbled(0x007f00)
elif p_blue() == False:
pycom.rgbled(0x7f0000)
s.send(str(newsNumber)+' is nah')
print(newsNumber)
newsNumber = randomNews()
pycom.rgbled(0x007f00)
print('Blue')
DebuggingI used the onboard LED to make it visible what the code was doing. This is a good feature for debugging when you don't have a cable plugged in. The entire system was powered by a standard powerbank.
Below is a video that shows the live demo of the project at the end of the conference. It's on Facebook and unfortunately in Danish. I couldn't get the projector to work so it is difficult to see the resulting data on the SigFox backend. But it worked.
Comments