some questions about smartpower2

Moderators: odroid, mdrjr

some questions about smartpower2

Unread postby husterkang » Thu Jan 12, 2017 11:03 pm

Hi, I recently buy smartpower2 to monitor the power of xu4.
I look the official tutorials: http://www.hardkernel.com/main/products ... 8048570542

I want to ask these questions:
1). Does smartpower2 supply power to xu4 by using DC plug cable assembly 5.5mm?
2). Are there any methods to fix the black(negative) and red(positive) metal wire? It could be very dangerous if the two wires contact with each other.
husterkang
 
Posts: 12
Joined: Tue Jan 03, 2017 5:27 pm
languages_spoken: english
ODROIDs: XU4

Re: some questions about smartpower2

Unread postby moon.linux » Fri Jan 13, 2017 2:35 am

Please find the detail on smartpower2 can support.

viewtopic.php?f=97&t=25118#p172365

Well smartpower2 is good to monitor power.
Power cord metal wire are clamped into the socket so no chance of shorting each other or damage to board.
Power switch is small to quick start the boards. I have not tried for Odroid XU4 but it should be ok.
Last edited by moon.linux on Mon Jan 16, 2017 7:36 pm, edited 1 time in total.
moon.linux
 
Posts: 672
Joined: Thu Oct 02, 2014 11:42 pm
languages_spoken: english

Re: some questions about smartpower2

Unread postby hrexha » Mon Jan 16, 2017 7:23 pm

Hello, i wanted to ask if the new firmware is available for logging over telnet? And also what is the time resolution of the logged data?
Thank you.
hrexha
 
Posts: 35
Joined: Mon Jan 25, 2016 8:59 pm
languages_spoken: english
ODROIDs: 4

Re: some questions about smartpower2

Unread postby odroid » Tue Jan 17, 2017 6:35 pm

I think we can release a firmware update to support the logging over telnet by end of January.
User avatar
odroid
Site Admin
 
Posts: 21357
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: some questions about smartpower2

Unread postby hrexha » Tue Jan 17, 2017 6:44 pm

Thank you, i will wait for that. But i was wondering even for time sensitivity in the measured data. Is there any data?
hrexha
 
Posts: 35
Joined: Mon Jan 25, 2016 8:59 pm
languages_spoken: english
ODROIDs: 4

Re: some questions about smartpower2

Unread postby odroid » Tue Jan 17, 2017 7:51 pm

Once we implement the telnet feature, let's try to find a way to improve the measurement accuracy together.
User avatar
odroid
Site Admin
 
Posts: 21357
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: some questions about smartpower2

Unread postby crashoverride » Tue Jan 17, 2017 10:17 pm

hrexha wrote:Hello, i wanted to ask if the new firmware is available for logging over telnet? And also what is the time resolution of the logged data?

I was going to implement this too. I got busy with other stuff and never pushed the updates. :oops:

The time resolution is 1 second by default. Its technically not telnet, since there is no terminal control/formatting. Its simply a TCP port that anything can open.

There are some design issues that should be discussed by the community:
1) What port number? There are future applications that we may wish to reserve port 23 for.
2) What data to include? Since "Watts = Volts * Amps" should it be included or calculated?
3) Should there be a sequence number for each line? Should there be a checksum for the data? Since the TCP protocol has delivery guarantees, neither is likely needed? However, a sequence number makes it possible to do time based queries and re-sorting in spreadsheets.
crashoverride
 
Posts: 2351
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1

Re: some questions about smartpower2

Unread postby crashoverride » Wed Jan 18, 2017 2:24 pm

I created a branch of the firmware with logging. Currently it uses port 23 (telnet).
https://github.com/OtherCrashOverride/smartpower2-hardkernel/tree/log

[edit]
It outputs comma separated values in the order:
Code: Select all
Volts, Amps, Watts, Watt Hours


The values are terminated with CR/LF.
crashoverride
 
Posts: 2351
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1

Re: some questions about smartpower2

Unread postby hrexha » Wed Jan 18, 2017 3:33 pm

Can it do logs more frequently than 1 sec?
hrexha
 
Posts: 35
Joined: Mon Jan 25, 2016 8:59 pm
languages_spoken: english
ODROIDs: 4

Re: some questions about smartpower2

Unread postby crashoverride » Wed Jan 18, 2017 4:09 pm

The timer value is set here:
https://github.com/OtherCrashOverride/smartpower2-hardkernel/blob/e1999cf242c4bdf67c7bf529e682562421bfeaa8/src/smartpower2.ino#L117
Code: Select all
 timerId = timer.setInterval(1000, handler);


You can experiment with different values. The default 1000 = 1 second.
crashoverride
 
Posts: 2351
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1

Re: some questions about smartpower2

Unread postby hrexha » Wed Jan 18, 2017 7:18 pm

Thank you for the update. A last question, how do i connect to get the data?
Thanks.
hrexha
 
Posts: 35
Joined: Mon Jan 25, 2016 8:59 pm
languages_spoken: english
ODROIDs: 4

Re: some questions about smartpower2

Unread postby crashoverride » Wed Jan 18, 2017 7:31 pm

hrexha wrote: how do i connect to get the data?

Connect to the WiFi access point the SmartPower2 provides as documented in the wiki:
http://odroid.com/dokuwiki/doku.php?id= ... martpower2

When you are connected to the device, you can telnet or use another means to establish a TCP socket connection to 192.168.4.1 port 23. Once connected, you will receive updates every second.
crashoverride
 
Posts: 2351
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1

Re: some questions about smartpower2

Unread postby hrexha » Wed Jan 18, 2017 8:31 pm

Yes, but i tried to change the interval of logs and to upload the firmware again and it gives to me error : Error: Please setup environments in `platformio.ini` file
Do you have any idea?
hrexha
 
Posts: 35
Joined: Mon Jan 25, 2016 8:59 pm
languages_spoken: english
ODROIDs: 4

Re: some questions about smartpower2

Unread postby crashoverride » Wed Jan 18, 2017 8:39 pm

Sometimes you need to try uploading multiple times before it works.

You can also try lowering the upload speed here:
https://github.com/OtherCrashOverride/s ... io.ini#L25
crashoverride
 
Posts: 2351
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1

Re: some questions about smartpower2

Unread postby hrexha » Wed Jan 18, 2017 10:16 pm

I managed to make it work with 0,1s resolution. I would like to have also three digits after the decimal point for V and I . Do you know what i have to change? Thank you.
hrexha
 
Posts: 35
Joined: Mon Jan 25, 2016 8:59 pm
languages_spoken: english
ODROIDs: 4

Re: some questions about smartpower2

Unread postby crashoverride » Wed Jan 18, 2017 10:36 pm

hrexha wrote: I would like to have also three digits after the decimal point for V and I .

I was considering the same change, so I went ahead and added it:
https://github.com/OtherCrashOverride/s ... 9c511941eb

Since its working for someone other than me, I created a pull request:
https://github.com/hardkernel/smartpower2/pull/1
crashoverride
 
Posts: 2351
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1

Re: some questions about smartpower2

Unread postby hrexha » Mon Jan 23, 2017 5:14 pm

Thank you crashoverride.
I was working on lower the resolution time to 1msec but i am not succeeding so far. As it seems it cant go below 0.06sec.
Any idea?
hrexha
 
Posts: 35
Joined: Mon Jan 25, 2016 8:59 pm
languages_spoken: english
ODROIDs: 4

Re: some questions about smartpower2

Unread postby crashoverride » Mon Jan 23, 2017 5:44 pm

According to the datasheet (page 3):
https://github.com/hardkernel/smartpowe ... ina231.pdf
The INA231 performs sample conversion at 8.244ms average (9.068 max) in normal mode. You will likely need to adjust its operating timing mode (page 12) to achieve higher speeds.
crashoverride
 
Posts: 2351
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1

Re: some questions about smartpower2

Unread postby hrexha » Tue Jan 24, 2017 5:02 pm

Thank you for the information. But i have another question if someone has any idea: Is it possible to connect to the board for signaling purposes differently than through the wireless card ?
hrexha
 
Posts: 35
Joined: Mon Jan 25, 2016 8:59 pm
languages_spoken: english
ODROIDs: 4

Re: some questions about smartpower2

Unread postby crashoverride » Tue Jan 24, 2017 5:24 pm

You can use the USB port which is actually a UART to communicate with the device. However, currently debug messages are sent over it so it would require firmware modifications to suppress that. Also, the UART controls the reset signal to the board so opening and closing the port may cause it to reset depending on OS and comm software.
crashoverride
 
Posts: 2351
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1

Re: some questions about smartpower2

Unread postby hrexha » Wed Jan 25, 2017 4:34 pm

Hello again, i need some help because my smartpower device had a problem, now i cannot connect through wireless and the SSID changed to sp2 (apparently for no reason). If i try to connect it wont accept the password and i tried the reset without any success. Any idea?
hrexha
 
Posts: 35
Joined: Mon Jan 25, 2016 8:59 pm
languages_spoken: english
ODROIDs: 4

Re: some questions about smartpower2

Unread postby hrexha » Wed Jan 25, 2017 5:23 pm

Apparently i flashed it again and now it seems stable, but i cannot go further in the measurement speed, configured the INA231 voltage conversion time to the lowest possible but still no result. I don`t know what it can be the problem.
hrexha
 
Posts: 35
Joined: Mon Jan 25, 2016 8:59 pm
languages_spoken: english
ODROIDs: 4

Re: some questions about smartpower2

Unread postby crashoverride » Wed Jan 25, 2017 7:39 pm

You will need to find out where the processing time is spent; however, I do not know of any profile tools for esp8266. There are various strategies that can be employed to minimize overhead. For example, INA231 sampling can be done in "loop" instead of a timer. The samples should also likely be buffered to memory and sent in a batch to minimize TCP overhead. Alternatively, using a UDP socket will also minimize overhead at the expense of transport reliability.

The firmware uses an arduino style framework. A good place to start experimentation would be to reduce the code down to only sampling and reporting readings. Things like LCD support use the same i2c bus as INA231 and so will add delay.
crashoverride
 
Posts: 2351
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1

Re: some questions about smartpower2

Unread postby hrexha » Thu Jan 26, 2017 1:06 am

Thank you for the response. So, you think better to start with the source file and focus on adapting some function like readPower and the handler. Make them lighter and see what happens? I noticed the connection speed of the connection was 1Mbs, can i increase the speed? Thanks a lot for the help.
hrexha
 
Posts: 35
Joined: Mon Jan 25, 2016 8:59 pm
languages_spoken: english
ODROIDs: 4

Re: some questions about smartpower2

Unread postby crashoverride » Thu Jan 26, 2017 1:18 am

hrexha wrote:So, you think better to start with the source file and focus on adapting some function like readPower and the handler.

I would start with just the wifi link sending fake log data across a TCP link and measure the performance. The ESP8266 runs a RTOS that requires processing time. I typically use a ESP8266 developer board like a Node MCU product to prototype and test before actually moving to SmartPower2 for development.

hrexha wrote: I noticed the connection speed of the connection was 1Mbs, can i increase the speed?

The ESP8266 should have a Wifi N-150 link. As with any WiFi device, the link speed will be negotiated based on environment. The closer you are to the device, the stronger the signal and faster the link should be. I should note that while a 150Mbs link should be capable, the device itself can not send/receive data sustained at that rate.
crashoverride
 
Posts: 2351
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1

Re: some questions about smartpower2

Unread postby odroid » Tue Jan 31, 2017 9:56 am

New firmware has been released.
viewtopic.php?f=86&t=25716
User avatar
odroid
Site Admin
 
Posts: 21357
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID


Return to Smart Power

Who is online

Users browsing this forum: No registered users and 1 guest