Customer:
What are the two pins near the USB-C connector labeled “GND” and “ADC 5V” intended for?
Originally submitted via email support on 18 August 2023. Migrated to the forum for community visibility.
Customer:
What are the two pins near the USB-C connector labeled “GND” and “ADC 5V” intended for?
Originally submitted via email support on 18 August 2023. Migrated to the forum for community visibility.
Soldered Support:
The pin labeled GND is for Ground. The ADC 5V pin is an ADC input from the ESP8266, but with voltage dividers, so it can accept 5V. The ESP8266 has a single analog input pin, which has been made available on WiFi:Bit. The range it measures is 0V to 5V.
Customer:
Can the WiFi:Bit be programmed via micro:bit Python Editor?
Can I send multiple fields to ThingSpeak simultaneously? There are two POST commands - one supports single field send and the other multi-field send. Does your library support multi-field send? For example, the Arduino equivalent would be:
ThingSpeak.setField(1,t_val);
ThingSpeak.setField(2,h_val);
ThingSpeak.setField(3,t_val-1);
ThingSpeak.setStatus("Welcome to the Tech Shed");
ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
If not, I know how to send values for more than one field, however the readings are not received simultaneously at ThingSpeak.
How long can the WiFi:Bit be kept on - 1 hour, 1 day, indefinitely?
What is the circle with a dot in the middle on the USB-C side below the easyC connector for?
How far from the router can the WiFi:Bit be? I have noticed disconnects when the WiFi:Bit is 5 meters from the router. What occurs when the WiFi:Bit disconnects from the WiFi?
The pxt-wifibit file main.ts has this code:
export function connectToWiFiBit(): void {
serial.redirect(
SerialPin.P16,
SerialPin.P8,
BaudRate.BaudRate115200
)
}
If this functionality is included in the connectToWiFiBit() function, why does the code have to be repeated in the Explorer main.ts or have I misunderstood the code?
Whilst updating via ThingSpeak POST, we could lose the network connection. How do we check if the network is still available so that we can add a loop to reconnect?
Your website shows an example using HTTP GET to update data in ThingSpeak. Do you have a sample for retrieving the last value posted to a field in ThingSpeak?
Soldered Support:
a) It should work, however, we have only ever used and tested the MakeCode editor, which also supports Python.
b) Yes, you should be able to. Here is an example on how to string together multiple parameters in a POST request:
/param1=value1¶m2=value2
This would correspond to the input field ‘Putanja’. This will take some string combining to get right but essentially this is how it works.
c) i) If it’s powered via USB, you can run it indefinitely. If you use a battery, it depends on the capacity of the battery and would require a more detailed power analysis specific to your usage and project.
ii) The circle is a test point which is connected to GND. This is sometimes useful if repair or debugging is needed.
iii) WiFi:Bit’s WiFi is essentially the ESP8266’s WiFi. The antenna is a part of the board and has some range. The range can be improved by attaching an external antenna, though this is usually not possible on the WiFi:Bit. The range should be more than 5 meters. Check if your router is set to 2.4 GHz mode, which is best supported by the WiFi:Bit. You can choose what happens if the device disconnects by putting checks in your code. Checking if WiFi is connected every so often or after each step of user interaction is not a bad idea. Then, if WiFi is NOT connected, handle that case accordingly as you see fit.
d) Calling these init functions multiple times is completely fine, so it may have just been left in. Best not to edit it, but as it’s open source, you can try and see.
e) Check if your POST request has been responded to with an HTTP200 or HTTP201 return code. These are return codes after a successful POST request.
f) A GET request is used to get data, not send data to a server. To get the last value posted to a field in ThingSpeak, use this URL:
For example, if you want to get the last value of Field 1 from a public channel with ID 123456:
https://api.thingspeak.com/channels/123456/fields/1/last.json
Customer:
I could not work out how to check if WiFi is connected, as there is no check WiFi connected option in the library. Do you have a sample code?
Attachment omitted in migration: image.png
Attachment omitted in migration: image.png
Attachment omitted in migration: image.png
Soldered Support:
It’s difficult to provide code samples most relevant to your project because it depends on what exactly you want your program to do. Usually, not many checks are required - just one check if WiFi is connected before making the request, and attempt to reconnect if it’s not connected.
I understand the WiFi:Bit extension doesn’t have a check for is WiFi connected. To work around this, use the ESP8266_IOT extension, which was used previously for micro:Bit. This extension has a block to check if WiFi is connected that you can place within an ‘if’ block. Use all the other blocks (for connecting and making the POST request) from the WiFi:Bit library. This should work.
Attachment omitted in migration: image.png
Attachment omitted in migration: image.png
Attachment omitted in migration: image.png